Only print legalization warning if optimizer disabled
This commit is contained in:
parent
7be36647fc
commit
fb03a55e0f
16 changed files with 21 additions and 21 deletions
|
|
@ -92,7 +92,7 @@ TEST_P(HlslLegalizeTest, FromFile)
|
|||
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
|
||||
Source::HLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
|
||||
Target::Spv, true, GetParam().entryPoint,
|
||||
"/baseLegalResults/", false);
|
||||
"/baseLegalResults/", true);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
|
@ -410,7 +410,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
);
|
||||
// clang-format on
|
||||
|
||||
#ifdef ENABLE_OPT
|
||||
#if ENABLE_OPT
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
ToSpirv, HlslLegalizeTest,
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ EShMessages DeriveOptions(Source source, Semantics semantics, Target target)
|
|||
break;
|
||||
}
|
||||
|
||||
result = static_cast<EShMessages>(result | EShMsgHlslLegalization);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue