GLSL/SPV: Fix #1196: Require resources to have layout(binding=X).

This commit is contained in:
John Kessenich
2018-02-21 18:19:49 -07:00
parent 2d9973de0e
commit 9c9c4e90df
20 changed files with 114 additions and 64 deletions

View File

@@ -199,12 +199,16 @@ public:
const std::string& entryPointName, EShMessages controls,
bool flattenUniformArrays = false,
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
bool disableOptimizer = true)
bool disableOptimizer = true,
bool automap = true)
{
const EShLanguage kind = GetShaderStage(GetSuffix(shaderName));
glslang::TShader shader(kind);
shader.setAutoMapLocations(true);
if (automap) {
shader.setAutoMapLocations(true);
shader.setAutoMapBindings(true);
}
shader.setTextureSamplerTransformMode(texSampTransMode);
shader.setFlattenUniformArrays(flattenUniformArrays);
@@ -302,6 +306,7 @@ public:
const EShLanguage kind = GetShaderStage(GetSuffix(shaderName));
glslang::TShader shader(kind);
shader.setAutoMapBindings(true);
shader.setAutoMapLocations(true);
bool success = compile(&shader, code, entryPointName, controls);
@@ -384,6 +389,7 @@ public:
Source source,
Semantics semantics,
Target target,
bool automap = true,
const std::string& entryPointName="",
const std::string& baseDir="/baseResults/",
const bool disableOptimizer = true)
@@ -397,7 +403,8 @@ public:
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
const EShMessages controls = DeriveOptions(source, semantics, target);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransKeep, disableOptimizer);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransKeep,
disableOptimizer, automap);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;
@@ -592,7 +599,8 @@ public:
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
const EShMessages controls = DeriveOptions(source, semantics, target);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransUpgradeTextureRemoveSampler);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false,
EShTexSampTransUpgradeTextureRemoveSampler);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;