Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float4x4 columns in f32.h and f64.h are defined as v4f/v4d for __GNUC__, breaking comparisons to float4/double4 #8

Closed
ommaury opened this issue Mar 17, 2025 · 7 comments

Comments

@ommaury
Copy link

ommaury commented Mar 17, 2025

Hi,

In f32.h line 846:

union float4x4 {
#if defined(__GNUC__)
    struct {
        v4f col0;
        v4f col1;
        v4f col2;
        v4f col3;
    };
#else
    struct {
        float4 col0;
        float4 col1;
        float4 col2;
        float4 col3;
    };
#endif

And in f64.h line 850:

union double4x4 {
#if defined(__GNUC__)
    struct {
        v4d col0;
        v4d col1;
        v4d col2;
        v4d col3;
    };
#else
    struct {
        double4 col0;
        double4 col1;
        double4 col2;
        double4 col3;
    };
#endif

This breaks all comparisons to float4/double4 when __GNUC__ is defined. Should the special case be removed?

Thanks,
Olivier

@dzhdanNV
Copy link
Collaborator

It was there by a reason but I have never liked this workaround. It looks like you are using GNUC, could you please check - does it compile if both #if defined(__GNUC__) are replaced with #if 0?

@ommaury
Copy link
Author

ommaury commented Mar 18, 2025

Yes, it compiles if I remove the special cases.

@dzhdanNV
Copy link
Collaborator

OK, let's remove this! 1 min...

@dzhdanNV
Copy link
Collaborator

Thanks. Committed the fix.

@ommaury
Copy link
Author

ommaury commented Mar 18, 2025

Great, thanks!

@dzhdanNV
Copy link
Collaborator

Which GCC version are you on?

This change has broken NRD build on Linux. I even tried to update Ubuntu and VK SDK to the latest in GitHub actions... but it led to "segmentation fault" during shader compilation caused by DXC itself. Moreover, it looks like there is no a way to force GitHub actions to use latest GCC (gcc11 doesn't compile).

@dzhdanNV
Copy link
Collaborator

@ommaury I believe that latest GCC has improved support for non-trivial members in anonymous aggregates. But unfortunately upgrading GCC is not an option in some cases. Nevertheless, I have eliminated the root cause of the problem in this commit: efc5eb6. Please, verify. And open a new issue if needed.

Closing this one, since this problem is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants