Web: Remove a few additional HLSL constructs with ENABLE_HLSL.
authorJohn Kessenich <cepheus@frii.com>
Sat, 27 Jul 2019 11:22:30 +0000 (05:22 -0600)
committerJohn Kessenich <cepheus@frii.com>
Wed, 21 Aug 2019 05:21:55 +0000 (23:21 -0600)
Saves about 3K.

StandAlone/StandAlone.cpp
Test/baseResults/size
glslang/MachineIndependent/ShaderLang.cpp
glslang/MachineIndependent/localintermediate.h
glslang/MachineIndependent/preprocessor/PpScanner.cpp
glslang/Public/ShaderLang.h

index 3bb3af3..6af00dc 100644 (file)
@@ -996,8 +996,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
         shader->setNanMinMaxClamp(NaNClamp);
         shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
 
+#ifdef ENABLE_HLSL
         if (Options & EOptionHlslIoMapping)
             shader->setHlslIoMapping(true);
+#endif
 
         if (Options & EOptionAutoMapBindings)
             shader->setAutoMapBindings(true);
@@ -1023,8 +1025,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
                                 compUnit.stage, Client, ClientInputSemanticsVersion);
             shader->setEnvClient(Client, ClientVersion);
             shader->setEnvTarget(TargetLanguage, TargetVersion);
+#ifdef ENABLE_HLSL
             if (targetHlslFunctionality1)
                 shader->setEnvTargetHlslFunctionality1();
+#endif
         }
 
         shaders.push_back(shader);
index 174f9ef..adad32c 100644 (file)
@@ -1 +1 @@
-1213440 ../build/install/bin/glslangValidator.exe
+1210368 ../build/install/bin/glslangValidator.exe
index b595b86..3bb05a5 100755 (executable)
@@ -837,9 +837,10 @@ bool ProcessDeferred(
     SpvVersion spvVersion;
     EShLanguage stage = compiler->getLanguage();
     TranslateEnvironment(environment, messages, source, stage, spvVersion);
+#ifdef ENABLE_HLSL
     if (environment != nullptr && environment->target.hlslFunctionality1)
         intermediate.setHlslFunctionality1();
-
+#endif
     // First, without using the preprocessor or parser, find the #version, so we know what
     // symbol tables, processing rules, etc. to set up.  This does not need the extra strings
     // outlined above, just the user shader, after the system and user preambles.
@@ -887,8 +888,10 @@ bool ProcessDeferred(
     RecordProcesses(intermediate, messages, sourceEntryPointName);
     if (spvVersion.vulkan > 0)
         intermediate.setOriginUpperLeft();
+#ifdef ENABLE_HLSL
     if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
         intermediate.setHlslOffsets();
+#endif
     if (messages & EShMsgDebugInfo) {
         intermediate.setSourceFile(names[numPre]);
         for (int s = 0; s < numStrings; ++s) {
@@ -1788,7 +1791,9 @@ void TShader::setUniformLocationBase(int base)
     intermediate->setUniformLocationBase(base);
 }
 // See comment above TDefaultHlslIoMapper in iomapper.cpp:
+#ifdef ENABLE_HLSL
 void TShader::setHlslIoMapping(bool hlslIoMap)          { intermediate->setHlslIoMapping(hlslIoMap); }
+#endif
 void TShader::setFlattenUniformArrays(bool flatten)     { intermediate->setFlattenUniformArrays(flatten); }
 void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
 void TShader::setNanMinMaxClamp(bool useNonNan)         { intermediate->setNanMinMaxClamp(useNonNan); }
index eb0cc7a..1bd8f96 100644 (file)
@@ -376,26 +376,12 @@ public:
             processes.addProcess("no-storage-format");
     }
     bool getNoStorageFormat() const { return useUnknownFormat; }
-    void setHlslOffsets()
-    {
-        hlslOffsets = true;
-        if (hlslOffsets)
-            processes.addProcess("hlsl-offsets");
-    }
-    bool usingHlslOffsets() const { return hlslOffsets; }
     void setUseStorageBuffer()
     {
         useStorageBuffer = true;
         processes.addProcess("use-storage-buffer");
     }
     bool usingStorageBuffer() const { return useStorageBuffer; }
-    void setHlslIoMapping(bool b)
-    {
-        hlslIoMapping = b;
-        if (hlslIoMapping)
-            processes.addProcess("hlsl-iomap");
-    }
-    bool usingHlslIoMapping() { return hlslIoMapping; }
     void setUseVulkanMemoryModel()
     {
         useVulkanMemoryModel = true;
@@ -667,8 +653,28 @@ public:
     void setDepthReplacing() { depthReplacing = true; }
     bool isDepthReplacing() const { return depthReplacing; }
 
+#ifdef ENABLE_HLSL
     void setHlslFunctionality1() { hlslFunctionality1 = true; }
     bool getHlslFunctionality1() const { return hlslFunctionality1; }
+    void setHlslOffsets()
+    {
+        hlslOffsets = true;
+        if (hlslOffsets)
+            processes.addProcess("hlsl-offsets");
+    }
+    bool usingHlslOffsets() const { return hlslOffsets; }
+    void setHlslIoMapping(bool b)
+    {
+        hlslIoMapping = b;
+        if (hlslIoMapping)
+            processes.addProcess("hlsl-iomap");
+    }
+    bool usingHlslIoMapping() { return hlslIoMapping; }
+#else
+    bool getHlslFunctionality1() const { return false; }
+    bool usingHlslOffsets() const { return false; }
+    bool usingHlslIoMapping() { return false; }
+#endif
 
     void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
     unsigned int getBlendEquations() const { return blendEquations; }
index f6f52d7..4c8ee3d 100755 (executable)
@@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
         ch = getChar();
         int firstDecimal = len;
 
+#ifdef ENABLE_HLSL
         // 1.#INF or -1.#INF
         if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
             if ((len <  2) ||
@@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
                 }
             }
         }
+#endif
 
         // Consume leading-zero digits after the decimal point
         while (ch == '0') {
index 8811ca1..9930ed2 100755 (executable)
@@ -432,7 +432,9 @@ public:
     void addUniformLocationOverride(const char* name, int loc);
     void setUniformLocationBase(int base);
     void setInvertY(bool invert);
+#ifdef ENABLE_HLSL
     void setHlslIoMapping(bool hlslIoMap);
+#endif
     void setFlattenUniformArrays(bool flatten);
     void setNoStorageFormat(bool useUnknownFormat);
     void setNanMinMaxClamp(bool nanMinMaxClamp);
@@ -459,8 +461,12 @@ public:
         environment.target.language = lang;
         environment.target.version = version;
     }
+#ifdef ENABLE_HLSL
     void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
     bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
+#else
+    bool getEnvTargetHlslFunctionality1() const { return false; }
+#endif
 
     // Interface to #include handlers.
     //