Commit b6d3ee5a by John Kessenich

Web: Turn off bracket-style attributes, reflection, and IO mapping.

parent 7015bd65
...@@ -1071,11 +1071,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits) ...@@ -1071,11 +1071,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages)) if (! (Options & EOptionOutputPreprocessed) && ! program.link(messages))
LinkFailed = true; LinkFailed = true;
#ifndef GLSLANG_WEB
// Map IO // Map IO
if (Options & EOptionSpv) { if (Options & EOptionSpv) {
if (!program.mapIO()) if (!program.mapIO())
LinkFailed = true; LinkFailed = true;
} }
#endif
// Report // Report
if (! (Options & EOptionSuppressInfolog) && if (! (Options & EOptionSuppressInfolog) &&
...@@ -1084,11 +1086,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits) ...@@ -1084,11 +1086,13 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
PutsIfNonEmpty(program.getInfoDebugLog()); PutsIfNonEmpty(program.getInfoDebugLog());
} }
#ifndef GLSLANG_WEB
// Reflect // Reflect
if (Options & EOptionDumpReflection) { if (Options & EOptionDumpReflection) {
program.buildReflection(ReflectOptions); program.buildReflection(ReflectOptions);
program.dumpReflection(); program.dumpReflection();
} }
#endif
// Dump SPIR-V // Dump SPIR-V
if (Options & EOptionSpv) { if (Options & EOptionSpv) {
......
...@@ -421,6 +421,7 @@ public: ...@@ -421,6 +421,7 @@ public:
void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode);
TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body);
#ifndef GLSLANG_WEB
TAttributeType attributeFromName(const TString& name) const; TAttributeType attributeFromName(const TString& name) const;
TAttributes* makeAttributes(const TString& identifier) const; TAttributes* makeAttributes(const TString& identifier) const;
TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const; TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const;
...@@ -429,9 +430,9 @@ public: ...@@ -429,9 +430,9 @@ public:
// Determine selection control from attributes // Determine selection control from attributes
void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*); void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*);
void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*); void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*);
// Determine loop control from attributes // Determine loop control from attributes
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*); void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
#endif
void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember); void checkAndResizeMeshViewDim(const TSourceLoc&, TType&, bool isBlockMember);
......
...@@ -1860,7 +1860,11 @@ const char* TShader::getInfoDebugLog() ...@@ -1860,7 +1860,11 @@ const char* TShader::getInfoDebugLog()
return infoSink->debug.c_str(); return infoSink->debug.c_str();
} }
TProgram::TProgram() : reflection(0), linked(false) TProgram::TProgram() :
#ifndef GLSLANG_WEB
reflection(0),
#endif
linked(false)
{ {
pool = new TPoolAllocator; pool = new TPoolAllocator;
infoSink = new TInfoSink; infoSink = new TInfoSink;
...@@ -1873,7 +1877,9 @@ TProgram::TProgram() : reflection(0), linked(false) ...@@ -1873,7 +1877,9 @@ TProgram::TProgram() : reflection(0), linked(false)
TProgram::~TProgram() TProgram::~TProgram()
{ {
delete infoSink; delete infoSink;
#ifndef GLSLANG_WEB
delete reflection; delete reflection;
#endif
for (int s = 0; s < EShLangCount; ++s) for (int s = 0; s < EShLangCount; ++s)
if (newedIntermediate[s]) if (newedIntermediate[s])
...@@ -1985,6 +1991,8 @@ const char* TProgram::getInfoDebugLog() ...@@ -1985,6 +1991,8 @@ const char* TProgram::getInfoDebugLog()
return infoSink->debug.c_str(); return infoSink->debug.c_str();
} }
#ifndef GLSLANG_WEB
// //
// Reflection implementation. // Reflection implementation.
// //
...@@ -2062,4 +2070,6 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper) ...@@ -2062,4 +2070,6 @@ bool TProgram::mapIO(TIoMapResolver* pResolver, TIoMapper* pIoMapper)
return ioMapper->doMap(pResolver, *infoSink); return ioMapper->doMap(pResolver, *infoSink);
} }
#endif // GLSLANG_WEB
} // end namespace glslang } // end namespace glslang
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef GLSLANG_WEB
#include "attribute.h" #include "attribute.h"
#include "../Include/intermediate.h" #include "../Include/intermediate.h"
#include "ParseHelper.h" #include "ParseHelper.h"
...@@ -339,5 +341,6 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN ...@@ -339,5 +341,6 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
} }
} }
} // end namespace glslang } // end namespace glslang
#endif // GLSLANG_WEB
...@@ -3662,7 +3662,9 @@ selection_statement ...@@ -3662,7 +3662,9 @@ selection_statement
$$ = $1; $$ = $1;
} }
| attribute selection_statement_nonattributed { | attribute selection_statement_nonattributed {
#ifndef GLSLANG_WEB
parseContext.handleSelectionAttributes(*$1, $2); parseContext.handleSelectionAttributes(*$1, $2);
#endif
$$ = $2; $$ = $2;
} }
...@@ -3707,7 +3709,9 @@ switch_statement ...@@ -3707,7 +3709,9 @@ switch_statement
$$ = $1; $$ = $1;
} }
| attribute switch_statement_nonattributed { | attribute switch_statement_nonattributed {
#ifndef GLSLANG_WEB
parseContext.handleSwitchAttributes(*$1, $2); parseContext.handleSwitchAttributes(*$1, $2);
#endif
$$ = $2; $$ = $2;
} }
...@@ -3769,7 +3773,9 @@ iteration_statement ...@@ -3769,7 +3773,9 @@ iteration_statement
$$ = $1; $$ = $1;
} }
| attribute iteration_statement_nonattributed { | attribute iteration_statement_nonattributed {
#ifndef GLSLANG_WEB
parseContext.handleLoopAttributes(*$1, $2); parseContext.handleLoopAttributes(*$1, $2);
#endif
$$ = $2; $$ = $2;
} }
...@@ -3943,15 +3949,21 @@ attribute_list ...@@ -3943,15 +3949,21 @@ attribute_list
$$ = $1; $$ = $1;
} }
| attribute_list COMMA single_attribute { | attribute_list COMMA single_attribute {
#ifndef GLSLANG_WEB
$$ = parseContext.mergeAttributes($1, $3); $$ = parseContext.mergeAttributes($1, $3);
#endif
} }
single_attribute single_attribute
: IDENTIFIER { : IDENTIFIER {
#ifndef GLSLANG_WEB
$$ = parseContext.makeAttributes(*$1.string); $$ = parseContext.makeAttributes(*$1.string);
#endif
} }
| IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN { | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
#ifndef GLSLANG_WEB
$$ = parseContext.makeAttributes(*$1.string, $3); $$ = parseContext.makeAttributes(*$1.string, $3);
#endif
} }
%% %%
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef GLSLANG_WEB
#include "../Include/Common.h" #include "../Include/Common.h"
#include "../Include/InfoSink.h" #include "../Include/InfoSink.h"
...@@ -1239,3 +1241,5 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) { ...@@ -1239,3 +1241,5 @@ bool TGlslIoMapper::doMap(TIoMapResolver* resolver, TInfoSink& infoSink) {
} }
} // end namespace glslang } // end namespace glslang
#endif // GLSLANG_WEB
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef GLSLANG_WEB
#ifndef _IOMAPPER_INCLUDED #ifndef _IOMAPPER_INCLUDED
#define _IOMAPPER_INCLUDED #define _IOMAPPER_INCLUDED
...@@ -293,3 +295,5 @@ public: ...@@ -293,3 +295,5 @@ public:
} // end namespace glslang } // end namespace glslang
#endif // _IOMAPPER_INCLUDED #endif // _IOMAPPER_INCLUDED
#endif // GLSLANG_WEB
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef GLSLANG_WEB
#include "../Include/Common.h" #include "../Include/Common.h"
#include "reflection.h" #include "reflection.h"
#include "LiveTraverser.h" #include "LiveTraverser.h"
...@@ -1198,3 +1200,5 @@ void TReflection::dump() ...@@ -1198,3 +1200,5 @@ void TReflection::dump()
} }
} // end namespace glslang } // end namespace glslang
#endif // GLSLANG_WEB
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
// POSSIBILITY OF SUCH DAMAGE. // POSSIBILITY OF SUCH DAMAGE.
// //
#ifndef GLSLANG_WEB
#ifndef _REFLECTION_INCLUDED #ifndef _REFLECTION_INCLUDED
#define _REFLECTION_INCLUDED #define _REFLECTION_INCLUDED
...@@ -201,3 +203,5 @@ protected: ...@@ -201,3 +203,5 @@ protected:
} // end namespace glslang } // end namespace glslang
#endif // _REFLECTION_INCLUDED #endif // _REFLECTION_INCLUDED
#endif // GLSLANG_WEB
\ No newline at end of file
...@@ -617,6 +617,8 @@ private: ...@@ -617,6 +617,8 @@ private:
TShader& operator=(TShader&); TShader& operator=(TShader&);
}; };
#ifndef GLSLANG_WEB
// //
// A reflection database and its interface, consistent with the OpenGL API reflection queries. // A reflection database and its interface, consistent with the OpenGL API reflection queries.
// //
...@@ -732,6 +734,8 @@ public: ...@@ -732,6 +734,8 @@ public:
virtual void addStage(EShLanguage stage) = 0; virtual void addStage(EShLanguage stage) = 0;
}; };
#endif // GLSLANG_WEB
// Make one TProgram per set of shaders that will get linked together. Add all // Make one TProgram per set of shaders that will get linked together. Add all
// the shaders that are to be linked together. After calling shader.parse() // the shaders that are to be linked together. After calling shader.parse()
// for all shaders, call link(). // for all shaders, call link().
...@@ -751,14 +755,14 @@ public: ...@@ -751,14 +755,14 @@ public:
TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; } TIntermediate* getIntermediate(EShLanguage stage) const { return intermediate[stage]; }
#ifndef GLSLANG_WEB
// Reflection Interface // Reflection Interface
// call first, to do liveness analysis, index mapping, etc.; returns false on failure // call first, to do liveness analysis, index mapping, etc.; returns false on failure
bool buildReflection(int opts = EShReflectionDefault); bool buildReflection(int opts = EShReflectionDefault);
unsigned getLocalSize(int dim) const; // return dim'th local size unsigned getLocalSize(int dim) const; // return dim'th local size
int getReflectionIndex(const char *name) const; int getReflectionIndex(const char *name) const;
int getNumUniformVariables() const; int getNumUniformVariables() const;
const TObjectReflection& getUniform(int index) const; const TObjectReflection& getUniform(int index) const;
int getNumUniformBlocks() const; int getNumUniformBlocks() const;
...@@ -837,11 +841,11 @@ public: ...@@ -837,11 +841,11 @@ public:
const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); } const TType *getAttributeTType(int index) const { return getPipeInput(index).getType(); }
void dumpReflection(); void dumpReflection();
// I/O mapping: apply base offsets and map live unbound variables // I/O mapping: apply base offsets and map live unbound variables
// If resolver is not provided it uses the previous approach // If resolver is not provided it uses the previous approach
// and respects auto assignment and offsets. // and respects auto assignment and offsets.
bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr); bool mapIO(TIoMapResolver* pResolver = nullptr, TIoMapper* pIoMapper = nullptr);
#endif
protected: protected:
bool linkStage(EShLanguage, EShMessages); bool linkStage(EShLanguage, EShMessages);
...@@ -851,7 +855,9 @@ protected: ...@@ -851,7 +855,9 @@ protected:
TIntermediate* intermediate[EShLangCount]; TIntermediate* intermediate[EShLangCount];
bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage bool newedIntermediate[EShLangCount]; // track which intermediate were "new" versus reusing a singleton unit in a stage
TInfoSink* infoSink; TInfoSink* infoSink;
#ifndef GLSLANG_WEB
TReflection* reflection; TReflection* reflection;
#endif
bool linked; bool linked;
private: private:
......
...@@ -308,7 +308,9 @@ public: ...@@ -308,7 +308,9 @@ public:
program.addShader(&shader); program.addShader(&shader);
success &= program.link(controls); success &= program.link(controls);
#ifndef GLSLANG_WEB
success &= program.mapIO(); success &= program.mapIO();
#endif
spv::SpvBuildLogger logger; spv::SpvBuildLogger logger;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment