parent
4b7b86d568
commit
715f5c6cf1
7 changed files with 111 additions and 1 deletions
|
|
@ -327,6 +327,16 @@ void TParseContext::setAtomicCounterBlockDefaults(TType& block) const
|
|||
block.getQualifier().layoutMatrix = ElmRowMajor;
|
||||
}
|
||||
|
||||
void TParseContext::setInvariant(const TSourceLoc& loc, const char* builtin) {
|
||||
TSymbol* symbol = symbolTable.find(builtin);
|
||||
if (symbol && symbol->getType().getQualifier().isPipeOutput()) {
|
||||
if (intermediate.inIoAccessed(builtin))
|
||||
warn(loc, "changing qualification after use", "invariant", builtin);
|
||||
TSymbol* csymbol = symbolTable.copyUp(symbol);
|
||||
csymbol->getWritableType().getQualifier().invariant = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens)
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
|
|
@ -404,8 +414,33 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
|
|||
intermediate.setUseVariablePointers();
|
||||
} else if (tokens[0].compare("once") == 0) {
|
||||
warn(loc, "not implemented", "#pragma once", "");
|
||||
} else if (tokens[0].compare("glslang_binary_double_output") == 0)
|
||||
} else if (tokens[0].compare("glslang_binary_double_output") == 0) {
|
||||
intermediate.setBinaryDoubleOutput();
|
||||
} else if (spvVersion.spv > 0 && tokens[0].compare("STDGL") == 0 &&
|
||||
tokens[1].compare("invariant") == 0 && tokens[3].compare("all") == 0) {
|
||||
intermediate.setInvariantAll();
|
||||
// Set all builtin out variables invariant if declared
|
||||
setInvariant(loc, "gl_Position");
|
||||
setInvariant(loc, "gl_PointSize");
|
||||
setInvariant(loc, "gl_ClipDistance");
|
||||
setInvariant(loc, "gl_CullDistance");
|
||||
setInvariant(loc, "gl_TessLevelOuter");
|
||||
setInvariant(loc, "gl_TessLevelInner");
|
||||
setInvariant(loc, "gl_PrimitiveID");
|
||||
setInvariant(loc, "gl_Layer");
|
||||
setInvariant(loc, "gl_ViewportIndex");
|
||||
setInvariant(loc, "gl_FragDepth");
|
||||
setInvariant(loc, "gl_SampleMask");
|
||||
setInvariant(loc, "gl_ClipVertex");
|
||||
setInvariant(loc, "gl_FrontColor");
|
||||
setInvariant(loc, "gl_BackColor");
|
||||
setInvariant(loc, "gl_FrontSecondaryColor");
|
||||
setInvariant(loc, "gl_BackSecondaryColor");
|
||||
setInvariant(loc, "gl_TexCoord");
|
||||
setInvariant(loc, "gl_FogFragCoord");
|
||||
setInvariant(loc, "gl_FragColor");
|
||||
setInvariant(loc, "gl_FragData");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -3651,6 +3686,8 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q
|
|||
profileRequires(loc, ENoProfile, 130, nullptr, "out for stage outputs");
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, "out for stage outputs");
|
||||
qualifier.storage = EvqVaryingOut;
|
||||
if (intermediate.isInvariantAll())
|
||||
qualifier.invariant = true;
|
||||
break;
|
||||
case EvqInOut:
|
||||
qualifier.storage = EvqVaryingIn;
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ protected:
|
|||
// override this to set the language-specific name
|
||||
virtual const char* getAtomicCounterBlockName() const { return ""; }
|
||||
virtual void setAtomicCounterBlockDefaults(TType&) const {}
|
||||
virtual void setInvariant(const TSourceLoc& loc, const char* builtin) {}
|
||||
virtual void finalizeAtomicCounterBlockLayout(TVariable&) {}
|
||||
bool isAtomicCounterBlock(const TSymbol& symbol) {
|
||||
const TVariable* var = symbol.getAsVariable();
|
||||
|
|
@ -511,6 +512,7 @@ protected:
|
|||
virtual const char* getAtomicCounterBlockName() const override;
|
||||
virtual void finalizeAtomicCounterBlockLayout(TVariable&) override;
|
||||
virtual void setAtomicCounterBlockDefaults(TType& block) const override;
|
||||
virtual void setInvariant(const TSourceLoc& loc, const char* builtin) override;
|
||||
|
||||
public:
|
||||
//
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
|||
MERGE_TRUE(useUnknownFormat);
|
||||
MERGE_TRUE(hlslOffsets);
|
||||
MERGE_TRUE(useStorageBuffer);
|
||||
MERGE_TRUE(invariantAll);
|
||||
MERGE_TRUE(hlslIoMapping);
|
||||
|
||||
// TODO: sourceFile
|
||||
|
|
|
|||
|
|
@ -291,6 +291,7 @@ public:
|
|||
numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
|
||||
invertY(false),
|
||||
useStorageBuffer(false),
|
||||
invariantAll(false),
|
||||
nanMinMaxClamp(false),
|
||||
depthReplacing(false),
|
||||
uniqueId(0),
|
||||
|
|
@ -560,6 +561,8 @@ public:
|
|||
|
||||
void setUseStorageBuffer() { useStorageBuffer = true; }
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
void setInvariantAll() { invariantAll = true; }
|
||||
bool isInvariantAll() const { return invariantAll; }
|
||||
void setDepthReplacing() { depthReplacing = true; }
|
||||
bool isDepthReplacing() const { return depthReplacing; }
|
||||
bool setLocalSize(int dim, int size)
|
||||
|
|
@ -1063,6 +1066,7 @@ protected:
|
|||
bool recursive;
|
||||
bool invertY;
|
||||
bool useStorageBuffer;
|
||||
bool invariantAll;
|
||||
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
|
||||
bool depthReplacing;
|
||||
int localSize[3];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue