Web: Remove unnecessary GLSL numeric types, and some collateral.
This saves another 40K of x86 binary, which is about 13% of the target size.
This commit is contained in:
		
							parent
							
								
									3e4b6ff76a
								
							
						
					
					
						commit
						39697cdb9d
					
				| @ -2112,6 +2112,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI | ||||
|             spv::Id one = 0; | ||||
|             if (node->getBasicType() == glslang::EbtFloat) | ||||
|                 one = builder.makeFloatConstant(1.0F); | ||||
| #ifndef GLSLANG_WEB | ||||
|             else if (node->getBasicType() == glslang::EbtDouble) | ||||
|                 one = builder.makeDoubleConstant(1.0); | ||||
|             else if (node->getBasicType() == glslang::EbtFloat16) | ||||
| @ -2122,6 +2123,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI | ||||
|                 one = builder.makeInt16Constant(1); | ||||
|             else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) | ||||
|                 one = builder.makeInt64Constant(1); | ||||
| #endif | ||||
|             else | ||||
|                 one = builder.makeIntConstant(1); | ||||
|             glslang::TOperator op; | ||||
| @ -5892,84 +5894,21 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora | ||||
|     int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0; | ||||
| 
 | ||||
|     switch (op) { | ||||
|     case glslang::EOpConvInt8ToBool: | ||||
|     case glslang::EOpConvUint8ToBool: | ||||
|         zero = builder.makeUint8Constant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvInt16ToBool: | ||||
|     case glslang::EOpConvUint16ToBool: | ||||
|         zero = builder.makeUint16Constant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvIntToBool: | ||||
|     case glslang::EOpConvUintToBool: | ||||
|         zero = builder.makeUintConstant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvInt64ToBool: | ||||
|     case glslang::EOpConvUint64ToBool: | ||||
|         zero = builder.makeUint64Constant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
| 
 | ||||
|     case glslang::EOpConvFloatToBool: | ||||
|         zero = builder.makeFloatConstant(0.0F); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); | ||||
| 
 | ||||
|     case glslang::EOpConvDoubleToBool: | ||||
|         zero = builder.makeDoubleConstant(0.0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); | ||||
| 
 | ||||
|     case glslang::EOpConvFloat16ToBool: | ||||
|         zero = builder.makeFloat16Constant(0.0F); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToFloat: | ||||
|         convOp = spv::OpSelect; | ||||
|         zero = builder.makeFloatConstant(0.0F); | ||||
|         one  = builder.makeFloatConstant(1.0F); | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToDouble: | ||||
|         convOp = spv::OpSelect; | ||||
|         zero = builder.makeDoubleConstant(0.0); | ||||
|         one  = builder.makeDoubleConstant(1.0); | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToFloat16: | ||||
|         convOp = spv::OpSelect; | ||||
|         zero = builder.makeFloat16Constant(0.0F); | ||||
|         one = builder.makeFloat16Constant(1.0F); | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToInt8: | ||||
|         zero = builder.makeInt8Constant(0); | ||||
|         one  = builder.makeInt8Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToUint8: | ||||
|         zero = builder.makeUint8Constant(0); | ||||
|         one  = builder.makeUint8Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToInt16: | ||||
|         zero = builder.makeInt16Constant(0); | ||||
|         one  = builder.makeInt16Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToUint16: | ||||
|         zero = builder.makeUint16Constant(0); | ||||
|         one  = builder.makeUint16Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvBoolToInt: | ||||
|     case glslang::EOpConvBoolToInt64: | ||||
|         if (op == glslang::EOpConvBoolToInt64) | ||||
| @ -6030,17 +5969,6 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora | ||||
|         convOp = spv::OpConvertUToF; | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvDoubleToFloat: | ||||
|     case glslang::EOpConvFloatToDouble: | ||||
|     case glslang::EOpConvDoubleToFloat16: | ||||
|     case glslang::EOpConvFloat16ToDouble: | ||||
|     case glslang::EOpConvFloatToFloat16: | ||||
|     case glslang::EOpConvFloat16ToFloat: | ||||
|         convOp = spv::OpFConvert; | ||||
|         if (builder.isMatrixType(destType)) | ||||
|             return createUnaryMatrixOperation(convOp, decorations, destType, operand, typeProxy); | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvFloat16ToInt8: | ||||
|     case glslang::EOpConvFloatToInt8: | ||||
|     case glslang::EOpConvDoubleToInt8: | ||||
| @ -6066,13 +5994,16 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora | ||||
|     case glslang::EOpConvInt64ToUint64: | ||||
|         if (builder.isInSpecConstCodeGenMode()) { | ||||
|             // Build zero scalar or vector for OpIAdd.
 | ||||
| #ifndef GLSLANG_WEB | ||||
|             if(op == glslang::EOpConvUint8ToInt8 || op == glslang::EOpConvInt8ToUint8) { | ||||
|                 zero = builder.makeUint8Constant(0); | ||||
|             } else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) { | ||||
|                 zero = builder.makeUint16Constant(0); | ||||
|             } else if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) { | ||||
|                 zero = builder.makeUint64Constant(0); | ||||
|             } else { | ||||
|             } else | ||||
| #endif | ||||
|             { | ||||
|                 zero = builder.makeUintConstant(0); | ||||
|             } | ||||
|             zero = makeSmearedConstant(zero, vectorSize); | ||||
| @ -6099,6 +6030,71 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora | ||||
|         convOp = spv::OpConvertFToU; | ||||
|         break; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     case glslang::EOpConvInt8ToBool: | ||||
|     case glslang::EOpConvUint8ToBool: | ||||
|         zero = builder.makeUint8Constant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvInt16ToBool: | ||||
|     case glslang::EOpConvUint16ToBool: | ||||
|         zero = builder.makeUint16Constant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvInt64ToBool: | ||||
|     case glslang::EOpConvUint64ToBool: | ||||
|         zero = builder.makeUint64Constant(0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvDoubleToBool: | ||||
|         zero = builder.makeDoubleConstant(0.0); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvFloat16ToBool: | ||||
|         zero = builder.makeFloat16Constant(0.0F); | ||||
|         zero = makeSmearedConstant(zero, vectorSize); | ||||
|         return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); | ||||
|     case glslang::EOpConvBoolToDouble: | ||||
|         convOp = spv::OpSelect; | ||||
|         zero = builder.makeDoubleConstant(0.0); | ||||
|         one  = builder.makeDoubleConstant(1.0); | ||||
|         break; | ||||
|     case glslang::EOpConvBoolToFloat16: | ||||
|         convOp = spv::OpSelect; | ||||
|         zero = builder.makeFloat16Constant(0.0F); | ||||
|         one = builder.makeFloat16Constant(1.0F); | ||||
|         break; | ||||
|     case glslang::EOpConvBoolToInt8: | ||||
|         zero = builder.makeInt8Constant(0); | ||||
|         one  = builder.makeInt8Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
|     case glslang::EOpConvBoolToUint8: | ||||
|         zero = builder.makeUint8Constant(0); | ||||
|         one  = builder.makeUint8Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
|     case glslang::EOpConvBoolToInt16: | ||||
|         zero = builder.makeInt16Constant(0); | ||||
|         one  = builder.makeInt16Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
|     case glslang::EOpConvBoolToUint16: | ||||
|         zero = builder.makeUint16Constant(0); | ||||
|         one  = builder.makeUint16Constant(1); | ||||
|         convOp = spv::OpSelect; | ||||
|         break; | ||||
|     case glslang::EOpConvDoubleToFloat: | ||||
|     case glslang::EOpConvFloatToDouble: | ||||
|     case glslang::EOpConvDoubleToFloat16: | ||||
|     case glslang::EOpConvFloat16ToDouble: | ||||
|     case glslang::EOpConvFloatToFloat16: | ||||
|     case glslang::EOpConvFloat16ToFloat: | ||||
|         convOp = spv::OpFConvert; | ||||
|         if (builder.isMatrixType(destType)) | ||||
|             return createUnaryMatrixOperation(convOp, decorations, destType, operand, typeProxy); | ||||
|         break; | ||||
| 
 | ||||
|     case glslang::EOpConvInt8ToInt16: | ||||
|     case glslang::EOpConvInt8ToInt: | ||||
|     case glslang::EOpConvInt8ToInt64: | ||||
| @ -6209,6 +6205,8 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora | ||||
|     case glslang::EOpConvPtrToUint64: | ||||
|         convOp = spv::OpConvertPtrToU; | ||||
|         break; | ||||
| #endif | ||||
| 
 | ||||
|     default: | ||||
|         break; | ||||
|     } | ||||
| @ -6396,8 +6394,6 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
| 
 | ||||
| // Create group invocation operations.
 | ||||
| spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy) | ||||
| { | ||||
| @ -7001,7 +6997,6 @@ spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, s | ||||
| 
 | ||||
|     return builder.createOp(opCode, typeId, spvGroupOperands); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector<spv::Id>& operands, glslang::TBasicType typeProxy) | ||||
| { | ||||
| @ -7825,6 +7820,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla | ||||
|         for (unsigned int i = 0; i < (unsigned int)glslangType.getVectorSize(); ++i) { | ||||
|             bool zero = nextConst >= consts.size(); | ||||
|             switch (glslangType.getBasicType()) { | ||||
|             case glslang::EbtInt: | ||||
|                 spvConsts.push_back(builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst())); | ||||
|                 break; | ||||
|             case glslang::EbtUint: | ||||
|                 spvConsts.push_back(builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst())); | ||||
|                 break; | ||||
|             case glslang::EbtFloat: | ||||
|                 spvConsts.push_back(builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst())); | ||||
|                 break; | ||||
|             case glslang::EbtBool: | ||||
|                 spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst())); | ||||
|                 break; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case glslang::EbtInt8: | ||||
|                 spvConsts.push_back(builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const())); | ||||
|                 break; | ||||
| @ -7837,30 +7845,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla | ||||
|             case glslang::EbtUint16: | ||||
|                 spvConsts.push_back(builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const())); | ||||
|                 break; | ||||
|             case glslang::EbtInt: | ||||
|                 spvConsts.push_back(builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst())); | ||||
|                 break; | ||||
|             case glslang::EbtUint: | ||||
|                 spvConsts.push_back(builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst())); | ||||
|                 break; | ||||
|             case glslang::EbtInt64: | ||||
|                 spvConsts.push_back(builder.makeInt64Constant(zero ? 0 : consts[nextConst].getI64Const())); | ||||
|                 break; | ||||
|             case glslang::EbtUint64: | ||||
|                 spvConsts.push_back(builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const())); | ||||
|                 break; | ||||
|             case glslang::EbtFloat: | ||||
|                 spvConsts.push_back(builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst())); | ||||
|                 break; | ||||
|             case glslang::EbtDouble: | ||||
|                 spvConsts.push_back(builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst())); | ||||
|                 break; | ||||
|             case glslang::EbtFloat16: | ||||
|                 spvConsts.push_back(builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst())); | ||||
|                 break; | ||||
|             case glslang::EbtBool: | ||||
|                 spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst())); | ||||
|                 break; | ||||
| #endif | ||||
|             default: | ||||
|                 assert(0); | ||||
|                 break; | ||||
| @ -7872,6 +7869,19 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla | ||||
|         bool zero = nextConst >= consts.size(); | ||||
|         spv::Id scalar = 0; | ||||
|         switch (glslangType.getBasicType()) { | ||||
|         case glslang::EbtInt: | ||||
|             scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtUint: | ||||
|             scalar = builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtFloat: | ||||
|             scalar = builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtBool: | ||||
|             scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant); | ||||
|             break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case glslang::EbtInt8: | ||||
|             scalar = builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const(), specConstant); | ||||
|             break; | ||||
| @ -7884,34 +7894,23 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla | ||||
|         case glslang::EbtUint16: | ||||
|             scalar = builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtInt: | ||||
|             scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtUint: | ||||
|             scalar = builder.makeUintConstant(zero ? 0 : consts[nextConst].getUConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtInt64: | ||||
|             scalar = builder.makeInt64Constant(zero ? 0 : consts[nextConst].getI64Const(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtUint64: | ||||
|             scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtFloat: | ||||
|             scalar = builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtDouble: | ||||
|             scalar = builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtFloat16: | ||||
|             scalar = builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtBool: | ||||
|             scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant); | ||||
|             break; | ||||
|         case glslang::EbtReference: | ||||
|             scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant); | ||||
|             scalar = builder.createUnaryOp(spv::OpBitcast, typeId, scalar); | ||||
|             break; | ||||
| #endif | ||||
|         default: | ||||
|             assert(0); | ||||
|             break; | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
| @ -213,6 +213,28 @@ public: | ||||
|             return false; | ||||
| 
 | ||||
|         switch (type) { | ||||
|         case EbtInt: | ||||
|             if (constant.iConst == iConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtUint: | ||||
|             if (constant.uConst == uConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtBool: | ||||
|             if (constant.bConst == bConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtDouble: | ||||
|             if (constant.dConst == dConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt16: | ||||
|             if (constant.i16Const == i16Const) | ||||
|                 return true; | ||||
| @ -232,16 +254,6 @@ public: | ||||
|             if (constant.u8Const == u8Const) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtInt: | ||||
|             if (constant.iConst == iConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtUint: | ||||
|             if (constant.uConst == uConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtInt64: | ||||
|             if (constant.i64Const == i64Const) | ||||
| @ -253,16 +265,7 @@ public: | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtDouble: | ||||
|             if (constant.dConst == dConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
|         case EbtBool: | ||||
|             if (constant.bConst == bConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             break; | ||||
| #endif | ||||
|         default: | ||||
|             assert(false && "Default missing"); | ||||
|         } | ||||
| @ -329,6 +332,22 @@ public: | ||||
|     { | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt: | ||||
|             if (iConst > constant.iConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtUint: | ||||
|             if (uConst > constant.uConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtDouble: | ||||
|             if (dConst > constant.dConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8: | ||||
|             if (i8Const > constant.i8Const) | ||||
|                 return true; | ||||
| @ -348,16 +367,6 @@ public: | ||||
|             if (u16Const > constant.u16Const) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtInt: | ||||
|             if (iConst > constant.iConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtUint: | ||||
|             if (uConst > constant.uConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtInt64: | ||||
|             if (i64Const > constant.i64Const) | ||||
| @ -369,11 +378,7 @@ public: | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtDouble: | ||||
|             if (dConst > constant.dConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
| #endif | ||||
|         default: | ||||
|             assert(false && "Default missing"); | ||||
|             return false; | ||||
| @ -384,6 +389,7 @@ public: | ||||
|     { | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8: | ||||
|             if (i8Const < constant.i8Const) | ||||
|                 return true; | ||||
| @ -394,7 +400,7 @@ public: | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|        case EbtInt16: | ||||
|         case EbtInt16: | ||||
|             if (i16Const < constant.i16Const) | ||||
|                 return true; | ||||
| 
 | ||||
| @ -402,17 +408,6 @@ public: | ||||
|         case EbtUint16: | ||||
|             if (u16Const < constant.u16Const) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtInt: | ||||
|             if (iConst < constant.iConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtUint: | ||||
|             if (uConst < constant.uConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtInt64: | ||||
|             if (i64Const < constant.i64Const) | ||||
| @ -424,10 +419,21 @@ public: | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
| #endif | ||||
|         case EbtDouble: | ||||
|             if (dConst < constant.dConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtInt: | ||||
|             if (iConst < constant.iConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         case EbtUint: | ||||
|             if (uConst < constant.uConst) | ||||
|                 return true; | ||||
| 
 | ||||
|             return false; | ||||
|         default: | ||||
|             assert(false && "Default missing"); | ||||
| @ -440,15 +446,17 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst + constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst + constant.uConst); break; | ||||
|         case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const + constant.i8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(i16Const + constant.i16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst + constant.iConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const + constant.i64Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const + constant.u8Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst + constant.uConst); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break; | ||||
|         case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; | ||||
| #endif | ||||
|         default: assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -460,15 +468,17 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst - constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst - constant.uConst); break; | ||||
|         case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const - constant.i8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(i16Const - constant.i16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst - constant.iConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const - constant.i64Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const - constant.u8Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst - constant.uConst); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break; | ||||
|         case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; | ||||
| #endif | ||||
|         default: assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -480,15 +490,17 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst * constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst * constant.uConst); break; | ||||
|         case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const * constant.i8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(i16Const * constant.i16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst * constant.iConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const * constant.i64Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const * constant.u8Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst * constant.uConst); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break; | ||||
|         case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; | ||||
| #endif | ||||
|         default: assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -500,14 +512,16 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst % constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst % constant.uConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const % constant.i8Const); break; | ||||
|         case EbtInt16:  returnValue.setI8Const(i8Const % constant.i16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst % constant.iConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const % constant.i64Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const % constant.u8Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst % constant.uConst); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; | ||||
| #endif | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -518,6 +532,7 @@ public: | ||||
|     { | ||||
|         TConstUnion returnValue; | ||||
|         switch (type) { | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt8:   returnValue.setI8Const(i8Const >> constant.i8Const);  break; | ||||
| @ -570,32 +585,38 @@ public: | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
| #endif | ||||
|         case EbtInt: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt:    returnValue.setIConst(iConst >> constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setIConst(iConst >> constant.uConst);   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt8:   returnValue.setIConst(iConst >> constant.i8Const);  break; | ||||
|             case EbtUint8:  returnValue.setIConst(iConst >> constant.u8Const);  break; | ||||
|             case EbtInt16:  returnValue.setIConst(iConst >> constant.i16Const); break; | ||||
|             case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break; | ||||
|             case EbtInt:    returnValue.setIConst(iConst >> constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setIConst(iConst >> constant.uConst);   break; | ||||
|             case EbtInt64:  returnValue.setIConst(iConst >> constant.i64Const); break; | ||||
|             case EbtUint64: returnValue.setIConst(iConst >> constant.u64Const); break; | ||||
| #endif | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
|         case EbtUint: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt:    returnValue.setUConst(uConst >> constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setUConst(uConst >> constant.uConst);   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt8:   returnValue.setUConst(uConst >> constant.i8Const);  break; | ||||
|             case EbtUint8:  returnValue.setUConst(uConst >> constant.u8Const);  break; | ||||
|             case EbtInt16:  returnValue.setUConst(uConst >> constant.i16Const); break; | ||||
|             case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break; | ||||
|             case EbtInt:    returnValue.setUConst(uConst >> constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setUConst(uConst >> constant.uConst);   break; | ||||
|             case EbtInt64:  returnValue.setUConst(uConst >> constant.i64Const); break; | ||||
|             case EbtUint64: returnValue.setUConst(uConst >> constant.u64Const); break; | ||||
| #endif | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
| #ifndef GLSLANG_WEB | ||||
|          case EbtInt64: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt8:   returnValue.setI64Const(i64Const >> constant.i8Const);  break; | ||||
| @ -622,6 +643,7 @@ public: | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
| #endif | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -632,6 +654,7 @@ public: | ||||
|     { | ||||
|         TConstUnion returnValue; | ||||
|         switch (type) { | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt8:   returnValue.setI8Const(i8Const << constant.i8Const);  break; | ||||
| @ -684,32 +707,6 @@ public: | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
|         case EbtInt: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt8:   returnValue.setIConst(iConst << constant.i8Const);  break; | ||||
|             case EbtUint8:  returnValue.setIConst(iConst << constant.u8Const);  break; | ||||
|             case EbtInt16:  returnValue.setIConst(iConst << constant.i16Const); break; | ||||
|             case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; | ||||
|             case EbtInt:    returnValue.setIConst(iConst << constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setIConst(iConst << constant.uConst);   break; | ||||
|             case EbtInt64:  returnValue.setIConst(iConst << constant.i64Const); break; | ||||
|             case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
|         case EbtUint: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt8:   returnValue.setUConst(uConst << constant.i8Const);  break; | ||||
|             case EbtUint8:  returnValue.setUConst(uConst << constant.u8Const);  break; | ||||
|             case EbtInt16:  returnValue.setUConst(uConst << constant.i16Const); break; | ||||
|             case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; | ||||
|             case EbtInt:    returnValue.setUConst(uConst << constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setUConst(uConst << constant.uConst);   break; | ||||
|             case EbtInt64:  returnValue.setUConst(uConst << constant.i64Const); break; | ||||
|             case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
|          case EbtInt64: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt8:   returnValue.setI64Const(i64Const << constant.i8Const);  break; | ||||
| @ -736,6 +733,37 @@ public: | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
| #endif | ||||
|         case EbtInt: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt:    returnValue.setIConst(iConst << constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setIConst(iConst << constant.uConst);   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt8:   returnValue.setIConst(iConst << constant.i8Const);  break; | ||||
|             case EbtUint8:  returnValue.setIConst(iConst << constant.u8Const);  break; | ||||
|             case EbtInt16:  returnValue.setIConst(iConst << constant.i16Const); break; | ||||
|             case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; | ||||
|             case EbtInt64:  returnValue.setIConst(iConst << constant.i64Const); break; | ||||
|             case EbtUint64: returnValue.setIConst(iConst << constant.u64Const); break; | ||||
| #endif | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
|         case EbtUint: | ||||
|             switch (constant.type) { | ||||
|             case EbtInt:    returnValue.setUConst(uConst << constant.iConst);   break; | ||||
|             case EbtUint:   returnValue.setUConst(uConst << constant.uConst);   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt8:   returnValue.setUConst(uConst << constant.i8Const);  break; | ||||
|             case EbtUint8:  returnValue.setUConst(uConst << constant.u8Const);  break; | ||||
|             case EbtInt16:  returnValue.setUConst(uConst << constant.i16Const); break; | ||||
|             case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; | ||||
|             case EbtInt64:  returnValue.setUConst(uConst << constant.i64Const); break; | ||||
|             case EbtUint64: returnValue.setUConst(uConst << constant.u64Const); break; | ||||
| #endif | ||||
|             default:       assert(false && "Default missing"); | ||||
|             } | ||||
|             break; | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -747,14 +775,16 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst & constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst & constant.uConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const & constant.i8Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const & constant.u8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(i16Const & constant.i16Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst & constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst & constant.uConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const & constant.i64Const); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break; | ||||
| #endif | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -766,14 +796,16 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst | constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst | constant.uConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const | constant.i8Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const | constant.u8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(i16Const | constant.i16Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst | constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst | constant.uConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const | constant.i64Const); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break; | ||||
| #endif | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -785,14 +817,16 @@ public: | ||||
|         TConstUnion returnValue; | ||||
|         assert(type == constant.type); | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(iConst ^ constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst ^ constant.uConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(i8Const ^ constant.i8Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(u8Const ^ constant.u8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(i16Const ^ constant.i16Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(iConst ^ constant.iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(uConst ^ constant.uConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(i64Const ^ constant.i64Const); break; | ||||
|         case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break; | ||||
| #endif | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
| @ -803,14 +837,16 @@ public: | ||||
|     { | ||||
|         TConstUnion returnValue; | ||||
|         switch (type) { | ||||
|         case EbtInt:    returnValue.setIConst(~iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(~uConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:   returnValue.setI8Const(~i8Const); break; | ||||
|         case EbtUint8:  returnValue.setU8Const(~u8Const); break; | ||||
|         case EbtInt16:  returnValue.setI16Const(~i16Const); break; | ||||
|         case EbtUint16: returnValue.setU16Const(~u16Const); break; | ||||
|         case EbtInt:    returnValue.setIConst(~iConst); break; | ||||
|         case EbtUint:   returnValue.setUConst(~uConst); break; | ||||
|         case EbtInt64:  returnValue.setI64Const(~i64Const); break; | ||||
|         case EbtUint64: returnValue.setU64Const(~u64Const); break; | ||||
| #endif | ||||
|         default:     assert(false && "Default missing"); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -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
 | ||||
|  | ||||
| @ -189,6 +189,24 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right | ||||
|                 else | ||||
|                     newConstArray[i].setDConst((double)NAN); | ||||
|                 break; | ||||
| 
 | ||||
|             case EbtInt: | ||||
|                 if (rightUnionArray[i] == 0) | ||||
|                     newConstArray[i].setIConst(0x7FFFFFFF); | ||||
|                 else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll) | ||||
|                     newConstArray[i].setIConst((int)-0x80000000ll); | ||||
|                 else | ||||
|                     newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); | ||||
|                 break; | ||||
| 
 | ||||
|             case EbtUint: | ||||
|                 if (rightUnionArray[i] == 0u) | ||||
|                     newConstArray[i].setUConst(0xFFFFFFFFu); | ||||
|                 else | ||||
|                     newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); | ||||
|                 break; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt8: | ||||
|                 if (rightUnionArray[i] == (signed char)0) | ||||
|                     newConstArray[i].setI8Const((signed char)0x7F); | ||||
| @ -221,22 +239,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right | ||||
|                     newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const()); | ||||
|                 break; | ||||
| 
 | ||||
|             case EbtInt: | ||||
|                 if (rightUnionArray[i] == 0) | ||||
|                     newConstArray[i].setIConst(0x7FFFFFFF); | ||||
|                 else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll) | ||||
|                     newConstArray[i].setIConst((int)-0x80000000ll); | ||||
|                 else | ||||
|                     newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); | ||||
|                 break; | ||||
| 
 | ||||
|             case EbtUint: | ||||
|                 if (rightUnionArray[i] == 0u) | ||||
|                     newConstArray[i].setUConst(0xFFFFFFFFu); | ||||
|                 else | ||||
|                     newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); | ||||
|                 break; | ||||
| 
 | ||||
|             case EbtInt64: | ||||
|                 if (rightUnionArray[i] == 0ll) | ||||
|                     newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); | ||||
| @ -254,6 +256,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right | ||||
|                 break; | ||||
|             default: | ||||
|                 return 0; | ||||
| #endif | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
| @ -526,14 +529,16 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             case EbtDouble: | ||||
|             case EbtFloat16: | ||||
|             case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break; | ||||
|             case EbtInt:   newConstArray[i].setIConst(-unionArray[i].getIConst()); break; | ||||
|             case EbtUint:  newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst())));  break; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt8:  newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break; | ||||
|             case EbtUint8: newConstArray[i].setU8Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU8Const())));  break; | ||||
|             case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break; | ||||
|             case EbtUint16:newConstArray[i].setU16Const(static_cast<unsigned int>(-static_cast<signed int>(unionArray[i].getU16Const())));  break; | ||||
|             case EbtInt:   newConstArray[i].setIConst(-unionArray[i].getIConst()); break; | ||||
|             case EbtUint:  newConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst())));  break; | ||||
|             case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; | ||||
|             case EbtUint64: newConstArray[i].setU64Const(static_cast<unsigned long long>(-static_cast<long long>(unionArray[i].getU64Const())));  break; | ||||
| #endif | ||||
|             default: | ||||
|                 return nullptr; | ||||
|             } | ||||
| @ -668,6 +673,48 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             break; | ||||
|         } | ||||
| 
 | ||||
|         case EOpConvIntToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break; | ||||
|         case EOpConvUintToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break; | ||||
|         case EOpConvBoolToInt: | ||||
|             newConstArray[i].setIConst(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToUint: | ||||
|             newConstArray[i].setUConst(unionArray[i].getBConst()); break; | ||||
|         case EOpConvIntToUint: | ||||
|             newConstArray[i].setUConst(unionArray[i].getIConst()); break; | ||||
|         case EOpConvUintToInt: | ||||
|             newConstArray[i].setIConst(unionArray[i].getUConst()); break; | ||||
| 
 | ||||
|         case EOpConvFloatToBool: | ||||
|         case EOpConvDoubleToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; | ||||
| 
 | ||||
|         case EOpConvBoolToFloat: | ||||
|         case EOpConvBoolToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getBConst()); break; | ||||
| 
 | ||||
|         case EOpConvIntToFloat: | ||||
|         case EOpConvIntToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getIConst()); break; | ||||
| 
 | ||||
|         case EOpConvUintToFloat: | ||||
|         case EOpConvUintToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getUConst()); break; | ||||
| 
 | ||||
|         case EOpConvDoubleToFloat: | ||||
|         case EOpConvFloatToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getDConst()); break; | ||||
| 
 | ||||
|         case EOpConvFloatToUint: | ||||
|         case EOpConvDoubleToUint: | ||||
|             newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break; | ||||
| 
 | ||||
|         case EOpConvFloatToInt: | ||||
|         case EOpConvDoubleToInt: | ||||
|             newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EOpConvInt8ToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break; | ||||
|         case EOpConvUint8ToBool: | ||||
| @ -676,20 +723,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break; | ||||
|         case EOpConvUint16ToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break; | ||||
|         case EOpConvIntToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break; | ||||
|         case EOpConvUintToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break; | ||||
|         case EOpConvInt64ToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break; | ||||
|         case EOpConvUint64ToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break; | ||||
|         case EOpConvFloat16ToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; | ||||
|         case EOpConvFloatToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; | ||||
|         case EOpConvDoubleToBool: | ||||
|             newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; | ||||
| 
 | ||||
|         case EOpConvBoolToInt8: | ||||
|             newConstArray[i].setI8Const(unionArray[i].getBConst()); break; | ||||
| @ -699,20 +738,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             newConstArray[i].setI16Const(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToUint16: | ||||
|             newConstArray[i].setU16Const(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToInt: | ||||
|             newConstArray[i].setIConst(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToUint: | ||||
|             newConstArray[i].setUConst(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToInt64: | ||||
|             newConstArray[i].setI64Const(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToUint64: | ||||
|             newConstArray[i].setU64Const(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToFloat16: | ||||
|             newConstArray[i].setDConst(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToFloat: | ||||
|             newConstArray[i].setDConst(unionArray[i].getBConst()); break; | ||||
|         case EOpConvBoolToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getBConst()); break; | ||||
| 
 | ||||
|         case EOpConvInt8ToInt16: | ||||
|             newConstArray[i].setI16Const(unionArray[i].getI8Const()); break; | ||||
| @ -807,8 +838,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             newConstArray[i].setU8Const((unsigned char)unionArray[i].getIConst()); break; | ||||
|         case EOpConvIntToUint16: | ||||
|             newConstArray[i].setU16Const((unsigned char)unionArray[i].getIConst()); break; | ||||
|         case EOpConvIntToUint: | ||||
|             newConstArray[i].setUConst(unionArray[i].getIConst()); break; | ||||
|         case EOpConvIntToUint64: | ||||
|             newConstArray[i].setU64Const(unionArray[i].getIConst()); break; | ||||
| 
 | ||||
| @ -816,8 +845,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             newConstArray[i].setI8Const((signed char)unionArray[i].getUConst()); break; | ||||
|         case EOpConvUintToInt16: | ||||
|             newConstArray[i].setI16Const((signed short)unionArray[i].getUConst()); break; | ||||
|         case EOpConvUintToInt: | ||||
|             newConstArray[i].setIConst(unionArray[i].getUConst()); break; | ||||
|         case EOpConvUintToInt64: | ||||
|             newConstArray[i].setI64Const(unionArray[i].getUConst()); break; | ||||
|         case EOpConvUintToUint8: | ||||
| @ -828,16 +855,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             newConstArray[i].setU64Const(unionArray[i].getUConst()); break; | ||||
|         case EOpConvIntToFloat16: | ||||
|             newConstArray[i].setDConst(unionArray[i].getIConst()); break; | ||||
|         case EOpConvIntToFloat: | ||||
|             newConstArray[i].setDConst(unionArray[i].getIConst()); break; | ||||
|         case EOpConvIntToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getIConst()); break; | ||||
|         case EOpConvUintToFloat16: | ||||
|             newConstArray[i].setDConst(unionArray[i].getUConst()); break; | ||||
|         case EOpConvUintToFloat: | ||||
|             newConstArray[i].setDConst(unionArray[i].getUConst()); break; | ||||
|         case EOpConvUintToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getUConst()); break; | ||||
|         case EOpConvInt64ToInt8: | ||||
|             newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getI64Const())); break; | ||||
|         case EOpConvInt64ToInt16: | ||||
| @ -902,48 +921,35 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) | ||||
|             newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToInt16: | ||||
|             newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToInt: | ||||
|             newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToInt64: | ||||
|             newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToUint8: | ||||
|             newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToUint16: | ||||
|             newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToUint: | ||||
|             newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToUint64: | ||||
|             newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvFloatToFloat16: | ||||
|             newConstArray[i].setDConst(unionArray[i].getDConst()); break; | ||||
|         case EOpConvFloatToDouble: | ||||
|             newConstArray[i].setDConst(unionArray[i].getDConst()); break; | ||||
|         case EOpConvDoubleToInt8: | ||||
|             newConstArray[i].setI8Const(static_cast<signed char>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToInt16: | ||||
|             newConstArray[i].setI16Const(static_cast<signed short>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToInt: | ||||
|             newConstArray[i].setIConst(static_cast<int>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToInt64: | ||||
|             newConstArray[i].setI64Const(static_cast<long long>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToUint8: | ||||
|             newConstArray[i].setU8Const(static_cast<unsigned char>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToUint16: | ||||
|             newConstArray[i].setU16Const(static_cast<unsigned short>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToUint: | ||||
|             newConstArray[i].setUConst(static_cast<unsigned int>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToUint64: | ||||
|             newConstArray[i].setU64Const(static_cast<unsigned long long>(unionArray[i].getDConst())); break; | ||||
|         case EOpConvDoubleToFloat16: | ||||
|             newConstArray[i].setDConst(unionArray[i].getDConst()); break; | ||||
|         case EOpConvDoubleToFloat: | ||||
|             newConstArray[i].setDConst(unionArray[i].getDConst()); break; | ||||
|         case EOpConvPtrToUint64: | ||||
|         case EOpConvUint64ToPtr: | ||||
|         case EOpConstructReference: | ||||
|             newConstArray[i].setU64Const(unionArray[i].getU64Const()); break; | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
|         // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out
 | ||||
| 
 | ||||
| @ -1075,6 +1081,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                 case EbtDouble: | ||||
|                     newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); | ||||
|                     break; | ||||
|                 case EbtInt: | ||||
|                     newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); | ||||
|                     break; | ||||
|                 case EbtUint: | ||||
|                     newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); | ||||
|                     break; | ||||
| #ifndef GLSLANG_WEB | ||||
|                 case EbtInt8: | ||||
|                     newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); | ||||
|                     break; | ||||
| @ -1087,18 +1100,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                 case EbtUint16: | ||||
|                     newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const())); | ||||
|                     break; | ||||
|                 case EbtInt: | ||||
|                     newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); | ||||
|                     break; | ||||
|                 case EbtUint: | ||||
|                     newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); | ||||
|                     break; | ||||
|                 case EbtInt64: | ||||
|                     newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); | ||||
|                     break; | ||||
|                 case EbtUint64: | ||||
|                     newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); | ||||
|                     break; | ||||
| #endif | ||||
|                 default: assert(false && "Default missing"); | ||||
|                 } | ||||
|                 break; | ||||
| @ -1109,6 +1117,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                 case EbtDouble: | ||||
|                     newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); | ||||
|                     break; | ||||
|                 case EbtInt: | ||||
|                     newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); | ||||
|                     break; | ||||
|                 case EbtUint: | ||||
|                     newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); | ||||
|                     break; | ||||
| #ifndef GLSLANG_WEB | ||||
|                 case EbtInt8: | ||||
|                     newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); | ||||
|                     break; | ||||
| @ -1121,18 +1136,13 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                 case EbtUint16: | ||||
|                     newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const())); | ||||
|                     break; | ||||
|                 case EbtInt: | ||||
|                     newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); | ||||
|                     break; | ||||
|                 case EbtUint: | ||||
|                     newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); | ||||
|                     break; | ||||
|                 case EbtInt64: | ||||
|                     newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); | ||||
|                     break; | ||||
|                 case EbtUint64: | ||||
|                     newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); | ||||
|                     break; | ||||
| #endif | ||||
|                 default: assert(false && "Default missing"); | ||||
|                 } | ||||
|                 break; | ||||
| @ -1144,6 +1154,11 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                     newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()), | ||||
|                                                                                                                childConstUnions[2][arg2comp].getDConst())); | ||||
|                     break; | ||||
|                 case EbtUint: | ||||
|                     newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), | ||||
|                                                                                                                    childConstUnions[2][arg2comp].getUConst())); | ||||
|                     break; | ||||
| #ifndef GLSLANG_WEB | ||||
|                 case EbtInt8: | ||||
|                     newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()), | ||||
|                                                                                                                    childConstUnions[2][arg2comp].getI8Const())); | ||||
| @ -1164,10 +1179,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                     newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), | ||||
|                                                                                                                    childConstUnions[2][arg2comp].getIConst())); | ||||
|                     break; | ||||
|                 case EbtUint: | ||||
|                     newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), | ||||
|                                                                                                                    childConstUnions[2][arg2comp].getUConst())); | ||||
|                     break; | ||||
|                 case EbtInt64: | ||||
|                     newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()), | ||||
|                                                                                                                        childConstUnions[2][arg2comp].getI64Const())); | ||||
| @ -1176,6 +1187,7 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) | ||||
|                     newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), | ||||
|                                                                                                                        childConstUnions[2][arg2comp].getU64Const())); | ||||
|                     break; | ||||
| #endif | ||||
|                 default: assert(false && "Default missing"); | ||||
|                 } | ||||
|                 break; | ||||
|  | ||||
| @ -216,7 +216,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn | ||||
|         node->getWritableType().getQualifier().makeSpecConstant(); | ||||
| 
 | ||||
|     // If must propagate nonuniform, make a nonuniform.
 | ||||
|     if ((node->getLeft()->getQualifier().nonUniform || node->getRight()->getQualifier().nonUniform) && | ||||
|     if ((node->getLeft()->getQualifier().isNonUniform() || node->getRight()->getQualifier().isNonUniform()) && | ||||
|             isNonuniformPropagating(node->getOp())) | ||||
|         node->getWritableType().getQualifier().nonUniform = true; | ||||
| 
 | ||||
| @ -449,7 +449,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo | ||||
|         node->getWritableType().getQualifier().makeSpecConstant(); | ||||
| 
 | ||||
|     // If must propagate nonuniform, make a nonuniform.
 | ||||
|     if (node->getOperand()->getQualifier().nonUniform && isNonuniformPropagating(node->getOp())) | ||||
|     if (node->getOperand()->getQualifier().isNonUniform() && isNonuniformPropagating(node->getOp())) | ||||
|         node->getWritableType().getQualifier().nonUniform = true; | ||||
| 
 | ||||
|     return node; | ||||
| @ -607,16 +607,17 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped | ||||
|     } | ||||
| 
 | ||||
|     switch (convertTo) { | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EbtDouble: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtUint:    newOp = EOpConvUintToDouble;    break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToDouble;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToDouble;   break; | ||||
|         case EbtInt:     newOp = EOpConvIntToDouble;     break; | ||||
|         case EbtInt8:    newOp = EOpConvInt8ToDouble;    break; | ||||
|         case EbtUint8:   newOp = EOpConvUint8ToDouble;   break; | ||||
|         case EbtInt16:   newOp = EOpConvInt16ToDouble;   break; | ||||
|         case EbtUint16:  newOp = EOpConvUint16ToDouble;  break; | ||||
|         case EbtInt:     newOp = EOpConvIntToDouble;     break; | ||||
|         case EbtUint:    newOp = EOpConvUintToDouble;    break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToDouble;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToDouble;   break; | ||||
|         case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; | ||||
|         case EbtInt64:   newOp = EOpConvInt64ToDouble;   break; | ||||
|         case EbtUint64:  newOp = EOpConvUint64ToDouble;  break; | ||||
| @ -624,23 +625,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #endif | ||||
|     case EbtFloat: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtInt:     newOp = EOpConvIntToFloat;     break; | ||||
|         case EbtUint:    newOp = EOpConvUintToFloat;    break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToFloat;    break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtDouble:  newOp = EOpConvDoubleToFloat;  break; | ||||
|         case EbtInt8:    newOp = EOpConvInt8ToFloat;    break; | ||||
|         case EbtUint8:   newOp = EOpConvUint8ToFloat;   break; | ||||
|         case EbtInt16:   newOp = EOpConvInt16ToFloat;   break; | ||||
|         case EbtUint16:  newOp = EOpConvUint16ToFloat;  break; | ||||
|         case EbtInt:     newOp = EOpConvIntToFloat;     break; | ||||
|         case EbtUint:    newOp = EOpConvUintToFloat;    break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToFloat;    break; | ||||
|         case EbtDouble:  newOp = EOpConvDoubleToFloat;  break; | ||||
|         case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; | ||||
|         case EbtInt64:   newOp = EOpConvInt64ToFloat;   break; | ||||
|         case EbtUint64:  newOp = EOpConvUint64ToFloat;  break; | ||||
| #endif | ||||
|         default: | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EbtFloat16: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtInt8:   newOp = EOpConvInt8ToFloat16;   break; | ||||
| @ -658,23 +663,27 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #endif | ||||
|     case EbtBool: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtInt:     newOp = EOpConvIntToBool;     break; | ||||
|         case EbtUint:    newOp = EOpConvUintToBool;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToBool;   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtDouble:  newOp = EOpConvDoubleToBool;  break; | ||||
|         case EbtInt8:    newOp = EOpConvInt8ToBool;    break; | ||||
|         case EbtUint8:   newOp = EOpConvUint8ToBool;   break; | ||||
|         case EbtInt16:   newOp = EOpConvInt16ToBool;   break; | ||||
|         case EbtUint16:  newOp = EOpConvUint16ToBool;  break; | ||||
|         case EbtInt:     newOp = EOpConvIntToBool;     break; | ||||
|         case EbtUint:    newOp = EOpConvUintToBool;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToBool;   break; | ||||
|         case EbtDouble:  newOp = EOpConvDoubleToBool;  break; | ||||
|         case EbtFloat16: newOp = EOpConvFloat16ToBool; break; | ||||
|         case EbtInt64:   newOp = EOpConvInt64ToBool;   break; | ||||
|         case EbtUint64:  newOp = EOpConvUint64ToBool;  break; | ||||
| #endif | ||||
|         default: | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EbtInt8: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtUint8:   newOp = EOpConvUint8ToInt8;   break; | ||||
| @ -744,41 +753,47 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #endif | ||||
| 
 | ||||
|     case EbtInt: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtUint:    newOp = EOpConvUintToInt;    break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToInt;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToInt;   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:    newOp = EOpConvInt8ToInt;    break; | ||||
|         case EbtUint8:   newOp = EOpConvUint8ToInt;   break; | ||||
|         case EbtInt16:   newOp = EOpConvInt16ToInt;   break; | ||||
|         case EbtUint16:  newOp = EOpConvUint16ToInt;  break; | ||||
|         case EbtUint:    newOp = EOpConvUintToInt;    break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToInt;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToInt;   break; | ||||
|         case EbtDouble:  newOp = EOpConvDoubleToInt;  break; | ||||
|         case EbtFloat16: newOp = EOpConvFloat16ToInt; break; | ||||
|         case EbtInt64:   newOp = EOpConvInt64ToInt;   break; | ||||
|         case EbtUint64:  newOp = EOpConvUint64ToInt;  break; | ||||
| #endif | ||||
|         default: | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
|     case EbtUint: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtInt:     newOp = EOpConvIntToUint;     break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToUint;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToUint;   break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtInt8:    newOp = EOpConvInt8ToUint;    break; | ||||
|         case EbtUint8:   newOp = EOpConvUint8ToUint;   break; | ||||
|         case EbtInt16:   newOp = EOpConvInt16ToUint;   break; | ||||
|         case EbtUint16:  newOp = EOpConvUint16ToUint;  break; | ||||
|         case EbtInt:     newOp = EOpConvIntToUint;     break; | ||||
|         case EbtBool:    newOp = EOpConvBoolToUint;    break; | ||||
|         case EbtFloat:   newOp = EOpConvFloatToUint;   break; | ||||
|         case EbtDouble:  newOp = EOpConvDoubleToUint;  break; | ||||
|         case EbtFloat16: newOp = EOpConvFloat16ToUint; break; | ||||
|         case EbtInt64:   newOp = EOpConvInt64ToUint;   break; | ||||
|         case EbtUint64:  newOp = EOpConvUint64ToUint;  break; | ||||
| #endif | ||||
|         default: | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EbtInt64: | ||||
|         switch (node->getBasicType()) { | ||||
|         case EbtInt8:    newOp = EOpConvInt8ToInt64;    break; | ||||
| @ -813,6 +828,7 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped | ||||
|             return nullptr; | ||||
|         } | ||||
|         break; | ||||
| #endif | ||||
|     default: | ||||
|         return nullptr; | ||||
|     } | ||||
| @ -1025,6 +1041,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt | ||||
|     case EOpConstructFloat: | ||||
|         promoteTo = EbtFloat; | ||||
|         break; | ||||
|     case EOpConstructInt: | ||||
|         promoteTo = EbtInt; | ||||
|         break; | ||||
|     case EOpConstructUint: | ||||
|         promoteTo = EbtUint; | ||||
|         break; | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EOpConstructDouble: | ||||
|         promoteTo = EbtDouble; | ||||
|         break; | ||||
| @ -1053,18 +1076,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt | ||||
|         canPromoteConstant = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) || | ||||
|                              extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16); | ||||
|         break; | ||||
|     case EOpConstructInt: | ||||
|         promoteTo = EbtInt; | ||||
|         break; | ||||
|     case EOpConstructUint: | ||||
|         promoteTo = EbtUint; | ||||
|         break; | ||||
|     case EOpConstructInt64: | ||||
|         promoteTo = EbtInt64; | ||||
|         break; | ||||
|     case EOpConstructUint64: | ||||
|         promoteTo = EbtUint64; | ||||
|         break; | ||||
| #endif | ||||
| 
 | ||||
|     case EOpLogicalNot: | ||||
| 
 | ||||
| @ -1446,7 +1464,31 @@ bool TIntermediate::isFPPromotion(TBasicType from, TBasicType to) const | ||||
| 
 | ||||
| bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const | ||||
| { | ||||
| #ifdef GLSLANG_WEB | ||||
|     return false; | ||||
| #endif | ||||
| 
 | ||||
|     switch (from) { | ||||
|     case EbtInt: | ||||
|         switch(to) { | ||||
|         case EbtUint: | ||||
|             return version >= 400 || getSource() == EShSourceHlsl; | ||||
|         case EbtInt64: | ||||
|         case EbtUint64: | ||||
|             return true; | ||||
|         default: | ||||
|             break; | ||||
|         } | ||||
|         break; | ||||
|     case EbtUint: | ||||
|         switch(to) { | ||||
|         case EbtInt64: | ||||
|         case EbtUint64: | ||||
|             return true; | ||||
|         default: | ||||
|             break; | ||||
|         } | ||||
|         break; | ||||
|     case EbtInt8: | ||||
|         switch (to) { | ||||
|         case EbtUint8: | ||||
| @ -1493,26 +1535,6 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const | ||||
|             break; | ||||
|         } | ||||
|         break; | ||||
|     case EbtInt: | ||||
|         switch(to) { | ||||
|         case EbtUint: | ||||
|             return version >= 400 || getSource() == EShSourceHlsl; | ||||
|         case EbtInt64: | ||||
|         case EbtUint64: | ||||
|             return true; | ||||
|         default: | ||||
|             break; | ||||
|         } | ||||
|         break; | ||||
|     case EbtUint: | ||||
|         switch(to) { | ||||
|         case EbtInt64: | ||||
|         case EbtUint64: | ||||
|             return true; | ||||
|         default: | ||||
|             break; | ||||
|         } | ||||
|         break; | ||||
|     case EbtInt64: | ||||
|         if (to == EbtUint64) { | ||||
|             return true; | ||||
| @ -1526,6 +1548,10 @@ bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const | ||||
| 
 | ||||
| bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const | ||||
| { | ||||
| #ifdef GLSLANG_WEB | ||||
|     return false; | ||||
| #endif | ||||
| 
 | ||||
|     if (to == EbtFloat && from == EbtFloat16) { | ||||
|         return true; | ||||
|     } else { | ||||
| @ -1578,6 +1604,10 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const | ||||
| //
 | ||||
| bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const | ||||
| { | ||||
| #ifdef GLSLANG_WEB | ||||
|     return false; | ||||
| #endif | ||||
| 
 | ||||
|     if (profile == EEsProfile || version == 110) | ||||
|         return false; | ||||
| 
 | ||||
| @ -1668,13 +1698,11 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|             case EbtFloat: | ||||
|             case EbtDouble: | ||||
|                 return true; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt16: | ||||
|             case EbtUint16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_int16); | ||||
|             case EbtFloat16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_half_float); | ||||
| #endif | ||||
|             default: | ||||
|                 return false; | ||||
|            } | ||||
| @ -1686,7 +1714,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|                  return true; | ||||
|             case EbtBool: | ||||
|                  return (getSource() == EShSourceHlsl); | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt16: | ||||
|             case EbtUint16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_int16); | ||||
| @ -1694,7 +1721,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|                 return  | ||||
|                     extensionRequested(E_GL_AMD_gpu_shader_half_float) || | ||||
|                     getSource() == EShSourceHlsl; | ||||
| #endif | ||||
|             default: | ||||
|                  return false; | ||||
|             } | ||||
| @ -1706,11 +1732,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|                 return true; | ||||
|             case EbtBool: | ||||
|                 return getSource() == EShSourceHlsl; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt16: | ||||
|             case EbtUint16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_int16); | ||||
| #endif | ||||
|             default: | ||||
|                 return false; | ||||
|             } | ||||
| @ -1720,10 +1744,8 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|                 return true; | ||||
|             case EbtBool: | ||||
|                 return getSource() == EShSourceHlsl; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_int16); | ||||
| #endif | ||||
|             default: | ||||
|                 return false; | ||||
|             } | ||||
| @ -1734,11 +1756,9 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|             case EbtInt64: | ||||
|             case EbtUint64: | ||||
|                 return true; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt16: | ||||
|             case EbtUint16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_int16); | ||||
| #endif | ||||
|             default: | ||||
|                 return false; | ||||
|             } | ||||
| @ -1747,14 +1767,11 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|             case EbtInt: | ||||
|             case EbtInt64: | ||||
|                 return true; | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EbtInt16: | ||||
|                 return extensionRequested(E_GL_AMD_gpu_shader_int16); | ||||
| #endif | ||||
|             default: | ||||
|                 return false; | ||||
|             } | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtFloat16: | ||||
|             switch (from) { | ||||
|             case EbtInt16: | ||||
| @ -1775,7 +1792,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|                 break; | ||||
|             } | ||||
|             return false; | ||||
| #endif | ||||
|         default: | ||||
|             return false; | ||||
|         } | ||||
| @ -1784,7 +1800,12 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) { | ||||
| static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) | ||||
| { | ||||
| #ifdef GLSLANG_WEB | ||||
|     return false; | ||||
| #endif | ||||
| 
 | ||||
|     switch(sintType) { | ||||
|     case EbtInt8: | ||||
|         switch(uintType) { | ||||
| @ -1843,7 +1864,13 @@ static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBas | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| static TBasicType getCorrespondingUnsignedType(TBasicType type) { | ||||
| static TBasicType getCorrespondingUnsignedType(TBasicType type) | ||||
| { | ||||
| #ifdef GLSLANG_WEB | ||||
|     assert(type == EbtInt); | ||||
|     return EbtUint; | ||||
| #endif | ||||
| 
 | ||||
|     switch(type) { | ||||
|     case EbtInt8: | ||||
|         return EbtUint8; | ||||
| @ -1889,11 +1916,15 @@ static TBasicType getCorrespondingUnsignedType(TBasicType type) { | ||||
| 
 | ||||
| std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const | ||||
| { | ||||
| #ifdef GLSLANG_WEB | ||||
|     return std::make_tuple(EbtNumTypes, EbtNumTypes); | ||||
| #endif | ||||
| 
 | ||||
|     TBasicType res0 = EbtNumTypes; | ||||
|     TBasicType res1 = EbtNumTypes; | ||||
| 
 | ||||
|     if (profile == EEsProfile || version == 110) | ||||
|         return std::make_tuple(res0, res1);; | ||||
|         return std::make_tuple(res0, res1); | ||||
| 
 | ||||
|     if (getSource() == EShSourceHlsl) { | ||||
|         if (canImplicitlyPromote(type1, type0, op)) { | ||||
| @ -1964,7 +1995,7 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const | ||||
| { | ||||
|     TOperator op = EOpNull; | ||||
| 
 | ||||
|     if (type.getQualifier().nonUniform) | ||||
|     if (type.getQualifier().isNonUniform()) | ||||
|         return EOpConstructNonuniform; | ||||
| 
 | ||||
|     if (type.isCoopMat()) | ||||
| @ -2017,6 +2048,121 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
|     case EbtInt: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
|             case 2: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructIMat2x2; break; | ||||
|                 case 3: op = EOpConstructIMat2x3; break; | ||||
|                 case 4: op = EOpConstructIMat2x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 3: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructIMat3x2; break; | ||||
|                 case 3: op = EOpConstructIMat3x3; break; | ||||
|                 case 4: op = EOpConstructIMat3x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 4: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructIMat4x2; break; | ||||
|                 case 3: op = EOpConstructIMat4x3; break; | ||||
|                 case 4: op = EOpConstructIMat4x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|         } else { | ||||
|             switch(type.getVectorSize()) { | ||||
|             case 1: op = EOpConstructInt;   break; | ||||
|             case 2: op = EOpConstructIVec2; break; | ||||
|             case 3: op = EOpConstructIVec3; break; | ||||
|             case 4: op = EOpConstructIVec4; break; | ||||
|             default: break; // some compilers want this
 | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
|     case EbtUint: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
|             case 2: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructUMat2x2; break; | ||||
|                 case 3: op = EOpConstructUMat2x3; break; | ||||
|                 case 4: op = EOpConstructUMat2x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 3: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructUMat3x2; break; | ||||
|                 case 3: op = EOpConstructUMat3x3; break; | ||||
|                 case 4: op = EOpConstructUMat3x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 4: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructUMat4x2; break; | ||||
|                 case 3: op = EOpConstructUMat4x3; break; | ||||
|                 case 4: op = EOpConstructUMat4x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|         } else { | ||||
|             switch(type.getVectorSize()) { | ||||
|             case 1: op = EOpConstructUint;  break; | ||||
|             case 2: op = EOpConstructUVec2; break; | ||||
|             case 3: op = EOpConstructUVec3; break; | ||||
|             case 4: op = EOpConstructUVec4; break; | ||||
|             default: break; // some compilers want this
 | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
|     case EbtBool: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
|             case 2: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructBMat2x2; break; | ||||
|                 case 3: op = EOpConstructBMat2x3; break; | ||||
|                 case 4: op = EOpConstructBMat2x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 3: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructBMat3x2; break; | ||||
|                 case 3: op = EOpConstructBMat3x3; break; | ||||
|                 case 4: op = EOpConstructBMat3x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 4: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructBMat4x2; break; | ||||
|                 case 3: op = EOpConstructBMat4x3; break; | ||||
|                 case 4: op = EOpConstructBMat4x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|         } else { | ||||
|             switch(type.getVectorSize()) { | ||||
|             case 1:  op = EOpConstructBool;  break; | ||||
|             case 2:  op = EOpConstructBVec2; break; | ||||
|             case 3:  op = EOpConstructBVec3; break; | ||||
|             case 4:  op = EOpConstructBVec4; break; | ||||
|             default: break; // some compilers want this
 | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EbtDouble: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
| @ -2130,82 +2276,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const | ||||
|         default: break; // some compilers want this
 | ||||
|         } | ||||
|         break; | ||||
|     case EbtInt: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
|             case 2: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructIMat2x2; break; | ||||
|                 case 3: op = EOpConstructIMat2x3; break; | ||||
|                 case 4: op = EOpConstructIMat2x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 3: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructIMat3x2; break; | ||||
|                 case 3: op = EOpConstructIMat3x3; break; | ||||
|                 case 4: op = EOpConstructIMat3x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 4: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructIMat4x2; break; | ||||
|                 case 3: op = EOpConstructIMat4x3; break; | ||||
|                 case 4: op = EOpConstructIMat4x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|         } else { | ||||
|             switch(type.getVectorSize()) { | ||||
|             case 1: op = EOpConstructInt;   break; | ||||
|             case 2: op = EOpConstructIVec2; break; | ||||
|             case 3: op = EOpConstructIVec3; break; | ||||
|             case 4: op = EOpConstructIVec4; break; | ||||
|             default: break; // some compilers want this
 | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
|     case EbtUint: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
|             case 2: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructUMat2x2; break; | ||||
|                 case 3: op = EOpConstructUMat2x3; break; | ||||
|                 case 4: op = EOpConstructUMat2x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 3: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructUMat3x2; break; | ||||
|                 case 3: op = EOpConstructUMat3x3; break; | ||||
|                 case 4: op = EOpConstructUMat3x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 4: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructUMat4x2; break; | ||||
|                 case 3: op = EOpConstructUMat4x3; break; | ||||
|                 case 4: op = EOpConstructUMat4x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|         } else { | ||||
|             switch(type.getVectorSize()) { | ||||
|             case 1: op = EOpConstructUint;  break; | ||||
|             case 2: op = EOpConstructUVec2; break; | ||||
|             case 3: op = EOpConstructUVec3; break; | ||||
|             case 4: op = EOpConstructUVec4; break; | ||||
|             default: break; // some compilers want this
 | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
|     case EbtInt64: | ||||
|         switch(type.getVectorSize()) { | ||||
|         case 1: op = EOpConstructInt64;   break; | ||||
| @ -2224,47 +2294,10 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const | ||||
|         default: break; // some compilers want this
 | ||||
|         } | ||||
|         break; | ||||
|     case EbtBool: | ||||
|         if (type.getMatrixCols()) { | ||||
|             switch (type.getMatrixCols()) { | ||||
|             case 2: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructBMat2x2; break; | ||||
|                 case 3: op = EOpConstructBMat2x3; break; | ||||
|                 case 4: op = EOpConstructBMat2x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 3: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructBMat3x2; break; | ||||
|                 case 3: op = EOpConstructBMat3x3; break; | ||||
|                 case 4: op = EOpConstructBMat3x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             case 4: | ||||
|                 switch (type.getMatrixRows()) { | ||||
|                 case 2: op = EOpConstructBMat4x2; break; | ||||
|                 case 3: op = EOpConstructBMat4x3; break; | ||||
|                 case 4: op = EOpConstructBMat4x4; break; | ||||
|                 default: break; // some compilers want this
 | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|         } else { | ||||
|             switch(type.getVectorSize()) { | ||||
|             case 1:  op = EOpConstructBool;  break; | ||||
|             case 2:  op = EOpConstructBVec2; break; | ||||
|             case 3:  op = EOpConstructBVec3; break; | ||||
|             case 4:  op = EOpConstructBVec4; break; | ||||
|             default: break; // some compilers want this
 | ||||
|             } | ||||
|         } | ||||
|         break; | ||||
|     case EbtReference: | ||||
|         op = EOpConstructReference; | ||||
|         break; | ||||
| #endif | ||||
|     default: | ||||
|         break; | ||||
|     } | ||||
| @ -3776,6 +3809,16 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC | ||||
| #define PROMOTE(Set, CType, Get) leftUnionArray[i].Set(static_cast<CType>(rightUnionArray[i].Get())) | ||||
| #define PROMOTE_TO_BOOL(Get) leftUnionArray[i].setBConst(rightUnionArray[i].Get() != 0) | ||||
| 
 | ||||
| #ifdef GLSLANG_WEB | ||||
| #define TO_ALL(Get)   \ | ||||
|         switch (promoteTo) { \ | ||||
|         case EbtFloat: PROMOTE(setDConst, double, Get); break; \ | ||||
|         case EbtInt: PROMOTE(setIConst, int, Get); break; \ | ||||
|         case EbtUint: PROMOTE(setUConst, unsigned int, Get); break; \ | ||||
|         case EbtBool: PROMOTE(setBConst, bool, Get); break; \ | ||||
|         default: return node; \ | ||||
|         } | ||||
| #else | ||||
| #define TO_ALL(Get)   \ | ||||
|         switch (promoteTo) { \ | ||||
|         case EbtFloat16: PROMOTE(setDConst, double, Get); break; \ | ||||
| @ -3792,20 +3835,23 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC | ||||
|         case EbtBool: PROMOTE_TO_BOOL(Get); break; \ | ||||
|         default: return node; \ | ||||
|         } | ||||
| #endif | ||||
| 
 | ||||
|         switch (node->getType().getBasicType()) { | ||||
|         case EbtFloat16: TO_ALL(getDConst); break; | ||||
|         case EbtFloat: TO_ALL(getDConst); break; | ||||
|         case EbtInt: TO_ALL(getIConst); break; | ||||
|         case EbtUint: TO_ALL(getUConst); break; | ||||
|         case EbtBool: TO_ALL(getBConst); break; | ||||
| #ifndef GLSLANG_WEB | ||||
|         case EbtFloat16: TO_ALL(getDConst); break; | ||||
|         case EbtDouble: TO_ALL(getDConst); break; | ||||
|         case EbtInt8: TO_ALL(getI8Const); break; | ||||
|         case EbtInt16: TO_ALL(getI16Const); break; | ||||
|         case EbtInt: TO_ALL(getIConst); break; | ||||
|         case EbtInt64: TO_ALL(getI64Const); break; | ||||
|         case EbtUint8: TO_ALL(getU8Const); break; | ||||
|         case EbtUint16: TO_ALL(getU16Const); break; | ||||
|         case EbtUint: TO_ALL(getUConst); break; | ||||
|         case EbtUint64: TO_ALL(getU64Const); break; | ||||
|         case EbtBool: TO_ALL(getBConst); break; | ||||
| #endif | ||||
|         default: return node; | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -877,15 +877,13 @@ 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; | ||||
|     if (base->getQualifier().isNoContraction()) | ||||
|         result->getWritableType().getQualifier().setNoContraction(); | ||||
| 
 | ||||
|     // Propagate nonuniform
 | ||||
|     if (base->getQualifier().isNonUniform()) | ||||
|         result->getWritableType().getQualifier().nonUniform = true; | ||||
| #endif | ||||
| 
 | ||||
|     return result; | ||||
| } | ||||
| @ -1371,7 +1369,9 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction | ||||
| 
 | ||||
| TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value) | ||||
| { | ||||
| #ifndef GLSLANG_WEB | ||||
|     storage16BitAssignmentCheck(loc, value->getType(), "return"); | ||||
| #endif | ||||
| 
 | ||||
|     functionReturnsValue = true; | ||||
|     if (currentFunctionType->getBasicType() == EbtVoid) { | ||||
| @ -2017,7 +2017,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan | ||||
|         if (!(*argp)[1]->getAsConstantUnion()) | ||||
|             error(loc, "argument must be compile-time constant", "callable data number", ""); | ||||
|         break; | ||||
| #endif | ||||
| 
 | ||||
|     case EOpTextureQuerySamples: | ||||
|     case EOpImageQuerySamples: | ||||
| @ -2098,7 +2097,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan | ||||
|                 error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), ""); | ||||
|         } | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|         if (callNode.getOp() == EOpInterpolateAtVertex) { | ||||
|             if (!arg0->getType().getQualifier().isExplicitInterpolation()) | ||||
|                 error(loc, "argument must be qualified as __explicitInterpAMD in", "interpolant", ""); | ||||
| @ -2112,8 +2110,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| #endif | ||||
| 
 | ||||
|         break; | ||||
| 
 | ||||
|     case EOpEmitStreamVertex: | ||||
| @ -2156,6 +2152,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan | ||||
|             memorySemanticsCheck(loc, fnCandidate, callNode); | ||||
|         } | ||||
|         break; | ||||
| #endif | ||||
| 
 | ||||
|     default: | ||||
|         break; | ||||
| @ -2739,8 +2736,10 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
| 
 | ||||
|     bool constructingMatrix = false; | ||||
|     switch(op) { | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EOpConstructTextureSampler: | ||||
|         return constructorTextureSamplerError(loc, function); | ||||
| #endif | ||||
|     case EOpConstructMat2x2: | ||||
|     case EOpConstructMat2x3: | ||||
|     case EOpConstructMat2x4: | ||||
| @ -2750,6 +2749,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
|     case EOpConstructMat4x2: | ||||
|     case EOpConstructMat4x3: | ||||
|     case EOpConstructMat4x4: | ||||
| #ifndef GLSLANG_WEB | ||||
|     case EOpConstructDMat2x2: | ||||
|     case EOpConstructDMat2x3: | ||||
|     case EOpConstructDMat2x4: | ||||
| @ -2768,6 +2768,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
|     case EOpConstructF16Mat4x2: | ||||
|     case EOpConstructF16Mat4x3: | ||||
|     case EOpConstructF16Mat4x4: | ||||
| #endif | ||||
|         constructingMatrix = true; | ||||
|         break; | ||||
|     default: | ||||
| @ -2820,17 +2821,16 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
|             if (function[arg].type->contains16BitFloat()) { | ||||
|                 requireFloat16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); | ||||
|             } | ||||
|             if (function[arg].type->containsBasicType(EbtUint16) || | ||||
|                 function[arg].type->containsBasicType(EbtInt16)) { | ||||
|             if (function[arg].type->contains16BitInt()) { | ||||
|                 requireInt16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); | ||||
|             } | ||||
|             if (function[arg].type->containsBasicType(EbtUint8) || | ||||
|                 function[arg].type->containsBasicType(EbtInt8)) { | ||||
|             if (function[arg].type->contains8BitInt()) { | ||||
|                 requireInt8Arithmetic(loc, "constructor", "can't construct structure containing 8-bit type"); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     switch (op) { | ||||
|     case EOpConstructFloat16: | ||||
|     case EOpConstructF16Vec2: | ||||
| @ -2870,6 +2870,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
|     default: | ||||
|         break; | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     // inherit constness from children
 | ||||
|     if (constType) { | ||||
| @ -2878,17 +2879,24 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
|         if (specConstType) { | ||||
|             switch (op) { | ||||
|             case EOpConstructInt8: | ||||
|             case EOpConstructUint8: | ||||
|             case EOpConstructInt16: | ||||
|             case EOpConstructUint16: | ||||
|             case EOpConstructInt: | ||||
|             case EOpConstructUint: | ||||
|             case EOpConstructInt64: | ||||
|             case EOpConstructUint64: | ||||
|             case EOpConstructBool: | ||||
|             case EOpConstructBVec2: | ||||
|             case EOpConstructBVec3: | ||||
|             case EOpConstructBVec4: | ||||
|             case EOpConstructIVec2: | ||||
|             case EOpConstructIVec3: | ||||
|             case EOpConstructIVec4: | ||||
|             case EOpConstructUVec2: | ||||
|             case EOpConstructUVec3: | ||||
|             case EOpConstructUVec4: | ||||
| #ifndef GLSLANG_WEB | ||||
|             case EOpConstructUint8: | ||||
|             case EOpConstructInt16: | ||||
|             case EOpConstructUint16: | ||||
|             case EOpConstructInt64: | ||||
|             case EOpConstructUint64: | ||||
|             case EOpConstructI8Vec2: | ||||
|             case EOpConstructI8Vec3: | ||||
|             case EOpConstructI8Vec4: | ||||
| @ -2901,18 +2909,13 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T | ||||
|             case EOpConstructU16Vec2: | ||||
|             case EOpConstructU16Vec3: | ||||
|             case EOpConstructU16Vec4: | ||||
|             case EOpConstructIVec2: | ||||
|             case EOpConstructIVec3: | ||||
|             case EOpConstructIVec4: | ||||
|             case EOpConstructUVec2: | ||||
|             case EOpConstructUVec3: | ||||
|             case EOpConstructUVec4: | ||||
|             case EOpConstructI64Vec2: | ||||
|             case EOpConstructI64Vec3: | ||||
|             case EOpConstructI64Vec4: | ||||
|             case EOpConstructU64Vec2: | ||||
|             case EOpConstructU64Vec3: | ||||
|             case EOpConstructU64Vec4: | ||||
| #endif | ||||
|                 // This was the list of valid ones, if they aren't converting from float
 | ||||
|                 // and aren't making an array.
 | ||||
|                 makeSpecConst = ! floatArgument && ! type.isArray(); | ||||
| @ -3235,7 +3238,7 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     if (!nonuniformOkay && qualifier.nonUniform) | ||||
|     if (!nonuniformOkay && qualifier.isNonUniform()) | ||||
|         error(loc, "for non-parameter, can only apply to 'in' or no storage qualifier", "nonuniformEXT", ""); | ||||
| 
 | ||||
|     invariantCheck(loc, qualifier); | ||||
| @ -3278,23 +3281,15 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali | ||||
|     if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble) | ||||
|         profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output"); | ||||
| 
 | ||||
|     if (!qualifier.flat | ||||
| #ifndef GLSLANG_WEB | ||||
|         && !qualifier.explicitInterp | ||||
|         && !qualifier.pervertexNV | ||||
| #endif | ||||
|         ) { | ||||
|     if (!qualifier.flat && !qualifier.isExplicitInterpolation() && !qualifier.isPervertexNV()) { | ||||
|         if (isTypeInt(publicType.basicType) || | ||||
|             publicType.basicType == EbtDouble || | ||||
|             (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt8)   || | ||||
|                                     publicType.userDef->containsBasicType(EbtUint8)  || | ||||
|                                     publicType.userDef->containsBasicType(EbtInt16)  || | ||||
|                                     publicType.userDef->containsBasicType(EbtUint16) || | ||||
|                                     publicType.userDef->containsBasicType(EbtInt)    || | ||||
|                                     publicType.userDef->containsBasicType(EbtUint)   || | ||||
|                                     publicType.userDef->containsBasicType(EbtInt64)  || | ||||
|                                     publicType.userDef->containsBasicType(EbtUint64) || | ||||
|                                     publicType.userDef->containsBasicType(EbtDouble)))) { | ||||
|             (publicType.userDef && (   publicType.userDef->containsBasicType(EbtInt) | ||||
|                                     || publicType.userDef->containsBasicType(EbtUint) | ||||
|                                     || publicType.userDef->contains16BitInt() | ||||
|                                     || publicType.userDef->contains8BitInt() | ||||
|                                     || publicType.userDef->contains64BitInt() | ||||
|                                     || publicType.userDef->containsDouble()))) { | ||||
|             if (qualifier.storage == EvqVaryingIn && language == EShLangFragment) | ||||
|                 error(loc, "must be qualified as flat", TType::getBasicString(publicType.basicType), GetStorageQualifierString(qualifier.storage)); | ||||
|             else if (qualifier.storage == EvqVaryingOut && language == EShLangVertex && version == 300) | ||||
| @ -3302,13 +3297,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if (qualifier.patch && qualifier.isInterpolation()) | ||||
|     if (qualifier.isPatch() && qualifier.isInterpolation()) | ||||
|         error(loc, "cannot use interpolation qualifiers with patch", "patch", ""); | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     if (qualifier.perTaskNV && publicType.basicType != EbtBlock) | ||||
|     if (qualifier.isTaskMemory() && publicType.basicType != EbtBlock) | ||||
|         error(loc, "taskNV variables can be declared only as blocks", "taskNV", ""); | ||||
| #endif | ||||
| 
 | ||||
|     if (qualifier.storage == EvqVaryingIn) { | ||||
|         switch (language) { | ||||
| @ -3472,6 +3465,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons | ||||
|     if (dst.precision == EpqNone || (force && src.precision != EpqNone)) | ||||
|         dst.precision = src.precision; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     if (!force && ((src.coherent && (dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || | ||||
|                    (src.devicecoherent && (dst.coherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || | ||||
|                    (src.queuefamilycoherent && (dst.coherent || dst.devicecoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || | ||||
| @ -3479,6 +3473,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons | ||||
|                    (src.subgroupcoherent  && (dst.coherent || dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent)))) { | ||||
|         error(loc, "only one coherent/devicecoherent/queuefamilycoherent/workgroupcoherent/subgroupcoherent qualifier allowed", GetPrecisionQualifierString(src.precision), ""); | ||||
|     } | ||||
| #endif | ||||
|     // Layout qualifiers
 | ||||
|     mergeObjectLayoutQualifiers(dst, src, false); | ||||
| 
 | ||||
| @ -3489,6 +3484,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons | ||||
|     MERGE_SINGLETON(centroid); | ||||
|     MERGE_SINGLETON(smooth); | ||||
|     MERGE_SINGLETON(flat); | ||||
|     MERGE_SINGLETON(specConstant); | ||||
| #ifndef GLSLANG_WEB | ||||
|     MERGE_SINGLETON(noContraction); | ||||
|     MERGE_SINGLETON(nopersp); | ||||
| @ -3496,7 +3492,6 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons | ||||
|     MERGE_SINGLETON(perPrimitiveNV); | ||||
|     MERGE_SINGLETON(perViewNV); | ||||
|     MERGE_SINGLETON(perTaskNV); | ||||
| #endif | ||||
|     MERGE_SINGLETON(patch); | ||||
|     MERGE_SINGLETON(sample); | ||||
|     MERGE_SINGLETON(coherent); | ||||
| @ -3509,8 +3504,8 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons | ||||
|     MERGE_SINGLETON(restrict); | ||||
|     MERGE_SINGLETON(readonly); | ||||
|     MERGE_SINGLETON(writeonly); | ||||
|     MERGE_SINGLETON(specConstant); | ||||
|     MERGE_SINGLETON(nonUniform); | ||||
| #endif | ||||
| 
 | ||||
|     if (repeated) | ||||
|         error(loc, "replicated qualifiers", "", ""); | ||||
| @ -3539,12 +3534,14 @@ void TParseContext::setDefaultPrecision(const TSourceLoc& loc, TPublicType& publ | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     if (basicType == EbtAtomicUint) { | ||||
|         if (qualifier != EpqHigh) | ||||
|             error(loc, "can only apply highp to atomic_uint", "precision", ""); | ||||
| 
 | ||||
|         return; | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     error(loc, "cannot apply precision statement to this type; use 'float', 'int' or a sampler type", TType::getBasicString(basicType), ""); | ||||
| } | ||||
| @ -3765,8 +3762,12 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua | ||||
|         error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", ""); | ||||
| 
 | ||||
|     // desktop always allows outer-dimension-unsized variable arrays,
 | ||||
| #ifdef GLSLANG_WEB | ||||
|     return; | ||||
| #else | ||||
|     if (profile != EEsProfile) | ||||
|         return; | ||||
| #endif | ||||
| 
 | ||||
|     // for ES, if size isn't coming from an initializer, it has to be explicitly declared now,
 | ||||
|     // with very few exceptions
 | ||||
| @ -3775,7 +3776,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua | ||||
|     if (qualifier.storage == EvqBuffer && lastMember) | ||||
|         return; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     // implicitly-sized io exceptions:
 | ||||
|     switch (language) { | ||||
|     case EShLangGeometry: | ||||
| @ -3807,7 +3807,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua | ||||
|     default: | ||||
|         break; | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     arraySizeRequiredCheck(loc, *arraySizes); | ||||
| } | ||||
| @ -4453,14 +4452,12 @@ 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", "", ""); | ||||
| #ifndef GLSLANG_WEB | ||||
|     if (qualifier.isNoContraction()) { | ||||
|         if (qualifier.isParamOutput()) | ||||
|             type.getQualifier().noContraction = true; | ||||
|             type.getQualifier().setNoContraction(); | ||||
|         else | ||||
|             warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); | ||||
|     } | ||||
| #endif | ||||
|     if (qualifier.isNonUniform()) | ||||
|         type.getQualifier().nonUniform = qualifier.nonUniform; | ||||
| 
 | ||||
| @ -5675,8 +5672,10 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) | ||||
|                         lastBinding += type.getCumulativeArraySize(); | ||||
|                     else { | ||||
|                         lastBinding += 1; | ||||
| #ifndef GLSLANG_WEB | ||||
|                         if (spvVersion.vulkan == 0) | ||||
|                             warn(loc, "assuming binding count of one for compile-time checking of binding numbers for unsized array", "[]", ""); | ||||
| #endif | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @ -5916,16 +5915,15 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier | ||||
| // For places that can't have shader-level layout qualifiers
 | ||||
| void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQualifiers& shaderQualifiers) | ||||
| { | ||||
| #ifndef GLSLANG_WEB | ||||
|     const char* message = "can only apply to a standalone qualifier"; | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     if (shaderQualifiers.geometry != ElgNone) | ||||
|         error(loc, message, TQualifier::getGeometryString(shaderQualifiers.geometry), ""); | ||||
|     if (shaderQualifiers.spacing != EvsNone) | ||||
|         error(loc, message, TQualifier::getVertexSpacingString(shaderQualifiers.spacing), ""); | ||||
|     if (shaderQualifiers.order != EvoNone) | ||||
|         error(loc, message, TQualifier::getVertexOrderString(shaderQualifiers.order), ""); | ||||
| #endif | ||||
|     if (shaderQualifiers.pointMode) | ||||
|         error(loc, message, "point_mode", ""); | ||||
|     if (shaderQualifiers.invocations != TQualifier::layoutNotSet) | ||||
| @ -5944,7 +5942,6 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua | ||||
|         else | ||||
|             assert(0); | ||||
|     } | ||||
| #ifndef GLSLANG_WEB | ||||
|     if (shaderQualifiers.earlyFragmentTests) | ||||
|         error(loc, message, "early_fragment_tests", ""); | ||||
|     if (shaderQualifiers.postDepthCoverage) | ||||
| @ -6006,13 +6003,16 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) | ||||
| //
 | ||||
| const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn) | ||||
| { | ||||
|     const TFunction* function = nullptr; | ||||
| 
 | ||||
|     if (symbolTable.isFunctionNameVariable(call.getName())) { | ||||
|         error(loc, "can't use function syntax on variable", call.getName().c_str(), ""); | ||||
|         return nullptr; | ||||
|     } | ||||
| 
 | ||||
| #ifdef GLSLANG_WEB | ||||
|     return findFunctionExact(loc, call, builtIn); | ||||
| #endif | ||||
| 
 | ||||
|     const TFunction* function = nullptr; | ||||
|     bool explicitTypesEnabled = extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types) || | ||||
|                                 extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int8) || | ||||
|                                 extensionTurnedOn(E_GL_EXT_shader_explicit_arithmetic_types_int16) || | ||||
| @ -6381,7 +6381,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden | ||||
|     accStructNVCheck(loc, type, identifier); | ||||
|     checkAndResizeMeshViewDim(loc, type, /*isBlockMember*/ false); | ||||
| #endif | ||||
|     if (type.getQualifier().storage == EvqConst && type.containsBasicType(EbtReference)) { | ||||
|     if (type.getQualifier().storage == EvqConst && type.containsReference()) { | ||||
|         error(loc, "variables with reference type can't have qualifier 'const'", "qualifier", ""); | ||||
|     } | ||||
| 
 | ||||
| @ -6394,8 +6394,7 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden | ||||
|             requireInt8Arithmetic(loc, "qualifier", "(u)int8 types can only be in uniform block or buffer storage"); | ||||
|     } | ||||
| 
 | ||||
|     if (type.getQualifier().storage == EvqShared && | ||||
|         type.containsCoopMat()) | ||||
|     if (type.getQualifier().storage == EvqShared && type.containsCoopMat()) | ||||
|         error(loc, "qualifier", "Cooperative matrix types must not be used in shared memory", ""); | ||||
| 
 | ||||
|     if (identifier != "gl_FragCoord" && (publicType.shaderQualifiers.originUpperLeft || publicType.shaderQualifiers.pixelCenterInteger)) | ||||
| @ -6408,7 +6407,9 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden | ||||
|     if (symbol == nullptr) | ||||
|         reservedErrorCheck(loc, identifier); | ||||
| 
 | ||||
| #ifndef GLSLANG_WEB | ||||
|     inheritGlobalDefaults(type.getQualifier()); | ||||
| #endif | ||||
| 
 | ||||
|     // Declare the variable
 | ||||
|     if (type.isArray()) { | ||||
| @ -7709,15 +7710,11 @@ 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()); | ||||
|     } | ||||
| #ifndef GLSLANG_WEB | ||||
|     else if (qualifier.isNoContraction()) { | ||||
|     } else if (qualifier.isNoContraction()) { | ||||
|         if (intermediate.inIoAccessed(identifier)) | ||||
|             error(loc, "cannot change qualification after use", "precise", ""); | ||||
|         symbol->getWritableType().getQualifier().noContraction = true; | ||||
|     } | ||||
| #endif | ||||
|     else if (qualifier.specConstant) { | ||||
|         symbol->getWritableType().getQualifier().setNoContraction(); | ||||
|     } else if (qualifier.specConstant) { | ||||
|         symbol->getWritableType().getQualifier().makeSpecConstant(); | ||||
|         if (qualifier.hasSpecConstantId()) | ||||
|             symbol->getWritableType().getQualifier().layoutSpecConstantId = qualifier.layoutSpecConstantId; | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -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) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 John Kessenich
						John Kessenich