Merge pull request #1684 from baldurk/reflection-interface-improve

Opt-in improvements to reflection interface
This commit is contained in:
John Kessenich 2019-02-09 12:59:30 +07:00 committed by GitHub
commit d83344fc4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 1000 additions and 273 deletions

View File

@ -152,6 +152,7 @@ void ProcessConfigFile()
}
}
int ReflectOptions = EShReflectionDefault;
int Options = 0;
const char* ExecutableName = nullptr;
const char* binaryFileName = nullptr;
@ -523,6 +524,16 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options |= EOptionNoStorageFormat;
} else if (lowerword == "relaxed-errors") {
Options |= EOptionRelaxedErrors;
} else if (lowerword == "reflect-strict-array-suffix") {
ReflectOptions |= EShReflectionStrictArraySuffix;
} else if (lowerword == "reflect-basic-array-suffix") {
ReflectOptions |= EShReflectionBasicArraySuffix;
} else if (lowerword == "reflect-intermediate-io") {
ReflectOptions |= EShReflectionIntermediateIO;
} else if (lowerword == "reflect-separate-buffers") {
ReflectOptions |= EShReflectionSeparateBuffers;
} else if (lowerword == "reflect-all-block-variables") {
ReflectOptions |= EShReflectionAllBlockVariables;
} else if (lowerword == "resource-set-bindings" || // synonyms
lowerword == "resource-set-binding" ||
lowerword == "rsb") {
@ -1051,7 +1062,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
// Reflect
if (Options & EOptionDumpReflection) {
program.buildReflection();
program.buildReflection(ReflectOptions);
program.dumpReflection();
}
@ -1518,6 +1529,15 @@ void usage()
" --invert-y | --iy invert position.Y output in vertex shader\n"
" --keep-uncalled | --ku don't eliminate uncalled functions\n"
" --no-storage-format | --nsf use Unknown image format\n"
" --reflect-strict-array-suffix use strict array suffix rules when\n"
" reflecting\n"
" --reflect-basic-array-suffix arrays of basic types will have trailing [0]\n"
" --reflect-intermediate-io reflection includes inputs/outputs of linked\n"
" shaders rather than just vertex/fragment\n"
" --reflect-separate-buffers reflect buffer variables and blocks\n"
" separately to uniforms\n"
" --reflect-all-block-variables reflect all variables in blocks, whether\n"
" inactive or active\n"
" --resource-set-binding [stage] name set binding\n"
" set descriptor set and binding for\n"
" individual resources\n"

View File

@ -3,8 +3,8 @@ Uniform reflection:
t1: offset -1, type 8b5d, size 1, index -1, binding 11, stages 16
t2: offset -1, type 8b5e, size 1, index -1, binding 12, stages 16
t3: offset -1, type 8b5f, size 1, index -1, binding 13, stages 16
t4.@data: offset 0, type 8b52, size 1, index 0, binding -1, stages 16
t5.@data: offset 0, type 1405, size 0, index 1, binding -1, stages 16
t4.@data: offset 0, type 8b52, size 1, index 0, binding -1, stages 16, arrayStride 16, topLevelArrayStride 16
t5.@data: offset 0, type 1405, size 0, index 1, binding -1, stages 16, arrayStride 4, topLevelArrayStride 4
t6: offset -1, type 8dc2, size 1, index -1, binding 16, stages 16
s1: offset -1, type 0, size 1, index -1, binding 31, stages 16
s2: offset -1, type 0, size 1, index -1, binding 32, stages 16
@ -12,18 +12,25 @@ u1: offset -1, type 904c, size 1, index -1, binding 41, stages 16
u2: offset -1, type 904d, size 1, index -1, binding 42, stages 16
u3: offset -1, type 904e, size 1, index -1, binding 43, stages 16
u4: offset -1, type 9051, size 1, index -1, binding 44, stages 16
u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16
u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16
u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16, arrayStride 4, topLevelArrayStride 4
u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16, arrayStride 4, topLevelArrayStride 4
cb1: offset 0, type 1404, size 1, index 4, binding -1, stages 16
tb1: offset 0, type 1404, size 1, index 5, binding -1, stages 16
Uniform block reflection:
t4: offset -1, type ffffffff, size 0, index -1, binding 14, stages 0
t5: offset -1, type ffffffff, size 0, index -1, binding 15, stages 0
u5: offset -1, type ffffffff, size 0, index -1, binding 45, stages 0
u6: offset -1, type ffffffff, size 0, index -1, binding 46, stages 0
cb: offset -1, type ffffffff, size 4, index -1, binding 51, stages 0
tb: offset -1, type ffffffff, size 4, index -1, binding 17, stages 0
t4: offset -1, type ffffffff, size 0, index -1, binding 14, stages 16, numMembers 1
t5: offset -1, type ffffffff, size 0, index -1, binding 15, stages 16, numMembers 1
u5: offset -1, type ffffffff, size 0, index -1, binding 45, stages 16, numMembers 1
u6: offset -1, type ffffffff, size 0, index -1, binding 46, stages 16, numMembers 1
cb: offset -1, type ffffffff, size 4, index -1, binding 51, stages 16, numMembers 1
tb: offset -1, type ffffffff, size 4, index -1, binding 17, stages 16, numMembers 1
Vertex attribute reflection:
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
Pipeline output reflection:
@entryPointOutput: offset 0, type 8b52, size 0, index 0, binding -1, stages 16

View File

@ -2,8 +2,8 @@ hlsl.reflection.binding.frag
Uniform reflection:
t1: offset -1, type 8b5d, size 1, index -1, binding 15, stages 16
s1: offset -1, type 0, size 1, index -1, binding 5, stages 16
t1a: offset -1, type 8b5d, size 1, index -1, binding 16, stages 16
s1a: offset -1, type 0, size 1, index -1, binding 6, stages 16
t1a: offset -1, type 8b5d, size 1, index -1, binding 16, stages 16, arrayStride 4, topLevelArrayStride 4
s1a: offset -1, type 0, size 1, index -1, binding 6, stages 16, arrayStride 4, topLevelArrayStride 4
c1_a: offset 0, type 8b52, size 1, index 0, binding -1, stages 16
c1_b: offset 16, type 1404, size 1, index 0, binding -1, stages 16
c1_c: offset 20, type 1406, size 1, index 0, binding -1, stages 16
@ -12,8 +12,15 @@ c2_b: offset 16, type 1404, size 1, index 1, binding -1, stages 16
c2_c: offset 20, type 1406, size 1, index 1, binding -1, stages 16
Uniform block reflection:
cbuff1: offset -1, type ffffffff, size 24, index -1, binding 2, stages 0
cbuff2: offset -1, type ffffffff, size 24, index -1, binding 3, stages 0
cbuff1: offset -1, type ffffffff, size 24, index -1, binding 2, stages 16, numMembers 3
cbuff2: offset -1, type ffffffff, size 24, index -1, binding 3, stages 16, numMembers 3
Vertex attribute reflection:
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
Pipeline output reflection:
psout.Color: offset 0, type 8b52, size 0, index 0, binding -1, stages 16

View File

@ -7,70 +7,76 @@ scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1, stages 1
c_m23: offset 16, type 8b67, size 1, index 2, binding -1, stages 1
c_scalarAfterm23: offset 48, type 1404, size 1, index 2, binding -1, stages 1
scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1, stages 1
floatArray: offset 112, type 1406, size 5, index 0, binding -1, stages 1
floatArray: offset 112, type 1406, size 5, index 0, binding -1, stages 1, arrayStride 16, topLevelArrayStride 16
scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1, stages 1
m22: offset 208, type 8b5a, size 9, index 0, binding -1, stages 1
dm22: offset 32, type 8b5a, size 4, index 1, binding -1, stages 1
m22: offset 208, type 8b5a, size 9, index 0, binding -1, stages 1, arrayStride 32, topLevelArrayStride 32
dm22: offset 32, type 8b5a, size 4, index 1, binding -1, stages 1, arrayStride 32, topLevelArrayStride 32
foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1, stages 1
foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1, stages 1
foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1, stages 1
foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1, stages 1
deepA.d2.d1[2].va: offset 440, type 8b50, size 2, index 1, binding -1, stages 1
deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1
deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1
deepB.d2.d1[1].va: offset 1016, type 8b50, size 2, index 1, binding -1, stages 1
deepB.d2.d1[2].va: offset 1048, type 8b50, size 2, index 1, binding -1, stages 1
deepB.d2.d1[3].va: offset 1080, type 8b50, size 2, index 1, binding -1, stages 1
deepC.iv4: offset 1568, type 8b52, size 1, index 1, binding -1, stages 1
deepC.d2.i: offset 1584, type 1404, size 1, index 1, binding -1, stages 1
deepC.d2.d1[0].va: offset 1592, type 8b50, size 3, index 1, binding -1, stages 1
deepC.d2.d1[0].b: offset 1616, type 8b56, size 1, index 1, binding -1, stages 1
deepC.d2.d1[1].va: offset 1624, type 8b50, size 3, index 1, binding -1, stages 1
deepC.d2.d1[1].b: offset 1648, type 8b56, size 1, index 1, binding -1, stages 1
deepC.d2.d1[2].va: offset 1656, type 8b50, size 3, index 1, binding -1, stages 1
deepC.d2.d1[2].b: offset 1680, type 8b56, size 1, index 1, binding -1, stages 1
deepC.d2.d1[3].va: offset 1688, type 8b50, size 3, index 1, binding -1, stages 1
deepC.d2.d1[3].b: offset 1712, type 8b56, size 1, index 1, binding -1, stages 1
deepC.v3: offset 1728, type 8b54, size 1, index 1, binding -1, stages 1
deepD[0].iv4: offset 2480, type 8b52, size 1, index 1, binding -1, stages 1
deepD[0].d2.i: offset 2496, type 1404, size 1, index 1, binding -1, stages 1
deepD[0].d2.d1[0].va: offset 2504, type 8b50, size 3, index 1, binding -1, stages 1
deepD[0].d2.d1[0].b: offset 2528, type 8b56, size 1, index 1, binding -1, stages 1
deepD[0].d2.d1[1].va: offset 2536, type 8b50, size 3, index 1, binding -1, stages 1
deepD[0].d2.d1[1].b: offset 2560, type 8b56, size 1, index 1, binding -1, stages 1
deepD[0].d2.d1[2].va: offset 2568, type 8b50, size 3, index 1, binding -1, stages 1
deepD[0].d2.d1[2].b: offset 2592, type 8b56, size 1, index 1, binding -1, stages 1
deepD[0].d2.d1[3].va: offset 2600, type 8b50, size 3, index 1, binding -1, stages 1
deepD[0].d2.d1[3].b: offset 2624, type 8b56, size 1, index 1, binding -1, stages 1
deepD[0].v3: offset 2640, type 8b54, size 1, index 1, binding -1, stages 1
deepD[1].iv4: offset 2784, type 8b52, size 1, index 1, binding -1, stages 1
deepD[1].d2.i: offset 2800, type 1404, size 1, index 1, binding -1, stages 1
deepD[1].d2.d1[0].va: offset 2808, type 8b50, size 3, index 1, binding -1, stages 1
deepD[1].d2.d1[0].b: offset 2832, type 8b56, size 1, index 1, binding -1, stages 1
deepD[1].d2.d1[1].va: offset 2840, type 8b50, size 3, index 1, binding -1, stages 1
deepD[1].d2.d1[1].b: offset 2864, type 8b56, size 1, index 1, binding -1, stages 1
deepD[1].d2.d1[2].va: offset 2872, type 8b50, size 3, index 1, binding -1, stages 1
deepD[1].d2.d1[2].b: offset 2896, type 8b56, size 1, index 1, binding -1, stages 1
deepD[1].d2.d1[3].va: offset 2904, type 8b50, size 3, index 1, binding -1, stages 1
deepD[1].d2.d1[3].b: offset 2928, type 8b56, size 1, index 1, binding -1, stages 1
deepD[1].v3: offset 2944, type 8b54, size 1, index 1, binding -1, stages 1
deepA.d2.d1[2].va: offset 440, type 8b50, size 2, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepB.d2.d1[1].va: offset 1016, type 8b50, size 2, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepB.d2.d1[2].va: offset 1048, type 8b50, size 2, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepB.d2.d1[3].va: offset 1080, type 8b50, size 2, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepC.iv4: offset 1568, type 8b52, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepC.d2.i: offset 1584, type 1404, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepC.d2.d1[0].va: offset 1592, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepC.d2.d1[0].b: offset 1616, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepC.d2.d1[1].va: offset 1624, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepC.d2.d1[1].b: offset 1648, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepC.d2.d1[2].va: offset 1656, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepC.d2.d1[2].b: offset 1680, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepC.d2.d1[3].va: offset 1688, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepC.d2.d1[3].b: offset 1712, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepC.v3: offset 1728, type 8b54, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].iv4: offset 2480, type 8b52, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].d2.i: offset 2496, type 1404, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].d2.d1[0].va: offset 2504, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[0].d2.d1[0].b: offset 2528, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].d2.d1[1].va: offset 2536, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[0].d2.d1[1].b: offset 2560, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].d2.d1[2].va: offset 2568, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[0].d2.d1[2].b: offset 2592, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].d2.d1[3].va: offset 2600, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[0].d2.d1[3].b: offset 2624, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[0].v3: offset 2640, type 8b54, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].iv4: offset 2784, type 8b52, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].d2.i: offset 2800, type 1404, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].d2.d1[0].va: offset 2808, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[1].d2.d1[0].b: offset 2832, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].d2.d1[1].va: offset 2840, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[1].d2.d1[1].b: offset 2864, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].d2.d1[2].va: offset 2872, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[1].d2.d1[2].b: offset 2896, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].d2.d1[3].va: offset 2904, type 8b50, size 3, index 1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 304
deepD[1].d2.d1[3].b: offset 2928, type 8b56, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
deepD[1].v3: offset 2944, type 8b54, size 1, index 1, binding -1, stages 1, topLevelArrayStride 304
foo1: offset 0, type 1406, size 1, index 4, binding -1, stages 1
foo2: offset 0, type 1406, size 1, index 5, binding -1, stages 1
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1, stages 1
uf1: offset 16, type 1406, size 1, index 1, binding -1, stages 1
Uniform block reflection:
nameless: offset -1, type ffffffff, size 496, index -1, binding -1, stages 0
$Global: offset -1, type ffffffff, size 3088, index -1, binding -1, stages 0
c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1, stages 0
nested: offset -1, type ffffffff, size 32, index -1, binding -1, stages 0
abl: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl2: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
nameless: offset -1, type ffffffff, size 496, index -1, binding -1, stages 1, numMembers 9
$Global: offset -1, type ffffffff, size 3088, index -1, binding -1, stages 1, numMembers 106
c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1, stages 1, numMembers 5
nested: offset -1, type ffffffff, size 32, index -1, binding -1, stages 1, numMembers 4
abl: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl2: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
Vertex attribute reflection:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1, stages 0
attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1, stages 0
attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1, stages 0
attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1, stages 0
attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1, stages 0
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1, stages 1
attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1, stages 1
attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1, stages 1
attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1, stages 1
attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1, stages 1
Pipeline output reflection:

View File

@ -203,8 +203,8 @@ Uniform reflection:
t1: offset -1, type 8b5d, size 1, index -1, binding 21, stages 16
t2: offset -1, type 8b5e, size 1, index -1, binding 22, stages 16
t3: offset -1, type 8b5f, size 1, index -1, binding 26, stages 16
t4.@data: offset 0, type 8b52, size 1, index 0, binding -1, stages 16
t5.@data: offset 0, type 1405, size 0, index 1, binding -1, stages 16
t4.@data: offset 0, type 8b52, size 1, index 0, binding -1, stages 16, arrayStride 16, topLevelArrayStride 16
t5.@data: offset 0, type 1405, size 0, index 1, binding -1, stages 16, arrayStride 4, topLevelArrayStride 4
t6: offset -1, type 8dc2, size 1, index -1, binding 23, stages 16
s1: offset -1, type 0, size 1, index -1, binding 11, stages 16
s2: offset -1, type 0, size 1, index -1, binding 17, stages 16
@ -212,19 +212,26 @@ u1: offset -1, type 904c, size 1, index -1, binding 31, stages 16
u2: offset -1, type 904d, size 1, index -1, binding 42, stages 16
u3: offset -1, type 904e, size 1, index -1, binding 43, stages 16
u4: offset -1, type 9051, size 1, index -1, binding 34, stages 16
u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16
u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16
u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16, arrayStride 4, topLevelArrayStride 4
u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16, arrayStride 4, topLevelArrayStride 4
cb1: offset 0, type 1404, size 1, index 4, binding -1, stages 16
tb1: offset 0, type 1404, size 1, index 5, binding -1, stages 16
ts6: offset -1, type 8b5f, size 1, index -1, binding 71, stages 16
Uniform block reflection:
t4: offset -1, type ffffffff, size 0, index -1, binding 21, stages 0
t5: offset -1, type ffffffff, size 0, index -1, binding 22, stages 0
u5: offset -1, type ffffffff, size 0, index -1, binding 44, stages 0
u6: offset -1, type ffffffff, size 0, index -1, binding 34, stages 0
cb: offset -1, type ffffffff, size 4, index -1, binding 51, stages 0
tb: offset -1, type ffffffff, size 4, index -1, binding 27, stages 0
t4: offset -1, type ffffffff, size 0, index -1, binding 21, stages 16, numMembers 1
t5: offset -1, type ffffffff, size 0, index -1, binding 22, stages 16, numMembers 1
u5: offset -1, type ffffffff, size 0, index -1, binding 44, stages 16, numMembers 1
u6: offset -1, type ffffffff, size 0, index -1, binding 34, stages 16, numMembers 1
cb: offset -1, type ffffffff, size 4, index -1, binding 51, stages 16, numMembers 1
tb: offset -1, type ffffffff, size 4, index -1, binding 27, stages 16, numMembers 1
Vertex attribute reflection:
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
Pipeline output reflection:
@entryPointOutput: offset 0, type 8b52, size 0, index 0, binding -1, stages 16

