diff options
Diffstat (limited to 'thirdparty/glslang/SPIRV/SpvTools.cpp')
-rw-r--r-- | thirdparty/glslang/SPIRV/SpvTools.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/thirdparty/glslang/SPIRV/SpvTools.cpp b/thirdparty/glslang/SPIRV/SpvTools.cpp index 112ac33c5c..16d051a9b2 100644 --- a/thirdparty/glslang/SPIRV/SpvTools.cpp +++ b/thirdparty/glslang/SPIRV/SpvTools.cpp @@ -44,7 +44,6 @@ #include "SpvTools.h" #include "spirv-tools/optimizer.hpp" -#include "spirv-tools/libspirv.h" namespace glslang { @@ -114,11 +113,18 @@ void OptimizerMesssageConsumer(spv_message_level_t level, const char *source, out << std::endl; } -// Use the SPIRV-Tools disassembler to print SPIR-V. +// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment. void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv) { + SpirvToolsDisassemble(out, spirv, spv_target_env::SPV_ENV_UNIVERSAL_1_3); +} + +// Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment. +void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv, + spv_target_env requested_context) +{ // disassemble - spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_3); + spv_context context = spvContextCreate(requested_context); spv_text text; spv_diagnostic diagnostic = nullptr; spvBinaryToText(context, spirv.data(), spirv.size(), @@ -174,10 +180,7 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector // line information into all SPIR-V instructions. This avoids loss of // information when instructions are deleted or moved. Later, remove // redundant information to minimize final SPRIR-V size. - if (options->generateDebugInfo) { - optimizer.RegisterPass(spvtools::CreatePropagateLineInfoPass()); - } - else if (options->stripDebugInfo) { + if (options->stripDebugInfo) { optimizer.RegisterPass(spvtools::CreateStripDebugInfoPass()); } optimizer.RegisterPass(spvtools::CreateWrapOpKillPass()); @@ -207,9 +210,6 @@ void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector } optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); optimizer.RegisterPass(spvtools::CreateCFGCleanupPass()); - if (options->generateDebugInfo) { - optimizer.RegisterPass(spvtools::CreateRedundantLineInfoElimPass()); - } spvtools::OptimizerOptions spvOptOptions; optimizer.SetTargetEnv(MapToSpirvToolsEnv(intermediate.getSpv(), logger)); |