From 273060c2d3da1e4aeab4923306ffc5c80c462da4 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 1 Oct 2016 17:47:40 -0600 Subject: [PATCH] Non-functional: Rationalizing parse helper hierarchy, step 1 (effected memory of HLSL keyword map). --- glslang/Include/revision.h | 2 +- glslang/MachineIndependent/ShaderLang.cpp | 3 +++ hlsl/hlslParseHelper.cpp | 30 ------------------------------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index c003acd..797c2f2 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // For the version, it uses the latest git tag followed by the number of commits. // For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.1545" +#define GLSLANG_REVISION "Overload400-PrecQual.1546" #define GLSLANG_DATE "01-Oct-2016" diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index ffd6b00..d6ff782 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -51,6 +51,7 @@ #include "../../hlsl/hlslParseables.h" #include "Scan.h" #include "ScanContext.h" +#include "../../hlsl/hlslScanContext.h" #include "../Include/ShHandle.h" #include "../../OGLCompilersDLL/InitializeDll.h" @@ -1049,6 +1050,7 @@ int ShInitialize() PerProcessGPA = new TPoolAllocator(); glslang::TScanContext::fillInKeywordMap(); + glslang::HlslScanContext::fillInKeywordMap(); return 1; } @@ -1141,6 +1143,7 @@ int __fastcall ShFinalize() } glslang::TScanContext::deleteKeywordMap(); + glslang::HlslScanContext::deleteKeywordMap(); return 1; } diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 2fa892f..f1294ef 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -117,8 +117,6 @@ bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& currentScanner = &input; ppContext.setInput(input, versionWillBeError); - HlslScanContext::fillInKeywordMap(); // TODO: right place, and include the delete too - HlslScanContext scanContext(*this, ppContext); HlslGrammar grammar(scanContext, *this); if (!grammar.parse()) { @@ -4774,34 +4772,6 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS if (arraySizes) blockType.newArraySizes(*arraySizes); - // - // Don't make a user-defined type out of block name; that will cause an error - // if the same block name gets reused in a different interface. - // - // "Block names have no other use within a shader - // beyond interface matching; it is a compile-time error to use a block name at global scope for anything - // other than as a block name (e.g., use of a block name for a global variable name or function name is - // currently reserved)." - // - // Use the symbol table to prevent normal reuse of the block's name, as a variable entry, - // whose type is EbtBlock, but without all the structure; that will come from the type - // the instances point to. - // - //??TType blockNameType(EbtBlock, blockType.getQualifier().storage); - //??TVariable* blockNameVar = new TVariable(blockName, blockNameType); - //if (! symbolTable.insert(*blockNameVar)) { - // TSymbol* existingName = symbolTable.find(*blockName); - // if (existingName->getType().getBasicType() == EbtBlock) { - // if (existingName->getType().getQualifier().storage == blockType.getQualifier().storage) { - // error(loc, "Cannot reuse block name within the same interface:", blockName->c_str(), blockType.getStorageQualifierString()); - // return; - // } - // } else { - // error(loc, "block name cannot redefine a non-block name", blockName->c_str(), ""); - // return; - // } - //} - // Add the variable, as anonymous or named instanceName. // Make an anonymous variable if no name was provided. if (! instanceName) -- 2.7.4