I have a compute shader:
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_gpu_shader_int64 : enable
layout(local_size_x_id = 0) in;
layout(set = 0, binding = 0) buffer Foo {
u64vec2[256] scratchpad;
} foo;
layout(set = 0, binding = 1) uniform Bar {
u64vec2 a;
u64vec2 b;
} bar;
void main() {
int foobar = 0;
int baz = 0;
}
I compiled this with glslangValidator from LunarG SDK 1.0.65.0 and checked it using spirv-val, which returned nothing. I enabled shaderInt64when creating the VkDevice. When loading this shader using vkCreateShaderModule I get this validation error:
SPIR-V module not valid: Invalid instruction word count: 0
The validation error goes away when I do any of the following:
intFoo or Bar buffersmainlayout(local_size_x_id = 0) inMy question is, is this a bug in the compiler or validation layers, or am I using one of these features incorrectly?
If you are loading SPIR-V at runtime from file, you have to open the file in a binary mode (e.g. std::ifstream::binary in C++). Otherwise your binary may get changed when loading (i.e. usually the runtime tries to switch newline character(s) based on the platform it runs on).
Alternativelly you can load shaders statically (via #include) as a C++ inline file. You can create such file by glslc -mfmt=c or glslangValidator -V -x --vn variable_name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With