From 52fe3d598c841822f15a8e88a1ff5a00636d78f3 Mon Sep 17 00:00:00 2001 From: GregF Date: Thu, 28 Sep 2017 10:08:32 -0600 Subject: [PATCH] Legalization: Fix warnings and disable tests when spirv-tools not present --- StandAlone/StandAlone.cpp | 4 ++-- gtests/Hlsl.FromFile.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index d2587c1e..f427179b 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -896,8 +896,8 @@ void CompileAndLinkShaderUnits(std::vector compUnits) glslang::SpvOptions spvOptions; if (Options & EOptionDebug) spvOptions.generateDebugInfo = true; - spvOptions.disableOptimizer = Options & EOptionOptimizeDisable; - spvOptions.optimizeSize = Options & EOptionOptimizeSize; + spvOptions.disableOptimizer = (Options & EOptionOptimizeDisable) != 0; + spvOptions.optimizeSize = (Options & EOptionOptimizeSize) != 0; glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger, &spvOptions); // Dump the spv to a file or stdout, etc., but only if not doing diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp index 51c2a4b9..4e810ded 100644 --- a/gtests/Hlsl.FromFile.cpp +++ b/gtests/Hlsl.FromFile.cpp @@ -366,6 +366,7 @@ INSTANTIATE_TEST_CASE_P( ); // clang-format on +#ifdef ENABLE_OPT // clang-format off INSTANTIATE_TEST_CASE_P( ToSpirv, HlslLegalizeTest, @@ -378,6 +379,7 @@ INSTANTIATE_TEST_CASE_P( FileNameAsCustomTestSuffix ); // clang-format on +#endif } // anonymous namespace } // namespace glslangtest