Add per-descriptor-set IO mapping shift values.
This PR adds the ability to provide per-descriptor-set IO mapping shift
values. If a particular binding does not land into a per-set value,
then it falls back to the prior behavior (global shifts per resource class).
Because there were already 6 copies of many different methods and internal
variables and functions, and this PR would have added 6 more, a new API is
introduced to cut down on replication and present a cleaner interface.
For the global (non-set-specific) API, the old entry points still exist
for backward compatibility, but are phrased internally in terms of the
following.
// Resource type for IO resolver
enum TResourceType {
EResSampler,
EResTexture,
EResImage,
EResUbo,
EResSsbo,
EResUav,
EResCount
};
Methods on TShader:
void setShiftBinding(TResourceType res, unsigned int base);
void setShiftBindingForSet(TResourceType res, unsigned int set, unsigned int base);
The first method replaces the 6 prior entry points of various spellings, which
exist now in depreciated form. The second provides per-resource-set functionality.
Both accept an enum from the list above.
From the command line, the existing options can accept either a single shift value as
before, or a series of 1 or more [set offset] pairs. Both can be provided, as in:
... --stb 20 --stb 2 25 3 30 ...
which will use the offset 20 for anything except descriptor set 2 (which uses 25) and
3 (which uses 30).
This commit is contained in:
225
Test/baseResults/hlsl.shift.per-set.frag.out
Normal file
225
Test/baseResults/hlsl.shift.per-set.frag.out
Normal file
@@ -0,0 +1,225 @@
|
||||
hlsl.shift.per-set.frag
|
||||
Shader version: 500
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:34 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:34 Function Parameters:
|
||||
0:? Sequence
|
||||
0:35 't1' (layout( set=1 binding=1) uniform texture1D)
|
||||
0:36 't2' (layout( set=1 binding=2) uniform texture2D)
|
||||
0:37 't3' (layout( set=2 binding=1) uniform texture3D)
|
||||
0:38 direct index (layout( row_major std430) buffer 4-component vector of float)
|
||||
0:38 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
|
||||
0:38 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
|
||||
0:38 Constant:
|
||||
0:38 0 (const uint)
|
||||
0:38 Constant:
|
||||
0:38 0 (const int)
|
||||
0:39 indirect index (layout( row_major std430) buffer uint)
|
||||
0:39 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
|
||||
0:39 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:39 Constant:
|
||||
0:39 0 (const uint)
|
||||
0:39 right-shift ( temp int)
|
||||
0:39 Constant:
|
||||
0:39 0 (const int)
|
||||
0:39 Constant:
|
||||
0:39 2 (const int)
|
||||
0:40 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
|
||||
0:42 's1' (layout( set=1 binding=1) uniform sampler)
|
||||
0:43 's2' (layout( set=2 binding=2) uniform sampler)
|
||||
0:45 'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
|
||||
0:46 'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
|
||||
0:47 'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
|
||||
0:49 imageLoad ( temp float)
|
||||
0:49 'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
|
||||
0:49 Constant:
|
||||
0:49 0 (const int)
|
||||
0:50 indirect index (layout( row_major std430) buffer uint)
|
||||
0:50 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
|
||||
0:50 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:50 Constant:
|
||||
0:50 0 (const uint)
|
||||
0:50 right-shift ( temp int)
|
||||
0:50 Constant:
|
||||
0:50 0 (const int)
|
||||
0:50 Constant:
|
||||
0:50 2 (const int)
|
||||
0:51 direct index (layout( row_major std430) buffer float)
|
||||
0:51 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float)
|
||||
0:51 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:51 Constant:
|
||||
0:51 0 (const uint)
|
||||
0:51 Constant:
|
||||
0:51 0 (const int)
|
||||
0:52 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:53 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:55 cb1: direct index for structure (layout( row_major std140) uniform int)
|
||||
0:55 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
|
||||
0:55 Constant:
|
||||
0:55 0 (const uint)
|
||||
0:56 tb1: direct index for structure (layout( row_major std430) buffer int)
|
||||
0:56 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
|
||||
0:56 Constant:
|
||||
0:56 0 (const uint)
|
||||
0:58 Branch: Return with expression
|
||||
0:58 Constant:
|
||||
0:58 0.000000
|
||||
0:58 0.000000
|
||||
0:58 0.000000
|
||||
0:58 0.000000
|
||||
0:34 Function Definition: main( ( temp void)
|
||||
0:34 Function Parameters:
|
||||
0:? Sequence
|
||||
0:34 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:34 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 's1' (layout( set=1 binding=1) uniform sampler)
|
||||
0:? 's2' (layout( set=2 binding=2) uniform sampler)
|
||||
0:? 't1' (layout( set=1 binding=1) uniform texture1D)
|
||||
0:? 't2' (layout( set=1 binding=2) uniform texture2D)
|
||||
0:? 't3' (layout( set=2 binding=1) uniform texture3D)
|
||||
0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
|
||||
0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:? 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
|
||||
0:? 'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
|
||||
0:? 'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
|
||||
0:? 'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
|
||||
0:? 'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
|
||||
0:? 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:? 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:? 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:? 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:? 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
|
||||
0:? 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 500
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:34 Function Definition: @main( ( temp 4-component vector of float)
|
||||
0:34 Function Parameters:
|
||||
0:? Sequence
|
||||
0:35 't1' (layout( set=1 binding=1) uniform texture1D)
|
||||
0:36 't2' (layout( set=1 binding=2) uniform texture2D)
|
||||
0:37 't3' (layout( set=2 binding=1) uniform texture3D)
|
||||
0:38 direct index (layout( row_major std430) buffer 4-component vector of float)
|
||||
0:38 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float)
|
||||
0:38 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
|
||||
0:38 Constant:
|
||||
0:38 0 (const uint)
|
||||
0:38 Constant:
|
||||
0:38 0 (const int)
|
||||
0:39 indirect index (layout( row_major std430) buffer uint)
|
||||
0:39 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
|
||||
0:39 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:39 Constant:
|
||||
0:39 0 (const uint)
|
||||
0:39 right-shift ( temp int)
|
||||
0:39 Constant:
|
||||
0:39 0 (const int)
|
||||
0:39 Constant:
|
||||
0:39 2 (const int)
|
||||
0:40 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
|
||||
0:42 's1' (layout( set=1 binding=1) uniform sampler)
|
||||
0:43 's2' (layout( set=2 binding=2) uniform sampler)
|
||||
0:45 'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
|
||||
0:46 'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
|
||||
0:47 'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
|
||||
0:49 imageLoad ( temp float)
|
||||
0:49 'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
|
||||
0:49 Constant:
|
||||
0:49 0 (const int)
|
||||
0:50 indirect index (layout( row_major std430) buffer uint)
|
||||
0:50 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint)
|
||||
0:50 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:50 Constant:
|
||||
0:50 0 (const uint)
|
||||
0:50 right-shift ( temp int)
|
||||
0:50 Constant:
|
||||
0:50 0 (const int)
|
||||
0:50 Constant:
|
||||
0:50 2 (const int)
|
||||
0:51 direct index (layout( row_major std430) buffer float)
|
||||
0:51 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float)
|
||||
0:51 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:51 Constant:
|
||||
0:51 0 (const uint)
|
||||
0:51 Constant:
|
||||
0:51 0 (const int)
|
||||
0:52 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:53 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:55 cb1: direct index for structure (layout( row_major std140) uniform int)
|
||||
0:55 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
|
||||
0:55 Constant:
|
||||
0:55 0 (const uint)
|
||||
0:56 tb1: direct index for structure (layout( row_major std430) buffer int)
|
||||
0:56 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
|
||||
0:56 Constant:
|
||||
0:56 0 (const uint)
|
||||
0:58 Branch: Return with expression
|
||||
0:58 Constant:
|
||||
0:58 0.000000
|
||||
0:58 0.000000
|
||||
0:58 0.000000
|
||||
0:58 0.000000
|
||||
0:34 Function Definition: main( ( temp void)
|
||||
0:34 Function Parameters:
|
||||
0:? Sequence
|
||||
0:34 move second child to first child ( temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
0:34 Function Call: @main( ( temp 4-component vector of float)
|
||||
0:? Linker Objects
|
||||
0:? 's1' (layout( set=1 binding=1) uniform sampler)
|
||||
0:? 's2' (layout( set=2 binding=2) uniform sampler)
|
||||
0:? 't1' (layout( set=1 binding=1) uniform texture1D)
|
||||
0:? 't2' (layout( set=1 binding=2) uniform texture2D)
|
||||
0:? 't3' (layout( set=2 binding=1) uniform texture3D)
|
||||
0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
|
||||
0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:? 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer)
|
||||
0:? 'u1' (layout( set=1 binding=1 rgba32f) uniform image1D)
|
||||
0:? 'u2' (layout( set=2 binding=2 rgba32f) uniform image2D)
|
||||
0:? 'u3' (layout( set=2 binding=3 rgba32f) uniform image3D)
|
||||
0:? 'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer)
|
||||
0:? 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
|
||||
0:? 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:? 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:? 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
|
||||
0:? 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1})
|
||||
0:? 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1})
|
||||
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
|
||||
|
||||
Uniform reflection:
|
||||
t1: offset -1, type 8b5d, size 1, index -1, binding 21
|
||||
t2: offset -1, type 8b5e, size 1, index -1, binding 22
|
||||
t3: offset -1, type 8b5f, size 1, index -1, binding 26
|
||||
t4.@data: offset 0, type 8b52, size 1, index 0, binding -1
|
||||
t5.@data: offset 0, type 1405, size 0, index 1, binding -1
|
||||
t6: offset -1, type 8dc2, size 1, index -1, binding 23
|
||||
s1: offset -1, type 0, size 1, index -1, binding 11
|
||||
s2: offset -1, type 0, size 1, index -1, binding 17
|
||||
u1: offset -1, type 904c, size 1, index -1, binding 31
|
||||
u2: offset -1, type 904d, size 1, index -1, binding 42
|
||||
u3: offset -1, type 904e, size 1, index -1, binding 43
|
||||
u4: offset -1, type 9051, size 1, index -1, binding 34
|
||||
u5.@data: offset 0, type 1405, size 0, index 2, binding -1
|
||||
u6.@data: offset 0, type 1406, size 1, index 3, binding -1
|
||||
cb1: offset 0, type 1404, size 1, index 4, binding -1
|
||||
tb1: offset 0, type 1404, size 1, index 5, binding -1
|
||||
|
||||
Uniform block reflection:
|
||||
t4: offset -1, type ffffffff, size 0, index -1, binding 21
|
||||
t5: offset -1, type ffffffff, size 0, index -1, binding 22
|
||||
u5: offset -1, type ffffffff, size 0, index -1, binding 44
|
||||
u6: offset -1, type ffffffff, size 0, index -1, binding 34
|
||||
cb: offset -1, type ffffffff, size 4, index -1, binding 51
|
||||
tb: offset -1, type ffffffff, size 4, index -1, binding 27
|
||||
|
||||
Vertex attribute reflection:
|
||||
|
||||
59
Test/hlsl.shift.per-set.frag
Normal file
59
Test/hlsl.shift.per-set.frag
Normal file
@@ -0,0 +1,59 @@
|
||||
// Test register class offsets for different resource types
|
||||
|
||||
SamplerState s1 : register(s1, space1);
|
||||
SamplerComparisonState s2 : register(s2, space2);
|
||||
|
||||
Texture1D <float4> t1 : register(t1, space1);
|
||||
Texture2D <float4> t2 : register(t2, space1);
|
||||
Texture3D <float4> t3 : register(t1, space2);
|
||||
|
||||
StructuredBuffer<float4> t4 : register(t1, space3);
|
||||
|
||||
ByteAddressBuffer t5 : register(t2, space3);
|
||||
Buffer<float4> t6 : register(t3, space3);
|
||||
|
||||
RWTexture1D <float4> u1 : register(u1, space1);
|
||||
RWTexture2D <float4> u2 : register(u2, space2);
|
||||
RWTexture3D <float4> u3 : register(u3, space2);
|
||||
|
||||
RWBuffer <float> u4 : register(u4, space1);
|
||||
RWByteAddressBuffer u5 : register(u4, space2);
|
||||
RWStructuredBuffer<float> u6 : register(u4, space3);
|
||||
AppendStructuredBuffer<float> u7 : register(u4, space4);
|
||||
ConsumeStructuredBuffer<float> u8 : register(u4, space5);
|
||||
|
||||
cbuffer cb : register(b1, space6) {
|
||||
int cb1;
|
||||
};
|
||||
|
||||
tbuffer tb : register(t7) {
|
||||
int tb1;
|
||||
};
|
||||
|
||||
float4 main() : SV_Target0
|
||||
{
|
||||
t1;
|
||||
t2;
|
||||
t3;
|
||||
t4[0];
|
||||
t5.Load(0);
|
||||
t6;
|
||||
|
||||
s1;
|
||||
s2;
|
||||
|
||||
u1;
|
||||
u2;
|
||||
u3;
|
||||
|
||||
u4[0];
|
||||
u5.Load(0);
|
||||
u6[0];
|
||||
u7;
|
||||
u8;
|
||||
|
||||
cb1;
|
||||
tb1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -104,6 +104,13 @@ diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDes
|
||||
$EXE -V -D -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out
|
||||
diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
|
||||
|
||||
#
|
||||
# Testing per-descriptor-set IO map shift
|
||||
#
|
||||
echo 'Testing per-descriptor-set IO map shift'
|
||||
$EXE -e main --hlsl-iomap --ssb 1 10 2 15 --stb 20 --stb 2 25 --suavb 30 --suavb 2 40 --sub 6 50 -i -q -D -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1
|
||||
diff -b $BASEDIR/hlsl.shift.per-set.frag.out $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1
|
||||
|
||||
#
|
||||
# Testing location error
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user