KhronosGroup / KhronosGroup/glslang
SPIR-V Validation Errors when using Vulkan Relaxed Rules
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
Somehow it generates this error
```SPIRV-Tools Validation Errors
error: [VUID-StandaloneSpirv-Flat-04744] Fragment OpEntryPoint operand 22 with Input interfaces with integer or float type must have a Flat decoration for Entry Point id 4.
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
```
## Fragment Shader
```glsl
#version 450
precision highp float;
in vec2 fragTexCoord;
uniform sampler2D texSampler;
out vec4 diffuseColor;
void main() {
diffuseColor = texture(texSampler, fragTexCoord);
}
```
## Assembly generated
```
; SPIR-V
; Version: 1.6
; Generator: Khronos Glslang Reference Front End; 11
; Bound: 24
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %diffuseColor %texSampler %fragTexCoord %gl_VertexIndex %gl_InstanceIndex
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 450
OpName %main "main"
OpName %diffuseColor "diffuseColor"
OpName %texSampler "texSampler"
OpName %fragTexCoord "fragTexCoord"
OpName %gl_VertexIndex "gl_VertexIndex"
OpName %gl_InstanceIndex "gl_InstanceIndex"
OpDecorate %diffuseColor Location 0
OpDecorate %texSampler DescriptorSet 0
OpDecorate %texSampler Binding 1
OpDecorate %fragTexCoord Location 0
OpDecorate %gl_VertexIndex BuiltIn VertexIndex
OpDecorate %gl_InstanceIndex BuiltIn InstanceIndex
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%diffuseColor = OpVariable %_ptr_Output_v4float Output
%10 = OpTypeImage %float 2D 0 0 0 1 Unknown
%11 = OpTypeSampledImage %10
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%texSampler = OpVariable %_ptr_UniformConstant_11 UniformConstant
%v2float = OpTypeVector %float 2
%_ptr_Input_v2float = OpTypePointer Input %v2float
%fragTexCoord = OpVariable %_ptr_Input_v2float Input
%int = OpTypeInt 32 1
%_ptr_Input_int = OpTypePointer Input %int
%gl_VertexIndex = OpVariable %_ptr_Input_int Input
%gl_InstanceIndex = OpVariable %_ptr_Input_int Input
%main = OpFunction %void None %3
%5 = OpLabel
%14 = OpLoad %11 %texSampler
%18 = OpLoad %v2float %fragTexCoord
%19 = OpImageSampleImplicitLod %v4float %14 %18
OpStore %diffuseColor %19
OpReturn
OpFunctionEnd
```
Contributor guide
Research direction
Start by reproducing the supplied Fragment Shader and inspecting the generated Assembly alongside the SPIR-V validation error. Determine why the generated entry point includes the reported integer inputs under Vulkan Relaxed Rules; done means the shader's generated SPIR-V passes validation without that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100