Only print legalization warning if optimizer disabled

This commit is contained in:
GregF
2018-03-29 11:49:14 -06:00
parent 7be36647fc
commit fb03a55e0f
16 changed files with 21 additions and 21 deletions

View File

@@ -200,7 +200,7 @@ public:
glslang::EShTargetClientVersion clientTargetVersion,
bool flattenUniformArrays = false,
EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
bool disableOptimizer = true,
bool enableOptimizer = false,
bool automap = true)
{
const EShLanguage stage = GetShaderStage(GetSuffix(shaderName));
@@ -242,7 +242,7 @@ public:
if (success && (controls & EShMsgSpvRules)) {
std::vector<uint32_t> spirv_binary;
glslang::SpvOptions options;
options.disableOptimizer = disableOptimizer;
options.disableOptimizer = !enableOptimizer;
glslang::GlslangToSpv(*program.getIntermediate(stage),
spirv_binary, &logger, &options);
@@ -412,7 +412,7 @@ public:
bool automap = true,
const std::string& entryPointName="",
const std::string& baseDir="/baseResults/",
const bool disableOptimizer = true)
const bool enableOptimizer = false)
{
const std::string inputFname = testDir + "/" + testName;
const std::string expectedOutputFname =
@@ -422,9 +422,11 @@ public:
tryLoadFile(inputFname, "input", &input);
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
const EShMessages controls = DeriveOptions(source, semantics, target);
EShMessages controls = DeriveOptions(source, semantics, target);
if (enableOptimizer)
controls = static_cast<EShMessages>(controls & ~EShMsgHlslLegalization);
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false,
EShTexSampTransKeep, disableOptimizer, automap);
EShTexSampTransKeep, enableOptimizer, automap);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;