add reflection queries to return a TType. Fix minor issue with interface names.

- Add new queries: TProgram::getUniformTType and getUniformBlockTType,
  which return a const TType*, or nullptr on a bad index.  These are valid for
  any source language.

- Interface name for HLSL cbuffers is taken from the (only) available declaration name,
  whereas before it was always an empty string, which caused some troubles with reflection
  mapping them all to the same index slot.  This also makes it appear in the SPIR-V binary
  instead of an empty string.

- Print the binding as part of the reflection textual dump.

- TType::clone becomes const.  Needed to call it from a const method, and anyway it doesn't
  change the object it's called on.

- Because the TObjectReflection constructor is called with a TType *reference* (not pointer)
  so that it's guaranteed to pass in a type, and the "badReflection" value should use a nullptr
  there, that now has a dedicated static method to obtain the bad value.  It uses a private
  constructor, so external users can't create one with a nullptr type.
This commit is contained in:
steve-lunarg
2016-09-21 14:19:40 -06:00
parent de97fe0ad4
commit 8ffc36aecc
16 changed files with 407 additions and 283 deletions

View File

@@ -77,23 +77,23 @@ gl_FragCoord origin is upper left
Name 4 "main"
Name 11 "PixelShaderFunction(vf4;"
Name 10 "input"
Name 14 ""
MemberName 14 0 "v1"
Name 14 "tbufName"
MemberName 14(tbufName) 0 "v1"
Name 16 ""
Name 23 ""
MemberName 23 0 "v5"
Name 23 "tbufName2"
MemberName 23(tbufName2) 0 "v5"
Name 25 ""
Name 30 ""
MemberName 30 0 "v1PostLayout"
Name 30 "tbufName2"
MemberName 30(tbufName2) 0 "v1PostLayout"
Name 32 ""
MemberDecorate 14 0 Offset 16
Decorate 14 BufferBlock
MemberDecorate 14(tbufName) 0 Offset 16
Decorate 14(tbufName) BufferBlock
Decorate 16 DescriptorSet 3
Decorate 16 Binding 5
MemberDecorate 23 0 Offset 0
Decorate 23 BufferBlock
MemberDecorate 30 0 Offset 16
Decorate 30 BufferBlock
MemberDecorate 23(tbufName2) 0 Offset 0
Decorate 23(tbufName2) BufferBlock
MemberDecorate 30(tbufName2) 0 Offset 16
Decorate 30(tbufName2) BufferBlock
Decorate 32 DescriptorSet 4
Decorate 32 Binding 7
Decorate 38 SpecId 17
@@ -103,18 +103,18 @@ gl_FragCoord origin is upper left
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr)
14: TypeStruct 7(fvec4)
15: TypePointer Uniform 14(struct)
14(tbufName): TypeStruct 7(fvec4)
15: TypePointer Uniform 14(tbufName)
16: 15(ptr) Variable Uniform
17: TypeInt 32 1
18: 17(int) Constant 0
19: TypePointer Uniform 7(fvec4)
23: TypeStruct 7(fvec4)
24: TypePointer PushConstant 23(struct)
23(tbufName2): TypeStruct 7(fvec4)
24: TypePointer PushConstant 23(tbufName2)
25: 24(ptr) Variable PushConstant
26: TypePointer PushConstant 7(fvec4)
30: TypeStruct 7(fvec4)
31: TypePointer Uniform 30(struct)
30(tbufName2): TypeStruct 7(fvec4)
31: TypePointer Uniform 30(tbufName2)
32: 31(ptr) Variable Uniform
38: 17(int) SpecConstant 10
4(main): 2 Function None 3