Add UAV (image) binding offset and HLSL register support
This PR adds: 1. The "u" register class for RW* objects. 2. --shift-image-bindings (== --sib), analogous to --shift-texture-bindings etc. 3. Case insensitive reg classes. 4. Tests for above.
This commit is contained in:
@@ -159,6 +159,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
{"hlsl.promotions.frag", "main"},
|
||||
{"hlsl.rw.atomics.frag", "main"},
|
||||
{"hlsl.rw.bracket.frag", "main"},
|
||||
{"hlsl.rw.register.frag", "main"},
|
||||
{"hlsl.rw.scalar.bracket.frag", "main"},
|
||||
{"hlsl.rw.vec2.bracket.frag", "main"},
|
||||
{"hlsl.sample.array.dx10.frag", "main"},
|
||||
|
||||
@@ -46,6 +46,7 @@ struct IoMapData {
|
||||
const char* entryPoint;
|
||||
int baseSamplerBinding;
|
||||
int baseTextureBinding;
|
||||
int baseImageBinding;
|
||||
int baseUboBinding;
|
||||
bool autoMapBindings;
|
||||
bool flattenUniforms;
|
||||
@@ -123,6 +124,7 @@ TEST_P(HlslIoMap, FromFile)
|
||||
Target::Spv, GetParam().entryPoint,
|
||||
GetParam().baseSamplerBinding,
|
||||
GetParam().baseTextureBinding,
|
||||
GetParam().baseImageBinding,
|
||||
GetParam().baseUboBinding,
|
||||
GetParam().autoMapBindings,
|
||||
GetParam().flattenUniforms);
|
||||
@@ -136,6 +138,7 @@ TEST_P(GlslIoMap, FromFile)
|
||||
Target::Spv, GetParam().entryPoint,
|
||||
GetParam().baseSamplerBinding,
|
||||
GetParam().baseTextureBinding,
|
||||
GetParam().baseImageBinding,
|
||||
GetParam().baseUboBinding,
|
||||
GetParam().autoMapBindings,
|
||||
GetParam().flattenUniforms);
|
||||
@@ -283,10 +286,11 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Hlsl, HlslIoMap,
|
||||
::testing::ValuesIn(std::vector<IoMapData>{
|
||||
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 20, true, false },
|
||||
{ "spv.register.noautoassign.frag", "main_ep", 5, 10, 15, false, false },
|
||||
{ "spv.register.autoassign-2.frag", "main", 5, 10, 15, true, true },
|
||||
{ "spv.buffer.autoassign.frag", "main", 5, 10, 15, true, true },
|
||||
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, true, false },
|
||||
{ "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, false, false },
|
||||
{ "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, true, true },
|
||||
{ "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, true, true },
|
||||
{ "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, true, true },
|
||||
{ "spv.register.autoassign.rangetest.frag", "main",
|
||||
glslang::TQualifier::layoutBindingEnd-2,
|
||||
glslang::TQualifier::layoutBindingEnd+5,
|
||||
@@ -299,8 +303,8 @@ INSTANTIATE_TEST_CASE_P(
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
Hlsl, GlslIoMap,
|
||||
::testing::ValuesIn(std::vector<IoMapData>{
|
||||
{ "spv.glsl.register.autoassign.frag", "main", 5, 10, 20, true, false },
|
||||
{ "spv.glsl.register.noautoassign.frag", "main", 5, 10, 15, false, false },
|
||||
{ "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, true, false },
|
||||
{ "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, false, false },
|
||||
}),
|
||||
FileNameAsCustomTestSuffixIoMap
|
||||
);
|
||||
|
||||
@@ -239,6 +239,7 @@ public:
|
||||
const std::string& entryPointName, EShMessages controls,
|
||||
int baseSamplerBinding,
|
||||
int baseTextureBinding,
|
||||
int baseImageBinding,
|
||||
int baseUboBinding,
|
||||
bool autoMapBindings,
|
||||
bool flattenUniformArrays)
|
||||
@@ -248,6 +249,7 @@ public:
|
||||
glslang::TShader shader(kind);
|
||||
shader.setShiftSamplerBinding(baseSamplerBinding);
|
||||
shader.setShiftTextureBinding(baseTextureBinding);
|
||||
shader.setShiftImageBinding(baseImageBinding);
|
||||
shader.setShiftUboBinding(baseUboBinding);
|
||||
shader.setAutoMapBindings(autoMapBindings);
|
||||
shader.setFlattenUniformArrays(flattenUniformArrays);
|
||||
@@ -426,6 +428,7 @@ public:
|
||||
const std::string& entryPointName,
|
||||
int baseSamplerBinding,
|
||||
int baseTextureBinding,
|
||||
int baseImageBinding,
|
||||
int baseUboBinding,
|
||||
bool autoMapBindings,
|
||||
bool flattenUniformArrays)
|
||||
@@ -440,7 +443,7 @@ public:
|
||||
|
||||
const EShMessages controls = DeriveOptions(source, semantics, target);
|
||||
GlslangResult result = compileLinkIoMap(testName, input, entryPointName, controls,
|
||||
baseSamplerBinding, baseTextureBinding, baseUboBinding,
|
||||
baseSamplerBinding, baseTextureBinding, baseImageBinding, baseUboBinding,
|
||||
autoMapBindings,
|
||||
flattenUniformArrays);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user