View File

@ -0,0 +1,13 @@
reflection.frag
Uniform reflection:
Uniform block reflection:
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
Pipeline output reflection:

View File

@ -0,0 +1,21 @@
reflection.linked.vert
reflection.linked.frag
Uniform reflection:
ubo_block.unused_uniform: offset 0, type 1406, size 1, index 0, binding -1, stages 0
ubo_block.shared_uniform: offset 4, type 1406, size 1, index 0, binding -1, stages 17
ubo_block.vsonly_uniform: offset 8, type 1406, size 1, index 0, binding -1, stages 1
ubo_block.fsonly_uniform: offset 12, type 1406, size 1, index 0, binding -1, stages 16
Uniform block reflection:
ubo_block: offset -1, type ffffffff, size 16, index -1, binding 0, stages 17, numMembers 4
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
vertin: offset 0, type 1406, size 0, index 0, binding -1, stages 1
Pipeline output reflection:
fragout: offset 0, type 1406, size 0, index 0, binding -1, stages 16

View File

@ -0,0 +1,20 @@
reflection.linked.vert
reflection.linked.frag
Uniform reflection:
ubo_block.shared_uniform: offset 4, type 1406, size 1, index 0, binding -1, stages 17
ubo_block.vsonly_uniform: offset 8, type 1406, size 1, index 0, binding -1, stages 17
ubo_block.fsonly_uniform: offset 12, type 1406, size 1, index 0, binding -1, stages 16
Uniform block reflection:
ubo_block: offset -1, type ffffffff, size 16, index -1, binding 0, stages 17, numMembers 4
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
vertin: offset 0, type 1406, size 0, index 0, binding -1, stages 1
Pipeline output reflection:
fragout: offset 0, type 1406, size 0, index 0, binding -1, stages 16

View File

@ -0,0 +1,14 @@
reflection.frag
Uniform reflection:
Uniform block reflection:
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
inval: offset 0, type 1406, size 0, index 0, binding -1, stages 16
Pipeline output reflection:

View File

@ -0,0 +1,40 @@
reflection.options.vert
Uniform reflection:
UBO.verts[0].position[0]: offset 0, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 24
UBO.verts[0].normal[0]: offset 12, type 1406, size 3, index 0, binding -1, stages 0, arrayStride 4, topLevelArrayStride 24
UBO.verts[1].position[0]: offset 24, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 24
UBO.verts[1].normal[0]: offset 36, type 1406, size 3, index 0, binding -1, stages 0, arrayStride 4, topLevelArrayStride 24
UBO.flt[0]: offset 48, type 1406, size 8, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 4
UBO.unused: offset 80, type 8dc8, size 1, index 0, binding -1, stages 0
Uniform block reflection:
UBO: offset -1, type ffffffff, size 96, index -1, binding -1, stages 1, numMembers 6
Buffer variable reflection:
t[0].v[0].position[0]: offset 0, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[0].normal[0]: offset 12, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[1].position[0]: offset 24, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[1].normal[0]: offset 36, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[2].position[0]: offset 48, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[2].normal[0]: offset 60, type 1406, size 3, index 0, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
padding[0]: offset 360, type 1405, size 10, index 0, binding -1, stages 0, arrayStride 4, topLevelArrayStride 4
MultipleArrays.tri[0].v[0].position[0]: offset 0, type 1406, size 3, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
MultipleArrays.tri[0].v[0].normal[0]: offset 12, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 72
MultipleArrays.tri[0].v[1].position[0]: offset 24, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 72
MultipleArrays.tri[0].v[1].normal[0]: offset 36, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 72
MultipleArrays.tri[0].v[2].position[0]: offset 48, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 72
MultipleArrays.tri[0].v[2].normal[0]: offset 60, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 72
MultipleArrays.vert[0].position[0]: offset 360, type 1406, size 3, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 24
MultipleArrays.vert[0].normal[0]: offset 372, type 1406, size 3, index 1, binding -1, stages 0, arrayStride 4, topLevelArrayStride 24
MultipleArrays.f[0]: offset 480, type 1406, size 5, index 1, binding -1, stages 1, arrayStride 4, topLevelArrayStride 4
Buffer block reflection:
VertexCollection: offset -1, type ffffffff, size 400, index -1, binding -1, stages 1, numMembers 7
MultipleArrays: offset -1, type ffffffff, size 500, index -1, binding -1, stages 1, numMembers 9
Pipeline input reflection:
gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1, stages 1
Pipeline output reflection:
outval: offset 0, type 1406, size 0, index 0, binding -1, stages 1

View File

