mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-30 22:51:06 +00:00
08a14422c1
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).
60 lines
1.1 KiB
JavaScript
60 lines
1.1 KiB
JavaScript
// 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;
|
|
}
|