Бранимир Караџић 3 лет назад
Родитель
Сommit
b114d8bd62

+ 1 - 1
3rdparty/glslang/build_info.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (c) 2020 Google Inc.
 #

+ 2 - 2
3rdparty/glslang/gen_extension_headers.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (c) 2020 Google Inc.
 #
@@ -95,4 +95,4 @@ def main():
     generate_main(glsl_files, output_file)
 
 if __name__ == '__main__':
-    main()
+    main()

+ 2 - 2
3rdparty/glslang/glslang/Include/Common.h

@@ -67,7 +67,7 @@ std::string to_string(const T& val) {
 }
 #endif
 
-#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || MINGW_HAS_SECURE_API
+#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API
     #include <basetsd.h>
     #ifndef snprintf
     #define snprintf sprintf_s
@@ -219,7 +219,7 @@ template <class T> T Max(const T a, const T b) { return a > b ? a : b; }
 //
 // Create a TString object from an integer.
 //
-#if defined _MSC_VER || MINGW_HAS_SECURE_API
+#if defined _MSC_VER || defined MINGW_HAS_SECURE_API
 inline const TString String(const int i, const int base = 10)
 {
     char text[16];     // 32 bit ints are at most 10 digits in base 10

+ 1 - 1
3rdparty/glslang/glslang/Include/Types.h

@@ -2703,7 +2703,7 @@ public:
             *lpidx = -1;
             *rpidx = -1;
         }
-        return    sampler == right.sampler    &&
+        return ((basicType != EbtSampler && right.basicType != EbtSampler) || sampler == right.sampler) &&
                vectorSize == right.vectorSize &&
                matrixCols == right.matrixCols &&
                matrixRows == right.matrixRows &&

+ 14 - 14
3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp

@@ -203,11 +203,7 @@ struct TResolverUniformAdaptor {
 
     inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey) {
         TVarEntryInfo& ent = entKey.second;
-        ent.newLocation = -1;
-        ent.newComponent = -1;
-        ent.newBinding = -1;
-        ent.newSet = -1;
-        ent.newIndex = -1;
+        ent.clearNewAssignments();
         const bool isValid = resolver.validateBinding(stage, ent);
         if (isValid) {
             resolver.resolveSet(ent.stage, ent);
@@ -281,11 +277,7 @@ struct TResolverInOutAdaptor {
     inline void operator()(std::pair<const TString, TVarEntryInfo>& entKey)
     {
         TVarEntryInfo& ent = entKey.second;
-        ent.newLocation = -1;
-        ent.newComponent = -1;
-        ent.newBinding = -1;
-        ent.newSet = -1;
-        ent.newIndex = -1;
+        ent.clearNewAssignments();
         const bool isValid = resolver.validateInOut(ent.stage, ent);
         if (isValid) {
             resolver.resolveInOutLocation(stage, ent);
@@ -1670,6 +1662,10 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
                     if (size <= int(autoPushConstantMaxSize)) {
                         qualifier.setBlockStorage(EbsPushConstant);
                         qualifier.layoutPacking = autoPushConstantBlockPacking;
+                        // Push constants don't have set/binding etc. decorations, remove those.
+                        qualifier.layoutSet = TQualifier::layoutSetEnd;
+                        at->second.clearNewAssignments();
+
                         upgraded = true;
                     }
                 }
@@ -1677,10 +1673,14 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
             // If it's been upgraded to push_constant, then remove it from the uniformVector
             // so it doesn't get a set/binding assigned to it.
             if (upgraded) {
-                auto at = std::find_if(uniformVector.begin(), uniformVector.end(),
-                                       [this](const TVarLivePair& p) { return p.first == autoPushConstantBlockName; });
-                if (at != uniformVector.end())
-                    uniformVector.erase(at);
+                while (1) {
+                    auto at = std::find_if(uniformVector.begin(), uniformVector.end(),
+                                           [this](const TVarLivePair& p) { return p.first == autoPushConstantBlockName; });
+                    if (at != uniformVector.end())
+                        uniformVector.erase(at);
+                    else
+                        break;
+                }
             }
         }
         for (size_t stage = 0; stage < EShLangCount; stage++) {

+ 9 - 0
3rdparty/glslang/glslang/MachineIndependent/iomapper.h

@@ -61,6 +61,15 @@ struct TVarEntryInfo {
     int newComponent;
     int newIndex;
     EShLanguage stage;
+
+    void clearNewAssignments() {
+        newBinding = -1;
+        newSet = -1;
+        newLocation = -1;
+        newComponent = -1;
+        newIndex = -1;
+    }
+
     struct TOrderById {
         inline bool operator()(const TVarEntryInfo& l, const TVarEntryInfo& r) { return l.id < r.id; }
     };