From 01d00f7a09def9ce097fff60f8494833a136789c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 8 Nov 2019 20:06:35 -0800 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/README.md | 9 +++++++++ 3rdparty/glslang/SPIRV/CMakeLists.txt | 7 ++++--- 3rdparty/glslang/SPIRV/SpvBuilder.h | 7 +++++++ 3rdparty/glslang/SPIRV/SpvPostProcess.cpp | 17 ++++++++++++++++- 3rdparty/glslang/SPIRV/spvIR.h | 2 +- .../glslang/OSDependent/Web/glslang.pre.js | 8 ++++---- 6 files changed, 41 insertions(+), 9 deletions(-) mode change 100644 => 100755 3rdparty/glslang/SPIRV/CMakeLists.txt diff --git a/3rdparty/glslang/README.md b/3rdparty/glslang/README.md index f5651e1d4..f1f6a2bb9 100755 --- a/3rdparty/glslang/README.md +++ b/3rdparty/glslang/README.md @@ -28,6 +28,15 @@ comment in `glslang/MachineIndependent/Versions.cpp`. Tasks waiting to be done are documented as GitHub issues. +Deprecations +------------ + +1. GLSLang, when installed through CMake, will install a `SPIRV` folder into +`${CMAKE_INSTALL_INCLUDEDIR}`. This `SPIRV` folder is being moved to +`glslang/SPIRV`. During the transition the `SPIRV` folder will be installed into +both locations. The old install of `SPIRV/` will be removed as a CMake install +target no sooner then May 1, 2020. See issue #1964. + Execution of Standalone Wrapper ------------------------------- diff --git a/3rdparty/glslang/SPIRV/CMakeLists.txt b/3rdparty/glslang/SPIRV/CMakeLists.txt old mode 100644 new mode 100755 index e25ec0a13..9869bafdc --- a/3rdparty/glslang/SPIRV/CMakeLists.txt +++ b/3rdparty/glslang/SPIRV/CMakeLists.txt @@ -90,9 +90,10 @@ if(ENABLE_GLSLANG_INSTALL) install(TARGETS SPIRV EXPORT SPIRVTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() - - install(EXPORT SPVRemapperTargets DESTINATION lib/cmake) - install(EXPORT SPIRVTargets DESTINATION lib/cmake) + install(EXPORT SPVRemapperTargets DESTINATION lib/cmake) + install(EXPORT SPIRVTargets DESTINATION lib/cmake) + + install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/) install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/) endif(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/glslang/SPIRV/SpvBuilder.h b/3rdparty/glslang/SPIRV/SpvBuilder.h index 8d8f34baa..31fee975f 100644 --- a/3rdparty/glslang/SPIRV/SpvBuilder.h +++ b/3rdparty/glslang/SPIRV/SpvBuilder.h @@ -687,10 +687,17 @@ public: // based on the resulting SPIR-V. void postProcess(); + // Prune unreachable blocks in the CFG and remove unneeded decorations. + void postProcessCFG(); + +#ifndef GLSLANG_WEB + // Add capabilities, extensions based on instructions in the module. + void postProcessFeatures(); // Hook to visit each instruction in a block in a function void postProcess(Instruction&); // Hook to visit each non-32-bit sized float/int operation in a block. void postProcessType(const Instruction&, spv::Id typeId); +#endif void dump(std::vector&) const; diff --git a/3rdparty/glslang/SPIRV/SpvPostProcess.cpp b/3rdparty/glslang/SPIRV/SpvPostProcess.cpp index 86fad580a..d40174d17 100644 --- a/3rdparty/glslang/SPIRV/SpvPostProcess.cpp +++ b/3rdparty/glslang/SPIRV/SpvPostProcess.cpp @@ -58,6 +58,7 @@ namespace spv { namespace spv { +#ifndef GLSLANG_WEB // Hook to visit each operand type and result type of an instruction. // Will be called multiple times for one instruction, once for each typed // operand and the result. @@ -319,9 +320,10 @@ void Builder::postProcess(Instruction& inst) } } } +#endif // comment in header -void Builder::postProcess() +void Builder::postProcessCFG() { // reachableBlocks is the set of blockss reached via control flow, or which are // unreachable continue targert or unreachable merge. @@ -377,7 +379,11 @@ void Builder::postProcess() return unreachableDefinitions.count(decoration_id) != 0; }), decorations.end()); +} +#ifndef GLSLANG_WEB +// comment in header +void Builder::postProcessFeatures() { // Add per-instruction capabilities, extensions, etc., // Look for any 8/16 bit type in physical storage buffer class, and set the @@ -431,5 +437,14 @@ void Builder::postProcess() } } } +#endif + +// comment in header +void Builder::postProcess() { + postProcessCFG(); +#ifndef GLSLANG_WEB + postProcessFeatures(); +#endif +} }; // end spv namespace diff --git a/3rdparty/glslang/SPIRV/spvIR.h b/3rdparty/glslang/SPIRV/spvIR.h index 994224d1f..cf6a71159 100755 --- a/3rdparty/glslang/SPIRV/spvIR.h +++ b/3rdparty/glslang/SPIRV/spvIR.h @@ -252,7 +252,7 @@ public: assert(header != nullptr); Instruction* branch = new Instruction(OpBranch); branch->addIdOperand(header->getId()); - addInstruction(std::move(std::unique_ptr(branch))); + addInstruction(std::unique_ptr(branch)); successors.push_back(header); } diff --git a/3rdparty/glslang/glslang/OSDependent/Web/glslang.pre.js b/3rdparty/glslang/glslang/OSDependent/Web/glslang.pre.js index dd7100b3f..7d3fd0234 100644 --- a/3rdparty/glslang/glslang/OSDependent/Web/glslang.pre.js +++ b/3rdparty/glslang/glslang/OSDependent/Web/glslang.pre.js @@ -29,8 +29,8 @@ Module['compileGLSLZeroCopy'] = function(glsl, shader_stage, gen_debug) { var ret = {}; var outputIndexU32 = output / 4; - ret.data = Module['HEAPU32'].subarray(outputIndexU32, outputIndexU32 + output_len); - ret.free = function() { + ret['data'] = Module['HEAPU32'].subarray(outputIndexU32, outputIndexU32 + output_len); + ret['free'] = function() { Module['_destroy_output_buffer'](id); }; @@ -39,7 +39,7 @@ Module['compileGLSLZeroCopy'] = function(glsl, shader_stage, gen_debug) { Module['compileGLSL'] = function(glsl, shader_stage, gen_debug) { var compiled = Module['compileGLSLZeroCopy'](glsl, shader_stage, gen_debug); - var ret = compiled.data.slice() - compiled.free(); + var ret = compiled['data'].slice() + compiled['free'](); return ret; };