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

Vulkan tests fail on 32bit x86 systems #465

Open
tatokis opened this issue Apr 7, 2024 · 3 comments
Open

Vulkan tests fail on 32bit x86 systems #465

tatokis opened this issue Apr 7, 2024 · 3 comments

Comments

@tatokis
Copy link

tatokis commented Apr 7, 2024

The Vulkan tests fail on 32bit x86 systems with errors such as:

[root@arch32-builder3 glad-2.0.6]# gcc -Wall -Wextra -Werror -Wsign-conversion -Wcast-qual -Wstrict-prototypes -ansi -pedantic -save-temps /build/glad/src/glad-2.0.6/test/c/compile/vulkan/alias/001/test.c -o /build/glad/src/glad-2.0.6/build/test -I/build/glad/src/glad-2.0.6/build/include /build/glad/src/glad-2.0.6/build/src/vulkan.c -ldl
In file included from /build/glad/src/glad-2.0.6/test/c/compile/vulkan/alias/001/test.c:9:
/build/glad/src/glad-2.0.6/build/include/glad/vulkan.h:4453:1: error: integer constant is too large for 'long' type [-Werror=long-long]      
 4453 | static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 4294967296;

This is because the tests are compiled with -ansi, but on 32bit x86 the only way to get a 64 bit integer is by using long long, which requires C99.

Passing -std=c99 instead of -ansi resolves it. I am unsure as to how this should be properly resolved, as I assume you explicitly want to verify the code builds as C90 on other platforms.

@Dav1dde
Copy link
Owner

Dav1dde commented Apr 7, 2024

Hey, thanks for the report, seems like glad should generate the constant as:

 static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 4294967296ULL;

@tatokis
Copy link
Author

tatokis commented Apr 7, 2024

Thanks for the quick response. I just tested it, and I'm not sure that works.

[root@arch32-builder3 /]# cat test.c 
#include <inttypes.h>
typedef uint64_t VkAccessFlagBits2;
static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 4294967296ULL;

int main() { return 0; }
[root@arch32-builder3 /]# gcc -ansi -pedantic test.c
test.c:3:70: warning: use of C99 long long integer constant [-Wlong-long]
    3 | static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 4294967296ULL;
      |                                                                      ^~~~~~~~~~~~~

@Dav1dde
Copy link
Owner

Dav1dde commented Apr 7, 2024

Yeah seems to be a C99 thing :(

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

No branches or pull requests

2 participants