krafix
krafix copied to clipboard
gl_InstanceID-based array-access in SPIR-V
The following shader
#version 450
in vec3 pos;
in vec2 uv;
in vec4 col;
out vec2 frag_uv;
uniform mat4 m[4];
void main() {
gl_Position = m[gl_InstanceID] * vec4(pos, 1.0f);
frag_uv = uv;
}
results in the following error:
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55a824ad8180, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: The result pointer storage class and base pointer storage class in OpAccessChain do not match.
%25 = OpAccessChain %_ptr_UniformConstant_mat4v4float %59 %23
and if I remove the array access it gives:
Vulkan ERROR: Code 7060244 : Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x55ae7ee40290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Structure id 43 decorated as Block must be explicitly laid out with ArrayStride decorations.
%_k_global_uniform_buffer_type = OpTypeStruct %_arr_mat4v4float_uint_4