Commit 39697cdb by John Kessenich

Web: Remove unnecessary GLSL numeric types, and some collateral.

This saves another 40K of x86 binary, which is about 13% of the target size.
parent 3e4b6ff7
......@@ -230,6 +230,11 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP
Id Builder::makeIntegerType(int width, bool hasSign)
{
#ifdef GLSLANG_WEB
assert(width == 32);
width = 32;
#endif
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeInt].size(); ++t) {
......@@ -265,6 +270,11 @@ Id Builder::makeIntegerType(int width, bool hasSign)
Id Builder::makeFloatType(int width)
{
#ifdef GLSLANG_WEB
assert(width == 32);
width = 32;
#endif
// try to find it
Instruction* type;
for (int t = 0; t < (int)groupedTypes[OpTypeFloat].size(); ++t) {
......
......@@ -576,6 +576,18 @@ public:
bool specConstant : 1; // having a constant_id is not sufficient: expressions have no id, but are still specConstant
bool nonUniform : 1;
#ifdef GLSLANG_WEB
bool isMemory() const { return false; }
bool isMemoryQualifierImageAndSSBOOnly() const { return false; }
bool bufferReferenceNeedsVulkanMemoryModel() const { return false; }
bool isInterpolation() const { return flat || smooth; }
bool isExplicitInterpolation() const { return false; }
bool isAuxiliary() const { return centroid; }
bool isPatch() const { return false; }
bool isNoContraction() const { return false; }
void setNoContraction() { }
bool isPervertexNV() const { return false; }
#else
bool isMemory() const
{
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
......@@ -584,17 +596,6 @@ public:
{
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly;
}
#ifdef GLSLANG_WEB
bool bufferReferenceNeedsVulkanMemoryModel() const { return false; }
bool isInterpolation() const
{
return flat || smooth;
}
bool isExplicitInterpolation() const { return false; }
bool isAuxiliary() const { return centroid; }
bool isNoContraction() const { return false; }
#else
bool bufferReferenceNeedsVulkanMemoryModel() const
{
// include qualifiers that map to load/store availability/visibility/nonprivate memory access operands
......@@ -612,7 +613,10 @@ public:
{
return centroid || patch || sample || pervertexNV;
}
bool isPatch() const { return patch; }
bool isNoContraction() const { return noContraction; }
void setNoContraction() { noContraction = true; }
bool isPervertexNV() const { return pervertexNV; }
#endif
bool isPipeInput() const
......@@ -1581,7 +1585,11 @@ public:
virtual int getOuterArraySize() const { return arraySizes->getOuterSize(); }
virtual TIntermTyped* getOuterArrayNode() const { return arraySizes->getOuterNode(); }
virtual int getCumulativeArraySize() const { return arraySizes->getCumulativeSize(); }
#ifdef GLSLANG_WEB
virtual bool isArrayOfArrays() const { return false; }
#else
virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; }
#endif
virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); }
virtual const TArraySizes* getArraySizes() const { return arraySizes; }
virtual TArraySizes* getArraySizes() { return arraySizes; }
......@@ -1719,15 +1727,26 @@ public:
}
#ifdef GLSLANG_WEB
virtual bool containsDouble() const { return false; }
virtual bool contains16BitFloat() const { return false; }
virtual bool contains64BitInt() const { return false; }
virtual bool contains16BitInt() const { return false; }
virtual bool contains8BitInt() const { return false; }
virtual bool containsCoopMat() const { return false; }
virtual bool containsReference() const { return false; }
#else
virtual bool containsDouble() const
{
return containsBasicType(EbtDouble);
}
virtual bool contains16BitFloat() const
{
return containsBasicType(EbtFloat16);
}
virtual bool contains64BitInt() const
{
return containsBasicType(EbtInt64) || containsBasicType(EbtUint64);
}
virtual bool contains16BitInt() const
{
return containsBasicType(EbtInt16) || containsBasicType(EbtUint16);
......@@ -1740,6 +1759,10 @@ public:
{
return contains([](const TType* t) { return t->coopmat; } );
}
virtual bool containsReference() const
{
return containsBasicType(EbtReference);
}
#endif
// Array editing methods. Array descriptors can be shared across
......
......@@ -1101,7 +1101,9 @@ single_declaration
: fully_specified_type {
$$.type = $1;
$$.intermNode = 0;
GLSLANG_WEB_EXCLUDE_ON
parseContext.declareTypeDefaults($$.loc, $$.type);
GLSLANG_WEB_EXCLUDE_OFF
}
| fully_specified_type IDENTIFIER {
$$.type = $1;
......
......@@ -1101,7 +1101,9 @@ single_declaration
: fully_specified_type {
$$.type = $1;
$$.intermNode = 0;
parseContext.declareTypeDefaults($$.loc, $$.type);
}
| fully_specified_type IDENTIFIER {
$$.type = $1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1374,6 +1374,10 @@ const int baseAlignmentVec4Std140 = 16;
// Return value is the alignment..
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
{
#ifdef GLSLANG_WEB
size = 4; return 4;
#endif
switch (type.getBasicType()) {
case EbtInt64:
case EbtUint64:
......
......@@ -615,7 +615,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ungetch();
ppToken->name[len] = '\0';
#ifndef GLSLANG_WEB
if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
if (pp->ifdepth == 0) {
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
......@@ -636,9 +635,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
}
ppToken->ival = (int)ival;
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
} else
#endif
{
} else {
if (ival > 0xffffffffu && !AlreadyComplained)
pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", "");
ppToken->ival = (int)ival;
......@@ -695,6 +692,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ppToken->name[len++] = (char)ch;
isUnsigned = true;
#ifndef GLSLANG_WEB
int nextCh = getch();
if (nextCh == 'l' || nextCh == 'L') {
if (len < MaxTokenLength)
......@@ -703,7 +701,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
} else
ungetch();
#ifndef GLSLANG_WEB
nextCh = getch();
if ((nextCh == 's' || nextCh == 'S') &&
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
......@@ -732,7 +729,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
if (octalOverflow)
pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", "");
#ifndef GLSLANG_WEB
if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
if (pp->ifdepth == 0) {
pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile,
......@@ -753,9 +749,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
}
ppToken->ival = (int)ival;
return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16;
} else
#endif
{
} else {
ppToken->ival = (int)ival;
return isUnsigned ? PpAtomConstUint : PpAtomConstInt;
}
......@@ -787,6 +781,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
ppToken->name[len++] = (char)ch;
isUnsigned = true;
#ifndef GLSLANG_WEB
int nextCh = getch();
if (nextCh == 'l' || nextCh == 'L') {
if (len < MaxTokenLength)
......@@ -795,7 +790,6 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
} else
ungetch();
#ifndef GLSLANG_WEB
nextCh = getch();
if ((nextCh == 's' || nextCh == 'S') &&
pp->parseContext.intermediate.getSource() == EShSourceGlsl) {
......
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