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