Fix defects in uniform array flattening
Fix for two defects as follows: - The IO mapping traverser was not setting inVisit, and would skip some AST nodes. Depending on the order of nodes, this could have prevented the binding from showing up in the generated SPIR-V. - If a uniform array was flattened, each of the flattened scalars from the array is still a (now-scalar) uniform. It was being converted to a temporary.
This commit is contained in:
parent
02df206c9e
commit
cf43e66125
8 changed files with 109 additions and 19 deletions
|
|
@ -48,6 +48,7 @@ struct IoMapData {
|
|||
int baseTextureBinding;
|
||||
int baseUboBinding;
|
||||
bool autoMapBindings;
|
||||
bool flattenUniforms;
|
||||
};
|
||||
|
||||
std::string FileNameAsCustomTestSuffixIoMap(
|
||||
|
|
@ -119,7 +120,8 @@ TEST_P(HlslSemantics, FromFile)
|
|||
GetParam().baseSamplerBinding,
|
||||
GetParam().baseTextureBinding,
|
||||
GetParam().baseUboBinding,
|
||||
GetParam().autoMapBindings);
|
||||
GetParam().autoMapBindings,
|
||||
GetParam().flattenUniforms);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
|
@ -251,8 +253,9 @@ INSTANTIATE_TEST_CASE_P(
|
|||
INSTANTIATE_TEST_CASE_P(
|
||||
Hlsl, HlslSemantics,
|
||||
::testing::ValuesIn(std::vector<IoMapData>{
|
||||
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 15, true },
|
||||
{ "spv.register.noautoassign.frag", "main_ep", 5, 10, 15, false },
|
||||
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 15, true, false },
|
||||
{ "spv.register.noautoassign.frag", "main_ep", 5, 10, 15, false, false },
|
||||
{ "spv.register.autoassign-2.frag", "main", 5, 10, 15, true, true },
|
||||
}),
|
||||
FileNameAsCustomTestSuffixIoMap
|
||||
);
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ public:
|
|||
int baseSamplerBinding,
|
||||
int baseTextureBinding,
|
||||
int baseUboBinding,
|
||||
bool autoMapBindings)
|
||||
bool autoMapBindings,
|
||||
bool flattenUniformArrays)
|
||||
{
|
||||
const EShLanguage kind = GetShaderStage(GetSuffix(shaderName));
|
||||
|
||||
|
|
@ -257,6 +258,7 @@ public:
|
|||
shader.setShiftTextureBinding(baseTextureBinding);
|
||||
shader.setShiftUboBinding(baseUboBinding);
|
||||
shader.setAutoMapBindings(autoMapBindings);
|
||||
shader.setFlattenUniformArrays(flattenUniformArrays);
|
||||
|
||||
bool success = compile(&shader, code, entryPointName, controls);
|
||||
|
||||
|
|
@ -433,7 +435,8 @@ public:
|
|||
int baseSamplerBinding,
|
||||
int baseTextureBinding,
|
||||
int baseUboBinding,
|
||||
bool autoMapBindings)
|
||||
bool autoMapBindings,
|
||||
bool flattenUniformArrays)
|
||||
{
|
||||
const std::string inputFname = testDir + "/" + testName;
|
||||
const std::string expectedOutputFname =
|
||||
|
|
@ -446,7 +449,8 @@ public:
|
|||
const EShMessages controls = DeriveOptions(source, semantics, target);
|
||||
GlslangResult result = compileLinkIoMap(testName, input, entryPointName, controls,
|
||||
baseSamplerBinding, baseTextureBinding, baseUboBinding,
|
||||
autoMapBindings);
|
||||
autoMapBindings,
|
||||
flattenUniformArrays);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
std::ostringstream stream;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue