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
// !(x > 0.0 || x < 0.0 || x == 0.0) will be optimized and always equal to false.
emu->addEmulatedFunction(
EOpIsNan, float1,
EOpIsnan, float1,
"bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? false : x != 0.0; }");
emu->addEmulatedFunction(
EOpIsNan, float2,
EOpIsnan, float2,
"bvec2 isnan_emu(vec2 x)\n"
"{\n"
" bvec2 isnan;\n"
......@@ -52,7 +52,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator
" return isnan;\n"
"}\n");
emu->addEmulatedFunction(
EOpIsNan, float3,
EOpIsnan, float3,
"bvec3 isnan_emu(vec3 x)\n"
"{\n"
" bvec3 isnan;\n"
......@@ -63,7 +63,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator
" return isnan;\n"
"}\n");
emu->addEmulatedFunction(
EOpIsNan, float4,
EOpIsnan, float4,
"bvec4 isnan_emu(vec4 x)\n"
"{\n"
" bvec4 isnan;\n"
......
......@@ -27,7 +27,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
TType *float3 = new TType(EbtFloat, 3);
TType *float4 = new TType(EbtFloat, 4);
emu->addEmulatedFunction(EOpIsNan, float1,
emu->addEmulatedFunction(EOpIsnan, float1,
"bool isnan_emu(float x)\n"
"{\n"
" return (x > 0.0 || x < 0.0) ? false : x != 0.0;\n"
......@@ -35,7 +35,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
"\n");
emu->addEmulatedFunction(
EOpIsNan, float2,
EOpIsnan, float2,
"bool2 isnan_emu(float2 x)\n"
"{\n"
" bool2 isnan;\n"
......@@ -47,7 +47,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
"}\n");
emu->addEmulatedFunction(
EOpIsNan, float3,
EOpIsnan, float3,
"bool3 isnan_emu(float3 x)\n"
"{\n"
" bool3 isnan;\n"
......@@ -59,7 +59,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator
"}\n");
emu->addEmulatedFunction(
EOpIsNan, float4,
EOpIsnan, float4,
"bool4 isnan_emu(float4 x)\n"
"{\n"
" bool4 isnan;\n"
......
......@@ -151,7 +151,7 @@ bool CanFoldAggregateBuiltInOp(TOperator op)
case EOpClamp:
case EOpMix:
case EOpStep:
case EOpSmoothStep:
case EOpSmoothstep:
case EOpLdexp:
case EOpMulMatrixComponentWise:
case EOpOuterProduct:
......@@ -1021,8 +1021,8 @@ void TIntermUnary::promote()
static_cast<unsigned char>(mOperand->getType().getRows()),
static_cast<unsigned char>(mOperand->getType().getCols())));
break;
case EOpIsInf:
case EOpIsNan:
case EOpIsinf:
case EOpIsnan:
setType(TType(EbtBool, EbpUndefined, resultQualifier, operandPrimarySize));
break;
case EOpBitfieldReverse:
......@@ -2537,12 +2537,12 @@ TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op,
break;
}
case EOpIsNan:
case EOpIsnan:
ASSERT(getType().getBasicType() == EbtFloat);
resultArray[i].setBConst(gl::isNaN(operandArray[0].getFConst()));
break;
case EOpIsInf:
case EOpIsinf:
ASSERT(getType().getBasicType() == EbtFloat);
resultArray[i].setBConst(gl::isInf(operandArray[0].getFConst()));
break;
......@@ -2607,7 +2607,7 @@ TConstantUnion *TIntermConstantUnion::foldUnaryComponentWise(TOperator op,
foldFloatTypeUnary(operandArray[i], &sqrtf, &resultArray[i]);
break;
case EOpInverseSqrt:
case EOpInversesqrt:
// 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
// its inverse.
......@@ -3230,7 +3230,7 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
break;
}
case EOpSmoothStep:
case EOpSmoothstep:
{
ASSERT(basicType == EbtFloat);
resultArray = new TConstantUnion[maxObjectSize];
......
......@@ -151,7 +151,7 @@ const char *GetOperatorString(TOperator op)
return "log2";
case EOpSqrt:
return "sqrt";
case EOpInverseSqrt:
case EOpInversesqrt:
return "inversesqrt";
case EOpAbs:
......@@ -184,11 +184,11 @@ const char *GetOperatorString(TOperator op)
return "mix";
case EOpStep:
return "step";
case EOpSmoothStep:
case EOpSmoothstep:
return "smoothstep";
case EOpIsNan:
case EOpIsnan:
return "isnan";
case EOpIsInf:
case EOpIsinf:
return "isinf";
case EOpFloatBitsToInt:
......@@ -382,4 +382,4 @@ bool IsAssignment(TOperator op)
default:
return false;
}
}
\ No newline at end of file
}
......@@ -119,7 +119,7 @@ enum TOperator
EOpExp2,
EOpLog2,
EOpSqrt,
EOpInverseSqrt,
EOpInversesqrt,
EOpAbs,
EOpSign,
......@@ -136,9 +136,9 @@ enum TOperator
EOpClamp,
EOpMix,
EOpStep,
EOpSmoothStep,
EOpIsNan,
EOpIsInf,
EOpSmoothstep,
EOpIsnan,
EOpIsinf,
EOpFloatBitsToInt,
EOpFloatBitsToUint,
......
......@@ -734,7 +734,7 @@ bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
case EOpExp2:
case EOpLog2:
case EOpSqrt:
case EOpInverseSqrt:
case EOpInversesqrt:
case EOpAbs:
case EOpSign:
case EOpFloor:
......@@ -743,8 +743,8 @@ bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
case EOpRoundEven:
case EOpCeil:
case EOpFract:
case EOpIsNan:
case EOpIsInf:
case EOpIsnan:
case EOpIsinf:
case EOpFloatBitsToInt:
case EOpFloatBitsToUint:
case EOpIntBitsToFloat:
......@@ -955,7 +955,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpClamp:
case EOpMix:
case EOpStep:
case EOpSmoothStep:
case EOpSmoothstep:
case EOpFrexp:
case EOpLdexp:
case EOpDistance:
......
......@@ -1519,7 +1519,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
case EOpSqrt:
outputTriplet(out, visit, "sqrt(", "", ")");
break;
case EOpInverseSqrt:
case EOpInversesqrt:
outputTriplet(out, visit, "rsqrt(", "", ")");
break;
case EOpAbs:
......@@ -1547,14 +1547,14 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
case EOpFract:
outputTriplet(out, visit, "frac(", "", ")");
break;
case EOpIsNan:
case EOpIsnan:
if (node->getUseEmulatedFunction())
writeEmulatedFunctionTriplet(out, visit, node->getOp());
else
outputTriplet(out, visit, "isnan(", "", ")");
mRequiresIEEEStrictCompiling = true;
break;
case EOpIsInf:
case EOpIsinf:
outputTriplet(out, visit, "isinf(", "", ")");
break;
case EOpFloatBitsToInt:
......@@ -2085,7 +2085,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpStep:
outputTriplet(out, visit, "step(", ", ", ")");
break;
case EOpSmoothStep:
case EOpSmoothstep:
outputTriplet(out, visit, "smoothstep(", ", ", ")");
break;
case EOpFrexp:
......
......@@ -893,7 +893,7 @@ void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type)
insertBuiltInOp(COMMON_BUILTINS, EOpExp2, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpLog2, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSqrt, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpInverseSqrt, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpInversesqrt, genType, genType);
//
// Common Functions.
......@@ -933,16 +933,16 @@ void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type)
insertBuiltInOp(ESSL3_BUILTINS, EOpMix, genType, genType, genType, genBType);
insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, float1, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSmoothStep, genType, genType, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSmoothStep, genType, float1, float1, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSmoothstep, genType, genType, genType, genType);
insertBuiltInOp(COMMON_BUILTINS, EOpSmoothstep, genType, float1, float1, genType);
const TType *outGenType = StaticType::GetQualified<EbtGenType, EvqOut>();
const TType *outGenIType = StaticType::GetQualified<EbtGenIType, EvqOut>();
insertBuiltInOp(ESSL3_BUILTINS, EOpModf, genType, genType, outGenType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIsNan, genBType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIsInf, genBType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIsnan, genBType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpIsinf, genBType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, genType);
insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, genType);
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