Add Error check flag in io mapper
authorChow <laddoc@outlook.com>
Tue, 24 Dec 2019 03:49:02 +0000 (11:49 +0800)
committerChow <laddoc@outlook.com>
Thu, 16 Jan 2020 05:29:40 +0000 (13:29 +0800)
GLSL could detect contradictory uniform binding, but missing error reporting, even if we could now observe error inside infosink.

Add error check when first time validate uniform binding. When doing traversal, it should be zero error.

This error check flag will be used during linking time. To quickly report errors like contradictory uniform bindings.

Add error check flags for TDefaultGlslIoResolver when catching EPrefixInternalError

glslang/MachineIndependent/iomapper.cpp
glslang/MachineIndependent/iomapper.h

index 3262c0a..4856422 100644 (file)
@@ -831,6 +831,7 @@ void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink&
                 if (iter->second != location) {
                     TString errorMsg = "Invalid location: " + name;
                     infoSink.info.message(EPrefixInternalError, errorMsg.c_str());
+                    hasError = true;
                 }
             }
         }
@@ -856,6 +857,7 @@ void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink&
                 if (iter->second != location) {
                     TString errorMsg = "Invalid location: " + name;
                     infoSink.info.message(EPrefixInternalError, errorMsg.c_str());
+                    hasError = true;
                 }
             }
         }
@@ -884,6 +886,7 @@ void TDefaultGlslIoResolver::reserverResourceSlot(TVarEntryInfo& ent, TInfoSink&
             if (iter->second != binding) {
                 TString errorMsg = "Invalid binding: " + name;
                 infoSink.info.message(EPrefixInternalError, errorMsg.c_str());
+                hasError = true;
             }
         }
     }
index 684e88d..933e259 100644 (file)
@@ -129,6 +129,7 @@ public:
     uint32_t computeTypeLocationSize(const TType& type, EShLanguage stage);
 
     TSlotSetMap slots;
+    bool hasError = false;
 
 protected:
     TDefaultIoResolverBase(TDefaultIoResolverBase&);