@ -11,108 +11,152 @@ scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1, stages 1
c_m23: offset 16, type 8b67, size 1, index 2, binding -1, stages 1
c_scalarAfterm23: offset 64, type 1404, size 1, index 2, binding -1, stages 1
scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1, stages 1
floatArray: offset 112, type 1406, size 5, index 0, binding -1, stages 1
floatArray: offset 112, type 1406, size 5, index 0, binding -1, stages 1, arrayStride 16, topLevelArrayStride 16
scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1, stages 1
named.memvec2: offset 48, type 8b50, size 1, index 1, binding -1, stages 1
named.memf1: offset 56, type 1406, size 1, index 1, binding -1, stages 1
named.memf2: offset 60, type 8b56, size 1, index 1, binding -1, stages 1
named.memf3: offset 64, type 1404, size 1, index 1, binding -1, stages 1
named.memvec2a: offset 72, type 8b50, size 1, index 1, binding -1, stages 1
named.m22: offset 80, type 8b5a, size 7, index 1, binding -1, stages 1
dm22: offset -1, type 8b5a, size 4, index -1, binding -1, stages 1
m22: offset 208, type 8b5a, size 3, index 0, binding -1, stages 1
named.m22: offset 80, type 8b5a, size 7, index 1, binding -1, stages 1, arrayStride 32, topLevelArrayStride 32
dm22: offset -1, type 8b5a, size 4, index -1, binding -1, stages 1, arrayStride 16, topLevelArrayStride 16
m22: offset 208, type 8b5a, size 3, index 0, binding -1, stages 1, arrayStride 32, topLevelArrayStride 32
nested.foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1, stages 1
nested.foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1, stages 1
nested.foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1, stages 1
nested.foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1, stages 1
deepA[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepA[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[1].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[1].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[1].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[0].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[0].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepB[0].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1
deepC[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1
deepC[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1
deepC[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepC[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepC[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepC[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepC[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepC[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepC[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepC[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepC[1].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1
deepA[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepA[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[1].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[1].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[1].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[0].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[0].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepB[0].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepC[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepC[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepC[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepC[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepC[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepC[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepC[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepC[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepC[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 176
deepC[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepC[1].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1, topLevelArrayStride 176
deepD[0].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1
deepD[0].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1
deepD[0].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[0].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[0].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[0].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[0].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[0].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[0].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[0].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[0].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[0].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[0].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[0].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[0].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1
deepD[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1
deepD[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1
deepD[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1
deepD[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1, arrayStride 8, topLevelArrayStride 8
deepD[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1
deepD[1].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1
abl.foo: offset 0, type 1406, size 1, index 7, binding -1, stages 1
abl2.foo: offset 0, type 1406, size 1, index 11, binding -1, stages 1
buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1, stages 1
buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1, stages 1
buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1, stages 1
buf4.runtimeArray.c: offset 8, type 1406, size 1, index 15, binding -1, stages 1
buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1, stages 1, arrayStride 4, topLevelArrayStride 4
buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1, stages 1, topLevelArrayStride 12
buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1, stages 1, arrayStride 4, topLevelArrayStride 4
buf4.runtimeArray.c: offset 8, type 1406, size 1, index 15, binding -1, stages 1, topLevelArrayStride 12
nested2.a.n1.a: offset 16, type 1406, size 1, index 16, binding -1, stages 1
nested2.a.n2.b: offset 32, type 1406, size 1, index 16, binding -1, stages 1
nested2.a.n2.c: offset 36, type 1406, size 1, index 16, binding -1, stages 1
nested2.a.n2.d: offset 40, type 1406, size 1, index 16, binding -1, stages 1
nested2.b[0].a: offset 48, type 1406, size 1, index 16, binding -1, stages 1
nested2.b[1].a: offset 64, type 1406, size 1, index 16, binding -1, stages 1
nested2.b[2].a: offset 80, type 1406, size 1, index 16, binding -1, stages 1
nested2.b[3].a: offset 96, type 1406, size 1, index 16, binding -1, stages 1
nested2.c.a: offset 112, type 1406, size 1, index 16, binding -1, stages 1
nested2.d.a: offset 144, type 1406, size 1, index 16, binding -1, stages 1
nested2.b[0].a: offset 48, type 1406, size 1, index 16, binding -1, stages 1, topLevelArrayStride 16
nested2.b[1].a: offset 64, type 1406, size 1, index 16, binding -1, stages 1, topLevelArrayStride 16
nested2.b[2].a: offset 80, type 1406, size 1, index 16, binding -1, stages 1, topLevelArrayStride 16
nested2.b[3].a: offset 96, type 1406, size 1, index 16, binding -1, stages 1, topLevelArrayStride 16
nested2.c.a: offset 112, type 1406, size 1, index 16, binding -1, stages 1, topLevelArrayStride 16
nested2.d.a: offset 144, type 1406, size 1, index 16, binding -1, stages 1, topLevelArrayStride 16
t.v.position: offset 0, type 1406, size 1, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t.v[0].position: offset 0, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t.v[1].position: offset 24, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t.v[2].position: offset 48, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t.v[0].normal: offset 12, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t.v[1].normal: offset 36, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t.v[2].normal: offset 60, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[0].position: offset 0, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[0].normal: offset 12, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[1].position: offset 24, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[1].normal: offset 36, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[2].position: offset 48, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[0].v[2].normal: offset 60, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[1].v[0].position: offset 72, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[1].v[0].normal: offset 84, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[1].v[1].position: offset 96, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[1].v[1].normal: offset 108, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[1].v[2].position: offset 120, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[1].v[2].normal: offset 132, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[2].v[0].position: offset 144, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[2].v[0].normal: offset 156, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[2].v[1].position: offset 168, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[2].v[1].normal: offset 180, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[2].v[2].position: offset 192, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[2].v[2].normal: offset 204, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[3].v[0].position: offset 216, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[3].v[0].normal: offset 228, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[3].v[1].position: offset 240, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[3].v[1].normal: offset 252, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[3].v[2].position: offset 264, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[3].v[2].normal: offset 276, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[4].v[0].position: offset 288, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[4].v[0].normal: offset 300, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[4].v[1].position: offset 312, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[4].v[1].normal: offset 324, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[4].v[2].position: offset 336, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
t[4].v[2].normal: offset 348, type 1406, size 3, index 17, binding -1, stages 1, arrayStride 4, topLevelArrayStride 72
anonMember1: offset 0, type 8b51, size 1, index 0, binding -1, stages 1
uf1: offset -1, type 1406, size 1, index -1, binding -1, stages 1
uf2: offset -1, type 1406, size 1, index -1, binding -1, stages 1
named.member3: offset 32, type 8b52, size 1, index 1, binding -1, stages 1
Uniform block reflection:
nameless: offset -1, type ffffffff, size 496, index -1, binding -1, stages 0
named: offset -1, type ffffffff, size 304, index -1, binding -1, stages 0
c_nameless: offset -1, type ffffffff, size 112, index -1, binding -1, stages 0
nested: offset -1, type ffffffff, size 32, index -1, binding -1, stages 0
abl[0]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl[1]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl[2]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl[3]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
buf1: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
buf2: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
buf3: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
buf4: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0
nested2: offset -1, type ffffffff, size 208, index -1, binding -1, stages 0
nameless: offset -1, type ffffffff, size 496, index -1, binding -1, stages 1, numMembers 9
named: offset -1, type ffffffff, size 304, index -1, binding -1, stages 1, numMembers 10
c_nameless: offset -1, type ffffffff, size 112, index -1, binding -1, stages 1, numMembers 5
nested: offset -1, type ffffffff, size 32, index -1, binding -1, stages 1, numMembers 4
abl[0]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl[1]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl[2]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl[3]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 1
buf1: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 2
buf2: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 4
buf3: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 2
buf4: offset -1, type ffffffff, size 4, index -1, binding -1, stages 1, numMembers 4
nested2: offset -1, type ffffffff, size 208, index -1, binding -1, stages 1, numMembers 15
VertexCollection: offset -1, type ffffffff, size 400, index -1, binding -1, stages 1, numMembers 31
Vertex attribute reflection:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1, stages 0
attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1, stages 0
attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1, stages 0
attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1, stages 0
attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1, stages 0
gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1, stages 0
Buffer variable reflection:
Buffer block reflection:
Pipeline input reflection:
attributeFloat: offset 0, type 1406, size 0, index 0, binding -1, stages 1
attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1, stages 1
attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1, stages 1
attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1, stages 1
attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1, stages 1
gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1, stages 1
Pipeline output reflection:

8
Test/reflection.frag Normal file
View File

@ -0,0 +1,8 @@
#version 440 core
in float inval;
void main()
{
float f = inval;
}

View File

@ -0,0 +1,19 @@
#version 440 core
layout(binding = 0, std140) uniform ubo_block {
float unused_uniform;
float shared_uniform;
float vsonly_uniform;
float fsonly_uniform;
} ubo;
in float vertout;
out float fragout;
void main()
{
fragout = vertout;
fragout += ubo.shared_uniform;
fragout += ubo.fsonly_uniform;
}

View File

@ -0,0 +1,19 @@
#version 440 core
layout(binding = 0, std140) uniform ubo_block {
float unused_uniform;
float shared_uniform;
float vsonly_uniform;
float fsonly_uniform;
} ubo;
in float vertin;
out float vertout;
void main()
{
vertout = vertin;
vertout += ubo.shared_uniform;
vertout += ubo.vsonly_uniform;
}

View File

@ -0,0 +1,44 @@
#version 440 core
struct VertexInfo {
float position[3];
float normal[3];
};
struct TriangleInfo {
VertexInfo v[3];
};
buffer VertexCollection {
TriangleInfo t[5];
uint padding[10];
};
buffer MultipleArrays {
TriangleInfo tri[5];
VertexInfo vert[5];
float f[5];
} multiarray;
uniform UBO {
VertexInfo verts[2];
float flt[8];
uvec4 unused;
} ubo;
out float outval;
void main()
{
float f;
f += t[0].v[0].position[0];
f += t[gl_InstanceID].v[gl_InstanceID].position[gl_InstanceID];
f += t[gl_InstanceID].v[gl_InstanceID].normal[gl_InstanceID];
f += multiarray.tri[gl_InstanceID].v[0].position[0];
f += multiarray.vert[gl_InstanceID].position[0];
f += multiarray.f[gl_InstanceID];
f += ubo.verts[gl_InstanceID].position[0];
f += ubo.flt[gl_InstanceID];
TriangleInfo tlocal[5] = t;
outval = f;
}

View File

@ -161,6 +161,22 @@ buffer buf4 {
N2 runtimeArray[];
} buf4i;
struct VertexInfo {
float position[3];
float normal[3];
};
struct TriangleInfo {
VertexInfo v[3];
};
buffer VertexCollection {
TriangleInfo t[5];
uint padding[10];
};
out float outval;
void main()
{
liveFunction1(image_ui2D, sampler_2D, sampler_2DMSArray);
@ -216,4 +232,11 @@ void main()
N1 b[4] = nest2.b;
f += nest2.c[1].a;
f += nest2.d[gl_InstanceID].a;
f += t[0].v[0].position[0];
f += t[gl_InstanceID].v[gl_InstanceID].position[gl_InstanceID];
f += t[gl_InstanceID].v[gl_InstanceID].normal[gl_InstanceID];
TriangleInfo tlocal[5] = t;
outval = f;
}

View File

@ -32,6 +32,16 @@ diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASER
echo Running reflection...
$EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.options.vert > $TARGETDIR/reflection.options.vert.out
diff -b $BASEDIR/reflection.options.vert.out $TARGETDIR/reflection.options.vert.out || HASERROR=1
$EXE -l -q -C reflection.frag > $TARGETDIR/reflection.frag.out
diff -b $BASEDIR/reflection.frag.out $TARGETDIR/reflection.frag.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.frag > $TARGETDIR/reflection.options.frag.out
diff -b $BASEDIR/reflection.options.frag.out $TARGETDIR/reflection.options.frag.out || HASERROR=1
$EXE -l -q -C reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.out
diff -b $BASEDIR/reflection.linked.out $TARGETDIR/reflection.linked.out || HASERROR=1
$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.options.out
diff -b $BASEDIR/reflection.linked.options.out $TARGETDIR/reflection.linked.options.out || HASERROR=1
$EXE -D -Od -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
$EXE -D -Od -e main -l -q -C -V -Od hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out

View File

@ -1966,12 +1966,27 @@ const char* TProgram::getInfoDebugLog()
// Reflection implementation.
//
bool TProgram::buildReflection()
bool TProgram::buildReflection(int opts)
{
if (! linked || reflection)
return false;
reflection = new TReflection;
int firstStage = EShLangVertex, lastStage = EShLangFragment;
if (opts & EShReflectionIntermediateIO) {
// if we're reflecting intermediate I/O, determine the first and last stage linked and use those as the
// boundaries for which stages generate pipeline inputs/outputs
firstStage = EShLangCount;
lastStage = 0;
for (int s = 0; s < EShLangCount; ++s) {
if (intermediate[s]) {
firstStage = std::min(firstStage, s);
lastStage = std::max(lastStage, s);
}
}
}
reflection = new TReflection((EShReflectionOptions)opts, (EShLanguage)firstStage, (EShLanguage)lastStage);
for (int s = 0; s < EShLangCount; ++s) {
if (intermediate[s]) {
@ -1983,27 +1998,23 @@ bool TProgram::buildReflection()
return true;
}
int TProgram::getNumLiveUniformVariables() const { return reflection->getNumUniforms(); }
int TProgram::getNumLiveUniformBlocks() const { return reflection->getNumUniformBlocks(); }
const char* TProgram::getUniformName(int index) const { return reflection->getUniform(index).name.c_str(); }
const char* TProgram::getUniformBlockName(int index) const { return reflection->getUniformBlock(index).name.c_str(); }
int TProgram::getUniformBlockSize(int index) const { return reflection->getUniformBlock(index).size; }
int TProgram::getUniformIndex(const char* name) const { return reflection->getIndex(name); }
int TProgram::getUniformBinding(int index) const { return reflection->getUniform(index).getBinding(); }
EShLanguageMask TProgram::getUniformStages(int index) const { return reflection->getUniform(index).stages; }
int TProgram::getUniformBlockBinding(int index) const { return reflection->getUniformBlock(index).getBinding(); }
int TProgram::getUniformBlockIndex(int index) const { return reflection->getUniform(index).index; }
int TProgram::getUniformBlockCounterIndex(int index) const { return reflection->getUniformBlock(index).counterIndex; }
int TProgram::getUniformType(int index) const { return reflection->getUniform(index).glDefineType; }
int TProgram::getUniformBufferOffset(int index) const { return reflection->getUniform(index).offset; }
int TProgram::getUniformArraySize(int index) const { return reflection->getUniform(index).size; }
int TProgram::getNumLiveAttributes() const { return reflection->getNumAttributes(); }
const char* TProgram::getAttributeName(int index) const { return reflection->getAttribute(index).name.c_str(); }
int TProgram::getAttributeType(int index) const { return reflection->getAttribute(index).glDefineType; }
const TType* TProgram::getAttributeTType(int index) const { return reflection->getAttribute(index).getType(); }
const TType* TProgram::getUniformTType(int index) const { return reflection->getUniform(index).getType(); }
const TType* TProgram::getUniformBlockTType(int index) const { return reflection->getUniformBlock(index).getType(); }
unsigned TProgram::getLocalSize(int dim) const { return reflection->getLocalSize(dim); }
int TProgram::getReflectionIndex(const char* name) const { return reflection->getIndex(name); }
int TProgram::getNumUniformVariables() const { return reflection->getNumUniforms(); }
const TObjectReflection& TProgram::getUniform(int index) const { return reflection->getUniform(index); }
int TProgram::getNumUniformBlocks() const { return reflection->getNumUniformBlocks(); }
const TObjectReflection& TProgram::getUniformBlock(int index) const { return reflection->getUniformBlock(index); }
int TProgram::getNumPipeInputs() const { return reflection->getNumPipeInputs(); }
const TObjectReflection& TProgram::getPipeInput(int index) const { return reflection->getPipeInput(index); }
int TProgram::getNumPipeOutputs() const { return reflection->getNumPipeOutputs(); }
const TObjectReflection& TProgram::getPipeOutput(int index) const { return reflection->getPipeOutput(index); }
int TProgram::getNumBufferVariables() const { return reflection->getNumBufferVariables(); }
const TObjectReflection& TProgram::getBufferVariable(int index) const { return reflection->getBufferVariable(index); }
int TProgram::getNumBufferBlocks() const { return reflection->getNumStorageBuffers(); }
const TObjectReflection& TProgram::getBufferBlock(int index) const { return reflection->getStorageBufferBlock(index); }
int TProgram::getNumAtomicCounters() const { return reflection->getNumAtomicCounters(); }
const TObjectReflection& TProgram::getAtomicCounter(int index) const { return reflection->getAtomicCounter(index); }
void TProgram::dumpReflection() { reflection->dump(); }

View File

@ -93,11 +93,12 @@ public:
// Use a degenerate (empty) set of dereferences to immediately put as at the end of
// the dereference change expected by blowUpActiveAggregate.
TList<TIntermBinary*> derefs;
blowUpActiveAggregate(base.getType(), base.getName(), derefs, derefs.end(), -1, -1, 0);
blowUpActiveAggregate(base.getType(), base.getName(), derefs, derefs.end(), -1, -1, 0, 0,
base.getQualifier().storage, true);
}
}
void addAttribute(const TIntermSymbol& base)
void addPipeInput(const TIntermSymbol& base)
{
if (processedDerefs.find(&base) == processedDerefs.end()) {
processedDerefs.insert(&base);
@ -107,8 +108,36 @@ public:
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str());
if (it == reflection.nameToIndex.end()) {
reflection.nameToIndex[name.c_str()] = (int)reflection.indexToAttribute.size();
reflection.indexToAttribute.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0));
reflection.nameToIndex[name.c_str()] = (int)reflection.indexToPipeInput.size();
reflection.indexToPipeInput.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0));
EShLanguageMask& stages = reflection.indexToPipeInput.back().stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
} else {
EShLanguageMask& stages = reflection.indexToPipeInput[it->second].stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
}
}
}
void addPipeOutput(const TIntermSymbol& base)
{
if (processedDerefs.find(&base) == processedDerefs.end()) {
processedDerefs.insert(&base);
const TString &name = base.getName();
const TType &type = base.getType();
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str());
if (it == reflection.nameToIndex.end()) {
reflection.nameToIndex[name.c_str()] = (int)reflection.indexToPipeOutput.size();
reflection.indexToPipeOutput.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0));
EShLanguageMask& stages = reflection.indexToPipeOutput.back().stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
} else {
EShLanguageMask& stages = reflection.indexToPipeOutput[it->second].stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
}
}
}
@ -213,6 +242,36 @@ public:
return lastOffset + lastMemberSize;
}
// count the total number of leaf members from iterating out of a block type
int countAggregateMembers(const TType& parentType)
{
if (! parentType.isStruct())
return 1;
const bool strictArraySuffix = (reflection.options & EShReflectionStrictArraySuffix);
bool blockParent = (parentType.getBasicType() == EbtBlock && parentType.getQualifier().storage == EvqBuffer);
const TTypeList &memberList = *parentType.getStruct();
int ret = 0;
for (size_t i = 0; i < memberList.size(); i++)
{
const TType &memberType = *memberList[i].type;
int numMembers = countAggregateMembers(memberType);
// for sized arrays of structs, apply logic to expand out the same as we would below in
// blowUpActiveAggregate
if (memberType.isArray() && ! memberType.getArraySizes()->hasUnsized() && memberType.isStruct()) {
if (! strictArraySuffix || ! blockParent)
numMembers *= memberType.getArraySizes()->getCumulativeSize();
}
ret += numMembers;
}
return ret;
}
// Traverse the provided deref chain, including the base, and
// - build a full reflection-granularity name, array size, etc. entry out of it, if it goes down to that granularity
// - recursively expand any variable array index in the middle of that traversal
@ -221,8 +280,19 @@ public:
// arraySize tracks, just for the final dereference in the chain, if there was a specific known size.
// A value of 0 for arraySize will mean to use the full array's size.
void blowUpActiveAggregate(const TType& baseType, const TString& baseName, const TList<TIntermBinary*>& derefs,
TList<TIntermBinary*>::const_iterator deref, int offset, int blockIndex, int arraySize)
TList<TIntermBinary*>::const_iterator deref, int offset, int blockIndex, int arraySize,
int topLevelArrayStride, TStorageQualifier baseStorage, bool active)
{
// when strictArraySuffix is enabled, we closely follow the rules from ARB_program_interface_query.
// Broadly:
// * arrays-of-structs always have a [x] suffix.
// * with array-of-struct variables in the root of a buffer block, only ever return [0].
// * otherwise, array suffixes are added whenever we iterate, even if that means expanding out an array.
const bool strictArraySuffix = (reflection.options & EShReflectionStrictArraySuffix);
// is this variable inside a buffer block. This flag is set back to false after we iterate inside the first array element.
bool blockParent = (baseType.getBasicType() == EbtBlock && baseType.getQualifier().storage == EvqBuffer);
// process the part of the dereference chain that was explicit in the shader
TString name = baseName;
const TType* terminalType = &baseType;
@ -234,15 +304,21 @@ public:
case EOpIndexIndirect: {
int stride = getArrayStride(baseType, visitNode->getLeft()->getType());
if (topLevelArrayStride == 0)
topLevelArrayStride = stride;
// Visit all the indices of this array, and for each one add on the remaining dereferencing
for (int i = 0; i < std::max(visitNode->getLeft()->getType().getOuterArraySize(), 1); ++i) {
TString newBaseName = name;
if (baseType.getBasicType() != EbtBlock)
if (strictArraySuffix && blockParent)
newBaseName.append(TString("[0]"));
else if (strictArraySuffix || baseType.getBasicType() != EbtBlock)
newBaseName.append(TString("[") + String(i) + "]");
TList<TIntermBinary*>::const_iterator nextDeref = deref;
++nextDeref;
TType derefType(*terminalType, 0);
blowUpActiveAggregate(derefType, newBaseName, derefs, nextDeref, offset, blockIndex, arraySize);
blowUpActiveAggregate(derefType, newBaseName, derefs, nextDeref, offset, blockIndex, arraySize,
topLevelArrayStride, baseStorage, active);
if (offset >= 0)
offset += stride;
@ -251,15 +327,25 @@ public:
// it was all completed in the recursive calls above
return;
}
case EOpIndexDirect:
case EOpIndexDirect: {
int stride = getArrayStride(baseType, visitNode->getLeft()->getType());
index = visitNode->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst();
if (baseType.getBasicType() != EbtBlock) {
if (strictArraySuffix && blockParent) {
name.append(TString("[0]"));
} else if (strictArraySuffix || baseType.getBasicType() != EbtBlock) {
name.append(TString("[") + String(index) + "]");
if (offset >= 0)
offset += getArrayStride(baseType, visitNode->getLeft()->getType()) * index;
offset += stride * index;
}
if (topLevelArrayStride == 0)
topLevelArrayStride = stride;
blockParent = false;
break;
}
case EOpIndexDirectStruct:
index = visitNode->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst();
if (offset >= 0)
@ -286,13 +372,24 @@ public:
if (offset >= 0)
stride = getArrayStride(baseType, *terminalType);
for (int i = 0; i < std::max(terminalType->getOuterArraySize(), 1); ++i) {
if (topLevelArrayStride == 0)
topLevelArrayStride = stride;
int arrayIterateSize = std::max(terminalType->getOuterArraySize(), 1);
// for top-level arrays in blocks, only expand [0] to avoid explosion of items
if (strictArraySuffix && blockParent)
arrayIterateSize = 1;
for (int i = 0; i < arrayIterateSize; ++i) {
TString newBaseName = name;
newBaseName.append(TString("[") + String(i) + "]");
TType derefType(*terminalType, 0);
if (offset >= 0)
offset = baseOffset + stride * i;
blowUpActiveAggregate(derefType, newBaseName, derefs, derefs.end(), offset, blockIndex, 0);
blowUpActiveAggregate(derefType, newBaseName, derefs, derefs.end(), offset, blockIndex, 0,
topLevelArrayStride, baseStorage, active);
}
} else {
// Visit all members of this aggregate, and for each one,
@ -308,11 +405,21 @@ public:
for (int i = 0; i < (int)typeList.size(); ++i) {
TString newBaseName = name;
newBaseName.append(TString(".") + typeList[i].type->getFieldName());
if (newBaseName.size() > 0)
newBaseName.append(".");
newBaseName.append(typeList[i].type->getFieldName());
TType derefType(*terminalType, i);
if (offset >= 0)
offset = baseOffset + memberOffsets[i];
blowUpActiveAggregate(derefType, newBaseName, derefs, derefs.end(), offset, blockIndex, 0);
int arrayStride = topLevelArrayStride;
if (terminalType->getBasicType() == EbtBlock && terminalType->getQualifier().storage == EvqBuffer &&
derefType.isArray()) {
arrayStride = getArrayStride(baseType, derefType);
}
blowUpActiveAggregate(derefType, newBaseName, derefs, derefs.end(), offset, blockIndex, 0,
arrayStride, baseStorage, active);
}
}
@ -320,6 +427,10 @@ public:
return;
}
if ((reflection.options & EShReflectionBasicArraySuffix) && terminalType->isArray()) {
name.append(TString("[0]"));
}
// Finally, add a full string to the reflection database, and update the array size if necessary.
// If the dereferenced entity to record is an array, compute the size and update the maximum size.
@ -327,16 +438,40 @@ public:
if (arraySize == 0)
arraySize = mapToGlArraySize(*terminalType);
TReflection::TMapIndexToReflection& variables = reflection.GetVariableMapForStorage(baseStorage);
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str());
if (it == reflection.nameToIndex.end()) {
reflection.nameToIndex[name.c_str()] = (int)reflection.indexToUniform.size();
reflection.indexToUniform.push_back(TObjectReflection(name.c_str(), *terminalType, offset,
mapToGlType(*terminalType),
int uniformIndex = (int)variables.size();
reflection.nameToIndex[name.c_str()] = uniformIndex;
variables.push_back(TObjectReflection(name.c_str(), *terminalType, offset, mapToGlType(*terminalType),
arraySize, blockIndex));
} else if (arraySize > 1) {
int& reflectedArraySize = reflection.indexToUniform[it->second].size;
if (terminalType->isArray()) {
variables.back().arrayStride = getArrayStride(baseType, *terminalType);
if (topLevelArrayStride == 0)
topLevelArrayStride = variables.back().arrayStride;
}
if ((reflection.options & EShReflectionSeparateBuffers) && terminalType->getBasicType() == EbtAtomicUint)
reflection.atomicCounterUniformIndices.push_back(uniformIndex);
variables.back().topLevelArrayStride = topLevelArrayStride;
if ((reflection.options & EShReflectionAllBlockVariables) && active) {
EShLanguageMask& stages = variables.back().stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
}
} else {
if (arraySize > 1) {
int& reflectedArraySize = variables[it->second].size;
reflectedArraySize = std::max(arraySize, reflectedArraySize);
}
if ((reflection.options & EShReflectionAllBlockVariables) && active) {
EShLanguageMask& stages = variables[it->second].stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
}
}
}
// Add a uniform dereference where blocks/struct/arrays are involved in the access.
@ -385,6 +520,10 @@ public:
anonymous = IsAnonymous(base->getName());
const TString& blockName = base->getType().getTypeName();
TString baseName;
if (! anonymous)
baseName = blockName;
if (base->getType().isArray()) {
TType derefType(base->getType(), 0);
@ -393,8 +532,56 @@ public:
for (int e = 0; e < base->getType().getCumulativeArraySize(); ++e)
blockIndex = addBlockName(blockName + "[" + String(e) + "]", derefType,
getBlockSize(base->getType()));
baseName.append(TString("[0]"));
} else
blockIndex = addBlockName(blockName, base->getType(), getBlockSize(base->getType()));
if (reflection.options & EShReflectionAllBlockVariables) {
// Use a degenerate (empty) set of dereferences to immediately put as at the end of
// the dereference change expected by blowUpActiveAggregate.
TList<TIntermBinary*> derefs;
// because we don't have any derefs, the first thing blowUpActiveAggregate will do is iterate over each
// member in the struct definition. This will lose any information about whether the parent was a buffer
// block. So if we're using strict array rules which don't expand the first child of a buffer block we
// instead iterate over the children here.
const bool strictArraySuffix = (reflection.options & EShReflectionStrictArraySuffix);
bool blockParent = (base->getType().getBasicType() == EbtBlock && base->getQualifier().storage == EvqBuffer);
if (strictArraySuffix && blockParent) {
const TTypeList& typeList = *base->getType().getStruct();
TVector<int> memberOffsets;
memberOffsets.resize(typeList.size());
getOffsets(base->getType(), memberOffsets);
for (int i = 0; i < (int)typeList.size(); ++i) {
TType derefType(base->getType(), i);
TString name = baseName;
if (name.size() > 0)
name.append(".");
name.append(typeList[i].type->getFieldName());
// if this member is an array, store the top-level array stride but start the explosion from
// the inner struct type.
if (derefType.isArray() && derefType.isStruct()) {
name.append("[0]");
blowUpActiveAggregate(TType(derefType, 0), name, derefs, derefs.end(), memberOffsets[i],
blockIndex, 0, getArrayStride(base->getType(), derefType),
base->getQualifier().storage, false);
} else {
blowUpActiveAggregate(derefType, name, derefs, derefs.end(), memberOffsets[i], blockIndex,
0, 0, base->getQualifier().storage, false);
}
}
} else {
// otherwise - if we're not using strict array suffix rules, or this isn't a block so we are
// expanding root arrays anyway, just start the iteration from the base block type.
blowUpActiveAggregate(base->getType(), baseName, derefs, derefs.end(), 0, blockIndex, 0, 0,
base->getQualifier().storage, false);
}
}
}
// Process the dereference chain, backward, accumulating the pieces for later forward traversal.
@ -424,20 +611,32 @@ public:
else
baseName = base->getName();
}
blowUpActiveAggregate(base->getType(), baseName, derefs, derefs.begin(), offset, blockIndex, arraySize);
blowUpActiveAggregate(base->getType(), baseName, derefs, derefs.begin(), offset, blockIndex, arraySize, 0,
base->getQualifier().storage, true);
}
int addBlockName(const TString& name, const TType& type, int size)
{
TReflection::TMapIndexToReflection& blocks = reflection.GetBlockMapForStorage(type.getQualifier().storage);
int blockIndex;
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str());
if (reflection.nameToIndex.find(name.c_str()) == reflection.nameToIndex.end()) {
blockIndex = (int)reflection.indexToUniformBlock.size();
blockIndex = (int)blocks.size();
reflection.nameToIndex[name.c_str()] = blockIndex;
reflection.indexToUniformBlock.push_back(TObjectReflection(name.c_str(), type, -1, -1, size, -1));
} else
blocks.push_back(TObjectReflection(name.c_str(), type, -1, -1, size, -1));
blocks.back().numMembers = countAggregateMembers(type);
EShLanguageMask& stages = blocks.back().stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
} else {
blockIndex = it->second;
EShLanguageMask& stages = blocks[blockIndex].stages;
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
}
return blockIndex;
}
@ -828,8 +1027,49 @@ void TReflectionTraverser::visitSymbol(TIntermSymbol* base)
if (base->getQualifier().storage == EvqUniform)
addUniform(*base);
if (intermediate.getStage() == EShLangVertex && base->getQualifier().isPipeInput())
addAttribute(*base);
if (intermediate.getStage() == reflection.firstStage && base->getQualifier().isPipeInput())
addPipeInput(*base);
if (intermediate.getStage() == reflection.lastStage && base->getQualifier().isPipeOutput())
addPipeOutput(*base);
}
//
// Implement TObjectReflection methods.
//
TObjectReflection::TObjectReflection(const std::string &pName, const TType &pType, int pOffset, int pGLDefineType,
int pSize, int pIndex)
: name(pName), offset(pOffset), glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1),
numMembers(-1), arrayStride(0), topLevelArrayStride(0), stages(EShLanguageMask(0)), type(pType.clone())
{
}
int TObjectReflection::getBinding() const
{
if (type == nullptr || !type->getQualifier().hasBinding())
return -1;
return type->getQualifier().layoutBinding;
}
void TObjectReflection::dump() const
{
printf("%s: offset %d, type %x, size %d, index %d, binding %d, stages %d", name.c_str(), offset, glDefineType, size,
index, getBinding(), stages);
if (counterIndex != -1)
printf(", counter %d", counterIndex);
if (numMembers != -1)
printf(", numMembers %d", numMembers);
if (arrayStride != 0)
printf(", arrayStride %d", arrayStride);
if (topLevelArrayStride != 0)
printf(", topLevelArrayStride %d", topLevelArrayStride);
printf("\n");
}
//
@ -863,9 +1103,17 @@ void TReflection::buildCounterIndices(const TIntermediate& intermediate)
// build Shader Stages mask for all uniforms
void TReflection::buildUniformStageMask(const TIntermediate& intermediate)
{
if (options & EShReflectionAllBlockVariables)
return;
for (int i = 0; i < int(indexToUniform.size()); ++i) {
indexToUniform[i].stages = static_cast<EShLanguageMask>(indexToUniform[i].stages | 1 << intermediate.getStage());
}
for (int i = 0; i < int(indexToBufferVariable.size()); ++i) {
indexToBufferVariable[i].stages =
static_cast<EShLanguageMask>(indexToBufferVariable[i].stages | 1 << intermediate.getStage());
}
}
// Merge live symbols from 'intermediate' into the existing reflection database.
@ -910,9 +1158,24 @@ void TReflection::dump()
indexToUniformBlock[i].dump();
printf("\n");
printf("Vertex attribute reflection:\n");
for (size_t i = 0; i < indexToAttribute.size(); ++i)
indexToAttribute[i].dump();
printf("Buffer variable reflection:\n");
for (size_t i = 0; i < indexToBufferVariable.size(); ++i)
indexToBufferVariable[i].dump();
printf("\n");
printf("Buffer block reflection:\n");
for (size_t i = 0; i < indexToBufferBlock.size(); ++i)
indexToBufferBlock[i].dump();
printf("\n");
printf("Pipeline input reflection:\n");
for (size_t i = 0; i < indexToPipeInput.size(); ++i)
indexToPipeInput[i].dump();
printf("\n");
printf("Pipeline output reflection:\n");
for (size_t i = 0; i < indexToPipeOutput.size(); ++i)
indexToPipeOutput[i].dump();
printf("\n");
if (getLocalSize(0) > 1) {

View File

@ -52,51 +52,11 @@ class TIntermediate;
class TIntermAggregate;
class TReflectionTraverser;
// Data needed for just a single object at the granularity exchanged by the reflection API
class TObjectReflection {
public:
TObjectReflection(const std::string& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex) :
name(pName), offset(pOffset),
glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), stages(EShLanguageMask(0)), type(pType.clone()) { }
const TType* getType() const { return type; }
int getBinding() const
{
if (type == nullptr || !type->getQualifier().hasBinding())
return -1;
return type->getQualifier().layoutBinding;
}
void dump() const
{
printf("%s: offset %d, type %x, size %d, index %d, binding %d, stages %d",
name.c_str(), offset, glDefineType, size, index, getBinding(), stages );
if (counterIndex != -1)
printf(", counter %d", counterIndex);
printf("\n");
}
static TObjectReflection badReflection() { return TObjectReflection(); }
std::string name;
int offset;
int glDefineType;
int size; // data size in bytes for a block, array size for a (non-block) object that's an array
int index;
int counterIndex;
EShLanguageMask stages;
protected:
TObjectReflection() :
offset(-1), glDefineType(-1), size(-1), index(-1), counterIndex(-1), stages(EShLanguageMask(0)), type(nullptr) { }
const TType* type;
};
// The full reflection database
class TReflection {
public:
TReflection() : badReflection(TObjectReflection::badReflection())
TReflection(EShReflectionOptions opts, EShLanguage first, EShLanguage last)
: options(opts), firstStage(first), lastStage(last), badReflection(TObjectReflection::badReflection())
{
for (int dim=0; dim<3; ++dim)
localSize[dim] = 0;
@ -127,17 +87,57 @@ public:
return badReflection;
}
// for mapping an attribute index to the attribute's description
int getNumAttributes() { return (int)indexToAttribute.size(); }
const TObjectReflection& getAttribute(int i) const
// for mapping an pipeline input index to the input's description
int getNumPipeInputs() { return (int)indexToPipeInput.size(); }
const TObjectReflection& getPipeInput(int i) const
{
if (i >= 0 && i < (int)indexToAttribute.size())
return indexToAttribute[i];
if (i >= 0 && i < (int)indexToPipeInput.size())
return indexToPipeInput[i];
else
return badReflection;
}
// for mapping any name to its index (block names, uniform names and attribute names)
// for mapping an pipeline output index to the output's description
int getNumPipeOutputs() { return (int)indexToPipeOutput.size(); }
const TObjectReflection& getPipeOutput(int i) const
{
if (i >= 0 && i < (int)indexToPipeOutput.size())
return indexToPipeOutput[i];
else
return badReflection;
}
// for mapping from an atomic counter to the uniform index
int getNumAtomicCounters() const { return (int)atomicCounterUniformIndices.size(); }
const TObjectReflection& getAtomicCounter(int i) const
{
if (i >= 0 && i < (int)atomicCounterUniformIndices.size())
return getUniform(atomicCounterUniformIndices[i]);
else
return badReflection;
}
// for mapping a buffer variable index to a buffer variable object's description
int getNumBufferVariables() { return (int)indexToBufferVariable.size(); }
const TObjectReflection& getBufferVariable(int i) const
{
if (i >= 0 && i < (int)indexToBufferVariable.size())
return indexToBufferVariable[i];
else
return badReflection;
}
// for mapping a storage block index to the storage block's description
int getNumStorageBuffers() const { return (int)indexToBufferBlock.size(); }
const TObjectReflection& getStorageBufferBlock(int i) const
{
if (i >= 0 && i < (int)indexToBufferBlock.size())
return indexToBufferBlock[i];
else
return badReflection;
}
// for mapping any name to its index (block names, uniform names and input/output names)
int getIndex(const char* name) const
{
TNameToIndex::const_iterator it = nameToIndex.find(name);
@ -165,12 +165,35 @@ protected:
// Need a TString hash: typedef std::unordered_map<TString, int> TNameToIndex;
typedef std::map<std::string, int> TNameToIndex;
typedef std::vector<TObjectReflection> TMapIndexToReflection;
typedef std::vector<int> TIndices;
TMapIndexToReflection& GetBlockMapForStorage(TStorageQualifier storage)
{
if ((options & EShReflectionSeparateBuffers) && storage == EvqBuffer)
return indexToBufferBlock;
return indexToUniformBlock;
}
TMapIndexToReflection& GetVariableMapForStorage(TStorageQualifier storage)
{
if ((options & EShReflectionSeparateBuffers) && storage == EvqBuffer)
return indexToBufferVariable;
return indexToUniform;
}
EShReflectionOptions options;
EShLanguage firstStage;
EShLanguage lastStage;
TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this
TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed
TMapIndexToReflection indexToUniform;
TMapIndexToReflection indexToUniformBlock;
TMapIndexToReflection indexToAttribute;
TMapIndexToReflection indexToBufferVariable;
TMapIndexToReflection indexToBufferBlock;
TMapIndexToReflection indexToPipeInput;
TMapIndexToReflection indexToPipeOutput;
TIndices atomicCounterUniformIndices;
unsigned int localSize[3];
};

View File

@ -236,6 +236,18 @@ enum EShMessages {
EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (right now only for samplers)
};
//
// Options for building reflection
//
typedef enum {
EShReflectionDefault = 0, // default is original behaviour before options were added
EShReflectionStrictArraySuffix = (1 << 0), // reflection will follow stricter rules for array-of-structs suffixes
EShReflectionBasicArraySuffix = (1 << 1), // arrays of basic types will be appended with [0] as in GL reflection
EShReflectionIntermediateIO = (1 << 2), // reflect inputs and outputs to program, even with no vertex shader
EShReflectionSeparateBuffers = (1 << 3), // buffer variables and buffer blocks are reflected separately
EShReflectionAllBlockVariables = (1 << 4), // reflect all variables in blocks, even if they are inactive
} EShReflectionOptions;
//
// Build a table for bindings. This can be used for locating
// attributes, uniforms, globals, etc., as needed.
@ -596,6 +608,41 @@ private:
TShader& operator=(TShader&);
};
//
// A reflection database and its interface, consistent with the OpenGL API reflection queries.
//
// Data needed for just a single object at the granularity exchanged by the reflection API
class TObjectReflection {
public:
TObjectReflection(const std::string& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex);
const TType* getType() const { return type; }
int getBinding() const;
void dump() const;
static TObjectReflection badReflection() { return TObjectReflection(); }
std::string name;
int offset;
int glDefineType;
int size; // data size in bytes for a block, array size for a (non-block) object that's an array
int index;
int counterIndex;
int numMembers;
int arrayStride; // stride of an array variable
int topLevelArrayStride; // stride of the top-level variable in a storage buffer member
EShLanguageMask stages;
protected:
TObjectReflection()
: offset(-1), glDefineType(-1), size(-1), index(-1), counterIndex(-1), numMembers(-1), arrayStride(0),
topLevelArrayStride(0), stages(EShLanguageMask(0)), type(nullptr)
{
}
const TType* type;
};
class TReflection;
class TIoMapper;
@ -685,28 +732,89 @@ public:
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
// Reflection Interface
bool buildReflection(); // call first, to do liveness analysis, index mapping, etc.; returns false on failure
int getNumLiveUniformVariables() const; // can be used for glGetProgramiv(GL_ACTIVE_UNIFORMS)
int getNumLiveUniformBlocks() const; // can be used for glGetProgramiv(GL_ACTIVE_UNIFORM_BLOCKS)
const char* getUniformName(int index) const; // can be used for "name" part of glGetActiveUniform()
const char* getUniformBlockName(int blockIndex) const; // can be used for glGetActiveUniformBlockName()
int getUniformBlockSize(int blockIndex) const; // can be used for glGetActiveUniformBlockiv(UNIFORM_BLOCK_DATA_SIZE)
int getUniformIndex(const char* name) const; // can be used for glGetUniformIndices()
int getUniformBinding(int index) const; // returns the binding number
EShLanguageMask getUniformStages(int index) const; // returns Shaders Stages where a Uniform is present
int getUniformBlockBinding(int index) const; // returns the block binding number
int getUniformBlockIndex(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX)
int getUniformBlockCounterIndex(int index) const; // returns block index of associated counter.
int getUniformType(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE)
int getUniformBufferOffset(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_OFFSET)
int getUniformArraySize(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_SIZE)
int getNumLiveAttributes() const; // can be used for glGetProgramiv(GL_ACTIVE_ATTRIBUTES)
// call first, to do liveness analysis, index mapping, etc.; returns false on failure
bool buildReflection(int opts = EShReflectionDefault);
unsigned getLocalSize(int dim) const; // return dim'th local size
const char *getAttributeName(int index) const; // can be used for glGetActiveAttrib()
int getAttributeType(int index) const; // can be used for glGetActiveAttrib()
const TType* getUniformTType(int index) const; // returns a TType*
const TType* getUniformBlockTType(int index) const; // returns a TType*
const TType* getAttributeTType(int index) const; // returns a TType*
int getReflectionIndex(const char *name) const;
int getNumUniformVariables() const;
const TObjectReflection& getUniform(int index) const;
int getNumUniformBlocks() const;
const TObjectReflection& getUniformBlock(int index) const;
int getNumPipeInputs() const;
const TObjectReflection& getPipeInput(int index) const;
int getNumPipeOutputs() const;
const TObjectReflection& getPipeOutput(int index) const;
int getNumBufferVariables() const;
const TObjectReflection& getBufferVariable(int index) const;
int getNumBufferBlocks() const;
const TObjectReflection& getBufferBlock(int index) const;
int getNumAtomicCounters() const;
const TObjectReflection& getAtomicCounter(int index) const;
// Legacy Reflection Interface - expressed in terms of above interface
// can be used for glGetProgramiv(GL_ACTIVE_UNIFORMS)
int getNumLiveUniformVariables() const { return getNumUniformVariables(); }
// can be used for glGetProgramiv(GL_ACTIVE_UNIFORM_BLOCKS)
int getNumLiveUniformBlocks() const { return getNumUniformBlocks(); }
// can be used for glGetProgramiv(GL_ACTIVE_ATTRIBUTES)
int getNumLiveAttributes() const { return getNumPipeInputs(); }
// can be used for glGetUniformIndices()
int getUniformIndex(const char *name) const { return getReflectionIndex(name); }
// can be used for "name" part of glGetActiveUniform()
const char *getUniformName(int index) const { return getUniform(index).name.c_str(); }
// returns the binding number
int getUniformBinding(int index) const { return getUniform(index).getBinding(); }
// returns Shaders Stages where a Uniform is present
EShLanguageMask getUniformStages(int index) const { return getUniform(index).stages; }
// can be used for glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX)
int getUniformBlockIndex(int index) const { return getUniform(index).index; }
// can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE)
int getUniformType(int index) const { return getUniform(index).glDefineType; }
// can be used for glGetActiveUniformsiv(GL_UNIFORM_OFFSET)
int getUniformBufferOffset(int index) const { return getUniform(index).offset; }
// can be used for glGetActiveUniformsiv(GL_UNIFORM_SIZE)
int getUniformArraySize(int index) const { return getUniform(index).size; }
// returns a TType*
const TType *getUniformTType(int index) const { return getUniform(index).getType(); }
// can be used for glGetActiveUniformBlockName()
const char *getUniformBlockName(int index) const { return getUniformBlock(index).name.c_str(); }
// can be used for glGetActiveUniformBlockiv(UNIFORM_BLOCK_DATA_SIZE)
int getUniformBlockSize(int index) const { return getUniformBlock(index).size; }
// returns the block binding number
int getUniformBlockBinding(int index) const { return getUniformBlock(index).getBinding(); }
// returns block index of associated counter.
int getUniformBlockCounterIndex(int index) const { return getUniformBlock(index).counterIndex; }
// returns a TType*
const TType *getUniformBlockTType(int index) const { return getUniformBlock(index).getType(); }
// can be used for glGetActiveAttrib()
const char *getAttributeName(int index) const { return getPipeInput(index).name.c_str(); }
// can be used for glGetActiveAttrib()
int getAttributeType(int index) const { return getPipeInput(index).glDefineType; }
// returns a TType*
const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); }
void dumpReflection();