KhronosGroup / KhronosGroup/SPIRV-Reflect
Issue with RelaxedPrecision and OpCompositeConstruct
- Dominant language
- C
- Stars
- 871
- Forks
- 188
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
I have the following shader:
```
Capability Shader
Capability Sampled1D
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
ExecutionMode 4 OriginUpperLeft
Source GLSL 430
SourceExtension "GL_EXT_nonuniform_qualifier"
SourceExtension "GL_GOOGLE_cpp_style_line_directive"
SourceExtension "GL_GOOGLE_include_directive"
Name 4 "main"
Name 9 "fragColor"
Name 11 "gl_DefaultUniformBlock"
MemberName 11(gl_DefaultUniformBlock) 0 "uTDPass"
MemberName 11(gl_DefaultUniformBlock) 1 "uTDCurrentDepth"
MemberName 11(gl_DefaultUniformBlock) 2 "exampleUniform"
Name 13 ""
Decorate 9(fragColor) RelaxedPrecision
Decorate 9(fragColor) Location 0
MemberDecorate 11(gl_DefaultUniformBlock) 0 Offset 0
MemberDecorate 11(gl_DefaultUniformBlock) 1 Offset 4
MemberDecorate 11(gl_DefaultUniformBlock) 2 RelaxedPrecision
MemberDecorate 11(gl_DefaultUniformBlock) 2 Offset 8
Decorate 11(gl_DefaultUniformBlock) Block
Decorate 17 RelaxedPrecision
Decorate 18 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(fragColor): 8(ptr) Variable Output
10: TypeInt 32 1
11(gl_DefaultUniformBlock): TypeStruct 10(int) 10(int) 6(float)
12: TypePointer PushConstant 11(gl_DefaultUniformBlock)
13: 12(ptr) Variable PushConstant
14: 10(int) Constant 2
15: TypePointer PushConstant 6(float)
4(main): 2 Function None 3
5: Label
16: 15(ptr) AccessChain 13 14
17: 6(float) Load 16
18: 7(fvec4) CompositeConstruct 17 17 17 17
Store 9(fragColor) 18
Return
FunctionEnd
```
Reflection fails since it's trying to reflect the RelaxedPrecision on result_id 18, however ParseNodes() does not assign the result_id to OpCompositeConstruct nodes. Isn't OpCompositeConstruct a load/store operation, and should be treated as such? The SPIR-V is coming out of GLSLang, and passes the SPIR-V validator.
Thanks
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading ParseNodes() and the reflection parser's handling of OpCompositeConstruct nodes. Reproduce the supplied shader case and verify that RelaxedPrecision attached to result_id 18 is reflected correctly without breaking validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100