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

@@ -101,23 +101,23 @@ gl_FragCoord origin is upper left
Name 22 ""
MemberName 22 0 "v2"
Name 24 ""
Name 28 ""
MemberName 28 0 "v3"
MemberName 28 1 "i3"
Name 28 "cbufName"
MemberName 28(cbufName) 0 "v3"
MemberName 28(cbufName) 1 "i3"
Name 30 ""
Name 35 ""
MemberName 35 0 "v4"
MemberName 35 1 "i4"
MemberName 35 2 "f1"
MemberName 35 3 "f3"
MemberName 35 4 "f4"
MemberName 35 5 "f5"
MemberName 35 6 "f6"
MemberName 35 7 "f7"
MemberName 35 8 "m1"
MemberName 35 9 "m2"
MemberName 35 10 "m3"
MemberName 35 11 "m4"
Name 35 "tbufName"
MemberName 35(tbufName) 0 "v4"
MemberName 35(tbufName) 1 "i4"
MemberName 35(tbufName) 2 "f1"
MemberName 35(tbufName) 3 "f3"
MemberName 35(tbufName) 4 "f4"
MemberName 35(tbufName) 5 "f5"
MemberName 35(tbufName) 6 "f6"
MemberName 35(tbufName) 7 "f7"
MemberName 35(tbufName) 8 "m1"
MemberName 35(tbufName) 9 "m2"
MemberName 35(tbufName) 10 "m3"
MemberName 35(tbufName) 11 "m4"
Name 37 ""
Decorate 9(@entryPointOutput) Location 0
Decorate 11(input) Location 0
@@ -127,32 +127,32 @@ gl_FragCoord origin is upper left
MemberDecorate 22 0 Offset 0
Decorate 22 BufferBlock
Decorate 24 DescriptorSet 0
MemberDecorate 28 0 Offset 0
MemberDecorate 28 1 Offset 20
Decorate 28 Block
MemberDecorate 28(cbufName) 0 Offset 0
MemberDecorate 28(cbufName) 1 Offset 20
Decorate 28(cbufName) Block
Decorate 30 DescriptorSet 10
Decorate 30 Binding 2
MemberDecorate 35 0 Offset 16
MemberDecorate 35 1 Offset 48
MemberDecorate 35 2 Offset 60
MemberDecorate 35 3 Offset 64
MemberDecorate 35 4 Offset 68
MemberDecorate 35 5 Offset 72
MemberDecorate 35 6 Offset 76
MemberDecorate 35 7 Offset 80
MemberDecorate 35 8 RowMajor
MemberDecorate 35 8 Offset 96
MemberDecorate 35 8 MatrixStride 16
MemberDecorate 35 9 ColMajor
MemberDecorate 35 9 Offset 160
MemberDecorate 35 9 MatrixStride 16
MemberDecorate 35 10 RowMajor
MemberDecorate 35 10 Offset 208
MemberDecorate 35 10 MatrixStride 16
MemberDecorate 35 11 RowMajor
MemberDecorate 35 11 Offset 272
MemberDecorate 35 11 MatrixStride 16
Decorate 35 BufferBlock
MemberDecorate 35(tbufName) 0 Offset 16
MemberDecorate 35(tbufName) 1 Offset 48
MemberDecorate 35(tbufName) 2 Offset 60
MemberDecorate 35(tbufName) 3 Offset 64
MemberDecorate 35(tbufName) 4 Offset 68
MemberDecorate 35(tbufName) 5 Offset 72
MemberDecorate 35(tbufName) 6 Offset 76
MemberDecorate 35(tbufName) 7 Offset 80
MemberDecorate 35(tbufName) 8 RowMajor
MemberDecorate 35(tbufName) 8 Offset 96
MemberDecorate 35(tbufName) 8 MatrixStride 16
MemberDecorate 35(tbufName) 9 ColMajor
MemberDecorate 35(tbufName) 9 Offset 160
MemberDecorate 35(tbufName) 9 MatrixStride 16
MemberDecorate 35(tbufName) 10 RowMajor
MemberDecorate 35(tbufName) 10 Offset 208
MemberDecorate 35(tbufName) 10 MatrixStride 16
MemberDecorate 35(tbufName) 11 RowMajor
MemberDecorate 35(tbufName) 11 Offset 272
MemberDecorate 35(tbufName) 11 MatrixStride 16
Decorate 35(tbufName) BufferBlock
Decorate 37 DescriptorSet 0
Decorate 37 Binding 8
2: TypeVoid
@@ -172,12 +172,12 @@ gl_FragCoord origin is upper left
22: TypeStruct 7(fvec4)
23: TypePointer Uniform 22(struct)
24: 23(ptr) Variable Uniform
28: TypeStruct 7(fvec4) 16(int)
29: TypePointer Uniform 28(struct)
28(cbufName): TypeStruct 7(fvec4) 16(int)
29: TypePointer Uniform 28(cbufName)
30: 29(ptr) Variable Uniform
34: TypeMatrix 7(fvec4) 3
35: TypeStruct 7(fvec4) 16(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 34 34 34 34
36: TypePointer Uniform 35(struct)
35(tbufName): TypeStruct 7(fvec4) 16(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 34 34 34 34
36: TypePointer Uniform 35(tbufName)
37: 36(ptr) Variable Uniform
4(PixelShaderFunction): 2 Function None 3
5: Label