Commit f7f0b8c3 by Olli Etuaho Committed by Commit Bot

Rename operator enums so they can be autogenerated

Camel casing is removed from the enums where it differs from the GLSL spec. This way it's easier to autogenerate code for built-in functions mapped to operators. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I2490d5d0e8ffb45eba343f225f76779e63381a65 Reviewed-on: https://chromium-review.googlesource.com/929361Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 7c8567a3
...@@ -38,10 +38,10 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator ...@@ -38,10 +38,10 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator
// !(x > 0.0 || x < 0.0 || x == 0.0) will be optimized and always equal to false. // !(x > 0.0 || x < 0.0 || x == 0.0) will be optimized and always equal to false.
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float1, EOpIsnan, float1,
"bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? false : x != 0.0; }"); "bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? false : x != 0.0; }");
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float2, EOpIsnan, float2,
"bvec2 isnan_emu(vec2 x)\n" "bvec2 isnan_emu(vec2 x)\n"
"{\n" "{\n"
" bvec2 isnan;\n" " bvec2 isnan;\n"
...@@ -52,7 +52,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator ...@@ -52,7 +52,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator
" return isnan;\n" " return isnan;\n"
"}\n"); "}\n");
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float3, EOpIsnan, float3,
"bvec3 isnan_emu(vec3 x)\n" "bvec3 isnan_emu(vec3 x)\n"
"{\n" "{\n"
" bvec3 isnan;\n" " bvec3 isnan;\n"
...@@ -63,7 +63,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator ...@@ -63,7 +63,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator
" return isnan;\n" " return isnan;\n"
"}\n"); "}\n");
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float4, EOpIsnan, float4,
"bvec4 isnan_emu(vec4 x)\n" "bvec4 isnan_emu(vec4 x)\n"
"{\n" "{\n"
" bvec4 isnan;\n" " bvec4 isnan;\n"
......
...@@ -27,7 +27,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator ...@@ -27,7 +27,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
TType *float3 = new TType(EbtFloat, 3); TType *float3 = new TType(EbtFloat, 3);
TType *float4 = new TType(EbtFloat, 4); TType *float4 = new TType(EbtFloat, 4);
emu->addEmulatedFunction(EOpIsNan, float1, emu->addEmulatedFunction(EOpIsnan, float1,
"bool isnan_emu(float x)\n" "bool isnan_emu(float x)\n"
"{\n" "{\n"
" return (x > 0.0 || x < 0.0) ? false : x != 0.0;\n" " return (x > 0.0 || x < 0.0) ? false : x != 0.0;\n"
...@@ -35,7 +35,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator ...@@ -35,7 +35,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
"\n"); "\n");
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float2, EOpIsnan, float2,
"bool2 isnan_emu(float2 x)\n" "bool2 isnan_emu(float2 x)\n"
"{\n" "{\n"
" bool2 isnan;\n" " bool2 isnan;\n"
...@@ -47,7 +47,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator ...@@ -47,7 +47,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
"}\n"); "}\n");
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float3, EOpIsnan, float3,
"bool3 isnan_emu(float3 x)\n" "bool3 isnan_emu(float3 x)\n"
"{\n" "{\n"
" bool3 isnan;\n" " bool3 isnan;\n"
...@@ -59,7 +59,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator ...@@ -59,7 +59,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
"}\n"); "}\n");
emu->addEmulatedFunction( emu->addEmulatedFunction(
EOpIsNan, float4, EOpIsnan, float4,
"bool4 isnan_emu(float4 x)\n" "bool4 isnan_emu(float4 x)\n"
"{\n" "{\n"
" bool4 isnan;\n" " bool4 isnan;\n"
......
...@@ -151,7 +151,7 @@ bool CanFoldAggregateBuiltInOp(TOperator op) ...@@ -151,7 +151,7 @@ bool CanFoldAggregateBuiltInOp(TOperator op)
case EOpClamp: case EOpClamp:
case EOpMix: case EOpMix:
case EOpStep: case EOpStep:
case EOpSmoothStep: case EOpSmoothstep:
case EOpLdexp: case EOpLdexp:
case EOpMulMatrixComponentWise: case EOpMulMatrixComponentWise:
case EOpOuterProduct: case EOpOuterProduct:
...@@ -1021,8 +1021,8 @@ void TIntermUnary::promote() ...@@ -1021,8 +1021,8 @@ void TIntermUnary::promote()
static_cast<unsigned char>(mOperand->getType().getRows()), static_cast<unsigned char>(mOperand->getType().getRows()),
static_cast<unsigned char>(mOperand->getType().getCols()))); static_cast<unsigned char>(mOperand->getType().getCols())));
break; break;
case EOpIsInf: case EOpIsinf:
case EOpIsNan: case EOpIsnan:
setType(TType(EbtBool, EbpUndefined, resultQualifier, operandPrimarySize)); setType(TType(EbtBool, EbpUndefined, resultQualifier, operandPrimarySize));
break; break;
case EOpBitfieldReverse: case EOpBitfieldReverse:
...@@ -2537,12 +2537,12 @@ TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op, ...@@ -2537,12 +2537,12 @@ TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op,
break; break;
} }
case EOpIsNan: case EOpIsnan:
ASSERT(getType().getBasicType() == EbtFloat); ASSERT(getType().getBasicType() == EbtFloat);
resultArray[i].setBConst(gl::isNaN(operandArray[0].getFConst())); resultArray[i].setBConst(gl::isNaN(operandArray[0].getFConst()));
break; break;
case EOpIsInf: case EOpIsinf:
ASSERT(getType().getBasicType() == EbtFloat); ASSERT(getType().getBasicType() == EbtFloat);
resultArray[i].setBConst(gl::isInf(operandArray[0].getFConst())); resultArray[i].setBConst(gl::isInf(operandArray[0].getFConst()));
break; break;
...@@ -2607,7 +2607,7 @@ TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op, ...@@ -2607,7 +2607,7 @@ TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op,
foldFloatTypeUnary(operandArray[i], &sqrtf, &resultArray[i]); foldFloatTypeUnary(operandArray[i], &sqrtf, &resultArray[i]);
break; break;
case EOpInverseSqrt: case EOpInversesqrt:
// There is no stdlib built-in function equavalent for GLES built-in inversesqrt(), // There is no stdlib built-in function equavalent for GLES built-in inversesqrt(),
// so getting the square root first using builtin function sqrt() and then taking // so getting the square root first using builtin function sqrt() and then taking
// its inverse. // its inverse.
...@@ -3230,7 +3230,7 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg ...@@ -3230,7 +3230,7 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
break; break;
} }
case EOpSmoothStep: case EOpSmoothstep:
{ {
ASSERT(basicType == EbtFloat); ASSERT(basicType == EbtFloat);
resultArray = new TConstantUnion[maxObjectSize]; resultArray = new TConstantUnion[maxObjectSize];
......
...@@ -151,7 +151,7 @@ const char *GetOperatorString(TOperator op) ...@@ -151,7 +151,7 @@ const char *GetOperatorString(TOperator op)
return "log2"; return "log2";
case EOpSqrt: case EOpSqrt:
return "sqrt"; return "sqrt";
case EOpInverseSqrt: case EOpInversesqrt:
return "inversesqrt"; return "inversesqrt";
case EOpAbs: case EOpAbs:
...@@ -184,11 +184,11 @@ const char *GetOperatorString(TOperator op) ...@@ -184,11 +184,11 @@ const char *GetOperatorString(TOperator op)
return "mix"; return "mix";
case EOpStep: case EOpStep:
return "step"; return "step";
case EOpSmoothStep: case EOpSmoothstep:
return "smoothstep"; return "smoothstep";
case EOpIsNan: case EOpIsnan:
return "isnan"; return "isnan";
case EOpIsInf: case EOpIsinf:
return "isinf"; return "isinf";
case EOpFloatBitsToInt: case EOpFloatBitsToInt:
......
...@@ -119,7 +119,7 @@ enum TOperator ...@@ -119,7 +119,7 @@ enum TOperator
EOpExp2, EOpExp2,
EOpLog2, EOpLog2,
EOpSqrt, EOpSqrt,
EOpInverseSqrt, EOpInversesqrt,
EOpAbs, EOpAbs,
EOpSign, EOpSign,
...@@ -136,9 +136,9 @@ enum TOperator ...@@ -136,9 +136,9 @@ enum TOperator
EOpClamp, EOpClamp,
EOpMix, EOpMix,
EOpStep, EOpStep,
EOpSmoothStep, EOpSmoothstep,
EOpIsNan, EOpIsnan,
EOpIsInf, EOpIsinf,
EOpFloatBitsToInt, EOpFloatBitsToInt,
EOpFloatBitsToUint, EOpFloatBitsToUint,
......
...@@ -734,7 +734,7 @@ bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node) ...@@ -734,7 +734,7 @@ bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
case EOpExp2: case EOpExp2:
case EOpLog2: case EOpLog2:
case EOpSqrt: case EOpSqrt:
case EOpInverseSqrt: case EOpInversesqrt:
case EOpAbs: case EOpAbs:
case EOpSign: case EOpSign:
case EOpFloor: case EOpFloor:
...@@ -743,8 +743,8 @@ bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node) ...@@ -743,8 +743,8 @@ bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
case EOpRoundEven: case EOpRoundEven:
case EOpCeil: case EOpCeil:
case EOpFract: case EOpFract:
case EOpIsNan: case EOpIsnan:
case EOpIsInf: case EOpIsinf:
case EOpFloatBitsToInt: case EOpFloatBitsToInt:
case EOpFloatBitsToUint: case EOpFloatBitsToUint:
case EOpIntBitsToFloat: case EOpIntBitsToFloat:
...@@ -955,7 +955,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -955,7 +955,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpClamp: case EOpClamp:
case EOpMix: case EOpMix:
case EOpStep: case EOpStep:
case EOpSmoothStep: case EOpSmoothstep:
case EOpFrexp: case EOpFrexp:
case EOpLdexp: case EOpLdexp:
case EOpDistance: case EOpDistance:
......
...@@ -1519,7 +1519,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node) ...@@ -1519,7 +1519,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
case EOpSqrt: case EOpSqrt:
outputTriplet(out, visit, "sqrt(", "", ")"); outputTriplet(out, visit, "sqrt(", "", ")");
break; break;
case EOpInverseSqrt: case EOpInversesqrt:
outputTriplet(out, visit, "rsqrt(", "", ")"); outputTriplet(out, visit, "rsqrt(", "", ")");
break; break;
case EOpAbs: case EOpAbs:
...@@ -1547,14 +1547,14 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node) ...@@ -1547,14 +1547,14 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
case EOpFract: case EOpFract:
outputTriplet(out, visit, "frac(", "", ")"); outputTriplet(out, visit, "frac(", "", ")");
break; break;
case EOpIsNan: case EOpIsnan:
if (node->getUseEmulatedFunction()) if (node->getUseEmulatedFunction())
writeEmulatedFunctionTriplet(out, visit, node->getOp()); writeEmulatedFunctionTriplet(out, visit, node->getOp());
else else
outputTriplet(out, visit, "isnan(", "", ")"); outputTriplet(out, visit, "isnan(", "", ")");
mRequiresIEEEStrictCompiling = true; mRequiresIEEEStrictCompiling = true;
break; break;
case EOpIsInf: case EOpIsinf:
outputTriplet(out, visit, "isinf(", "", ")"); outputTriplet(out, visit, "isinf(", "", ")");
break; break;
case EOpFloatBitsToInt: case EOpFloatBitsToInt:
...@@ -2085,7 +2085,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -2085,7 +2085,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpStep: case EOpStep:
outputTriplet(out, visit, "step(", ", ", ")"); outputTriplet(out, visit, "step(", ", ", ")");
break; break;
case EOpSmoothStep: case EOpSmoothstep:
outputTriplet(out, visit, "smoothstep(", ", ", ")"); outputTriplet(out, visit, "smoothstep(", ", ", ")");
break; break;
case EOpFrexp: case EOpFrexp:
......
...@@ -893,7 +893,7 @@ void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type) ...@@ -893,7 +893,7 @@ void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type)
insertBuiltInOp(COMMON_BUILTINS, EOpExp2, genType, genType); insertBuiltInOp(COMMON_BUILTINS, EOpExp2, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpLog2, genType, genType); insertBuiltInOp(COMMON_BUILTINS, EOpLog2, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSqrt, genType, genType); insertBuiltInOp(COMMON_BUILTINS, EOpSqrt, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpInverseSqrt, genType, genType); insertBuiltInOp(COMMON_BUILTINS, EOpInversesqrt, genType, genType);
// //
// Common Functions. // Common Functions.
...@@ -933,16 +933,16 @@ void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type) ...@@ -933,16 +933,16 @@ void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type)
insertBuiltInOp(ESSL3_BUILTINS, EOpMix, genType, genType, genType, genBType); insertBuiltInOp(ESSL3_BUILTINS, EOpMix, genType, genType, genType, genBType);
insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, genType, genType); insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, float1, genType); insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, float1, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSmoothStep, genType, genType, genType, genType); insertBuiltInOp(COMMON_BUILTINS, EOpSmoothstep, genType, genType, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSmoothStep, genType, float1, float1, genType); insertBuiltInOp(COMMON_BUILTINS, EOpSmoothstep, genType, float1, float1, genType);
const TType *outGenType = StaticType::GetQualified<EbtGenType, EvqOut>(); const TType *outGenType = StaticType::GetQualified<EbtGenType, EvqOut>();
const TType *outGenIType = StaticType::GetQualified<EbtGenIType, EvqOut>(); const TType *outGenIType = StaticType::GetQualified<EbtGenIType, EvqOut>();
insertBuiltInOp(ESSL3_BUILTINS, EOpModf, genType, genType, outGenType); insertBuiltInOp(ESSL3_BUILTINS, EOpModf, genType, genType, outGenType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIsNan, genBType, genType); insertBuiltInOp(ESSL3_BUILTINS, EOpIsnan, genBType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIsInf, genBType, genType); insertBuiltInOp(ESSL3_BUILTINS, EOpIsinf, genBType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, genType); insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, genType); insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, genIType); insertBuiltInOp(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, genIType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment