Przeglądaj źródła

Updated glslang.

Бранимир Караџић 6 lat temu
rodzic
commit
01d00f7a09

+ 9 - 0
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
 -------------------------------
 

+ 4 - 3
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)

+ 7 - 0
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<unsigned int>&) const;
 

+ 16 - 1
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

+ 1 - 1
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<Instruction>(branch)));
+        addInstruction(std::unique_ptr<Instruction>(branch));
         successors.push_back(header);
     }
 

+ 4 - 4
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;
 };