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:
steve-lunarg
2016-09-22 14:35:23 -06:00
parent 02df206c9e
commit cf43e66125
8 changed files with 109 additions and 19 deletions

View File

@@ -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;