Web: Generalize _EXTENSIONS* in SPIR-V back-end.
About 50 fewer #ifdefs. About 14K smaller. Note, the base size is ill-defined due to optimizer settings (size vs. performance), compression, and target architecture. Some recent %'s are accidentally reported as 3X the real savings. Early %'s were accurate. What matters though is that each step got worthwhile gains, and what the final size ends up being.
This commit is contained in:
parent
b6d3ee5aca
commit
a28f7a75d1
11 changed files with 1188 additions and 1312 deletions
|
|
@ -877,6 +877,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
|
|||
} else
|
||||
error(loc, "does not apply to this type:", field.c_str(), base->getType().getCompleteString().c_str());
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
// Propagate noContraction up the dereference chain
|
||||
if (base->getQualifier().noContraction)
|
||||
result->getWritableType().getQualifier().noContraction = true;
|
||||
|
|
@ -884,6 +885,7 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
|
|||
// Propagate nonuniform
|
||||
if (base->getQualifier().isNonUniform())
|
||||
result->getWritableType().getQualifier().nonUniform = true;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -3431,7 +3433,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
|
|||
(profile == EEsProfile && version < 310))
|
||||
&& ! extensionTurnedOn(E_GL_ARB_shading_language_420pack)) {
|
||||
// non-function parameters
|
||||
if (src.noContraction && (dst.invariant || dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone))
|
||||
if (src.isNoContraction() && (dst.invariant || dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone))
|
||||
error(loc, "precise qualifier must appear first", "", "");
|
||||
if (src.invariant && (dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone))
|
||||
error(loc, "invariant qualifier must appear before interpolation, storage, and precision qualifiers ", "", "");
|
||||
|
|
@ -3443,7 +3445,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
|
|||
error(loc, "precision qualifier must appear as last qualifier", "", "");
|
||||
|
||||
// function parameters
|
||||
if (src.noContraction && (dst.storage == EvqConst || dst.storage == EvqIn || dst.storage == EvqOut))
|
||||
if (src.isNoContraction() && (dst.storage == EvqConst || dst.storage == EvqIn || dst.storage == EvqOut))
|
||||
error(loc, "precise qualifier must appear first", "", "");
|
||||
if (src.storage == EvqConst && (dst.storage == EvqIn || dst.storage == EvqOut))
|
||||
error(loc, "in/out must appear before const", "", "");
|
||||
|
|
@ -3482,11 +3484,11 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
|
|||
bool repeated = false;
|
||||
#define MERGE_SINGLETON(field) repeated |= dst.field && src.field; dst.field |= src.field;
|
||||
MERGE_SINGLETON(invariant);
|
||||
MERGE_SINGLETON(noContraction);
|
||||
MERGE_SINGLETON(centroid);
|
||||
MERGE_SINGLETON(smooth);
|
||||
MERGE_SINGLETON(flat);
|
||||
#ifndef GLSLANG_WEB
|
||||
MERGE_SINGLETON(noContraction);
|
||||
MERGE_SINGLETON(nopersp);
|
||||
MERGE_SINGLETON(explicitInterp);
|
||||
MERGE_SINGLETON(perPrimitiveNV);
|
||||
|
|
@ -4449,12 +4451,14 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
|
|||
error(loc, "cannot use layout qualifiers on a function parameter", "", "");
|
||||
if (qualifier.invariant)
|
||||
error(loc, "cannot use invariant qualifier on a function parameter", "", "");
|
||||
if (qualifier.noContraction) {
|
||||
#ifndef GLSLANG_WEB
|
||||
if (qualifier.isNoContraction()) {
|
||||
if (qualifier.isParamOutput())
|
||||
type.getQualifier().noContraction = true;
|
||||
else
|
||||
warn(loc, "qualifier has no effect on non-output parameters", "precise", "");
|
||||
}
|
||||
#endif
|
||||
if (qualifier.isNonUniform())
|
||||
type.getQualifier().nonUniform = qualifier.nonUniform;
|
||||
|
||||
|
|
@ -7281,11 +7285,13 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
|
|||
for (unsigned int member = 0; member < typeList.size(); ++member)
|
||||
layoutTypeCheck(typeList[member].loc, *typeList[member].type);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
if (memberWithPerViewQualifier) {
|
||||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||
checkAndResizeMeshViewDim(typeList[member].loc, *typeList[member].type, /*isBlockMember*/ true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// reverse merge, so that currentBlockQualifier now has all layout information
|
||||
// (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers)
|
||||
|
|
@ -7699,11 +7705,15 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua
|
|||
error(loc, "cannot change qualification after use", "invariant", "");
|
||||
symbol->getWritableType().getQualifier().invariant = true;
|
||||
invariantCheck(loc, symbol->getType().getQualifier());
|
||||
} else if (qualifier.noContraction) {
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
else if (qualifier.isNoContraction()) {
|
||||
if (intermediate.inIoAccessed(identifier))
|
||||
error(loc, "cannot change qualification after use", "precise", "");
|
||||
symbol->getWritableType().getQualifier().noContraction = true;
|
||||
} else if (qualifier.specConstant) {
|
||||
}
|
||||
#endif
|
||||
else if (qualifier.specConstant) {
|
||||
symbol->getWritableType().getQualifier().makeSpecConstant();
|
||||
if (qualifier.hasSpecConstantId())
|
||||
symbol->getWritableType().getQualifier().layoutSpecConstantId = qualifier.layoutSpecConstantId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue