Closed TonyBarbour closed 5 years ago
The following shader (from the Vulkan-ValidationLayers tests) when instrumented for bindless validation, produces an invalid shader:
layout(std140, set = 0, binding = 0) uniform foo { uint tex_index[1]; } uniform_index_buffer; layout(set = 0, binding = 1) uniform sampler2D tex[6]; vec2 vertices[3]; void main(){ vertices[0] = vec2(-1.0, -1.0); vertices[1] = vec2( 1.0, -1.0); vertices[2] = vec2( 0.0, 1.0); gl_Position = vec4(vertices[gl_VertexIndex % 3], 0.0, 1.0); gl_Position += 1e-30 * texture(tex[uniform_index_buffer.tex_index[0]], vec2(0, 0)); }
Saving it as shader.vert, then glslangValidator.exe -V -Os --amb --aml -o shader.vert.spv shader.vert spirv-opt.exe --inst-bindless-check -o shader.vert.inst.spv shader.vert.spv spirv-val.exe .\shader.vert.inst.spv
Results in: error: line 166: OpLoad Result Type '8[%uint]' does not match Pointer '34[%gl_VertexIndex]'s type. %107 = OpLoad %uint %gl_VertexIndex
I will fix this.
The following shader (from the Vulkan-ValidationLayers tests) when instrumented for bindless validation, produces an invalid shader:
version 450
layout(std140, set = 0, binding = 0) uniform foo { uint tex_index[1]; } uniform_index_buffer; layout(set = 0, binding = 1) uniform sampler2D tex[6]; vec2 vertices[3]; void main(){ vertices[0] = vec2(-1.0, -1.0); vertices[1] = vec2( 1.0, -1.0); vertices[2] = vec2( 0.0, 1.0); gl_Position = vec4(vertices[gl_VertexIndex % 3], 0.0, 1.0); gl_Position += 1e-30 * texture(tex[uniform_index_buffer.tex_index[0]], vec2(0, 0)); }
Saving it as shader.vert, then glslangValidator.exe -V -Os --amb --aml -o shader.vert.spv shader.vert spirv-opt.exe --inst-bindless-check -o shader.vert.inst.spv shader.vert.spv spirv-val.exe .\shader.vert.inst.spv
Results in: error: line 166: OpLoad Result Type '8[%uint]' does not match Pointer '34[%gl_VertexIndex]'s type.
%107 = OpLoad %uint %gl_VertexIndex