本文整理汇总了C++中TSymbolTable::relateToOperator方法的典型用法代码示例。如果您正苦于以下问题:C++ TSymbolTable::relateToOperator方法的具体用法?C++ TSymbolTable::relateToOperator怎么用?C++ TSymbolTable::relateToOperator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSymbolTable
的用法示例。
在下文中一共展示了TSymbolTable::relateToOperator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IdentifyBuiltIns
void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
const ShBuiltInResources &resources,
TSymbolTable &symbolTable)
{
//
// First, insert some special built-in variables that are not in
// the built-in header files.
//
switch(type) {
case SH_FRAGMENT_SHADER:
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
//
// In CSS Shaders, gl_FragColor, gl_FragData, and gl_MaxDrawBuffers are not available.
// Instead, css_MixColor and css_ColorMatrix are available.
//
if (spec != SH_CSS_SHADERS_SPEC) {
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
if (resources.EXT_frag_depth) {
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragDepthEXT"), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
symbolTable.relateToExtension(ESSL1_BUILTINS, "gl_FragDepthEXT", "GL_EXT_frag_depth");
}
} else {
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_MixColor"), TType(EbtFloat, EbpMedium, EvqGlobal, 4)));
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("css_ColorMatrix"), TType(EbtFloat, EbpMedium, EvqGlobal, 4, 4)));
}
break;
case SH_VERTEX_SHADER:
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
break;
default: assert(false && "Language not supported");
}
//
// Next, identify which built-ins from the already loaded headers have
// a mapping to an operator. Those that are not identified as such are
// expected to be resolved through a library of functions, versus as
// operations.
//
symbolTable.relateToOperator(COMMON_BUILTINS, "matrixCompMult", EOpMul);
symbolTable.relateToOperator(COMMON_BUILTINS, "equal", EOpVectorEqual);
symbolTable.relateToOperator(COMMON_BUILTINS, "notEqual", EOpVectorNotEqual);
symbolTable.relateToOperator(COMMON_BUILTINS, "lessThan", EOpLessThan);
symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThan", EOpGreaterThan);
symbolTable.relateToOperator(COMMON_BUILTINS, "lessThanEqual", EOpLessThanEqual);
symbolTable.relateToOperator(COMMON_BUILTINS, "greaterThanEqual", EOpGreaterThanEqual);
symbolTable.relateToOperator(COMMON_BUILTINS, "radians", EOpRadians);
symbolTable.relateToOperator(COMMON_BUILTINS, "degrees", EOpDegrees);
symbolTable.relateToOperator(COMMON_BUILTINS, "sin", EOpSin);
symbolTable.relateToOperator(COMMON_BUILTINS, "cos", EOpCos);
symbolTable.relateToOperator(COMMON_BUILTINS, "tan", EOpTan);
symbolTable.relateToOperator(COMMON_BUILTINS, "asin", EOpAsin);
symbolTable.relateToOperator(COMMON_BUILTINS, "acos", EOpAcos);
symbolTable.relateToOperator(COMMON_BUILTINS, "atan", EOpAtan);
symbolTable.relateToOperator(COMMON_BUILTINS, "pow", EOpPow);
symbolTable.relateToOperator(COMMON_BUILTINS, "exp2", EOpExp2);
symbolTable.relateToOperator(COMMON_BUILTINS, "log", EOpLog);
symbolTable.relateToOperator(COMMON_BUILTINS, "exp", EOpExp);
symbolTable.relateToOperator(COMMON_BUILTINS, "log2", EOpLog2);
symbolTable.relateToOperator(COMMON_BUILTINS, "sqrt", EOpSqrt);
symbolTable.relateToOperator(COMMON_BUILTINS, "inversesqrt", EOpInverseSqrt);
symbolTable.relateToOperator(COMMON_BUILTINS, "abs", EOpAbs);
symbolTable.relateToOperator(COMMON_BUILTINS, "sign", EOpSign);
symbolTable.relateToOperator(COMMON_BUILTINS, "floor", EOpFloor);
symbolTable.relateToOperator(COMMON_BUILTINS, "ceil", EOpCeil);
symbolTable.relateToOperator(COMMON_BUILTINS, "fract", EOpFract);
symbolTable.relateToOperator(COMMON_BUILTINS, "mod", EOpMod);
symbolTable.relateToOperator(COMMON_BUILTINS, "min", EOpMin);
symbolTable.relateToOperator(COMMON_BUILTINS, "max", EOpMax);
symbolTable.relateToOperator(COMMON_BUILTINS, "clamp", EOpClamp);
symbolTable.relateToOperator(COMMON_BUILTINS, "mix", EOpMix);
symbolTable.relateToOperator(COMMON_BUILTINS, "step", EOpStep);
symbolTable.relateToOperator(COMMON_BUILTINS, "smoothstep", EOpSmoothStep);
symbolTable.relateToOperator(COMMON_BUILTINS, "length", EOpLength);
symbolTable.relateToOperator(COMMON_BUILTINS, "distance", EOpDistance);
symbolTable.relateToOperator(COMMON_BUILTINS, "dot", EOpDot);
symbolTable.relateToOperator(COMMON_BUILTINS, "cross", EOpCross);
symbolTable.relateToOperator(COMMON_BUILTINS, "normalize", EOpNormalize);
symbolTable.relateToOperator(COMMON_BUILTINS, "faceforward", EOpFaceForward);
symbolTable.relateToOperator(COMMON_BUILTINS, "reflect", EOpReflect);
symbolTable.relateToOperator(COMMON_BUILTINS, "refract", EOpRefract);
symbolTable.relateToOperator(COMMON_BUILTINS, "any", EOpAny);
symbolTable.relateToOperator(COMMON_BUILTINS, "all", EOpAll);
symbolTable.relateToOperator(COMMON_BUILTINS, "not", EOpVectorLogicalNot);
// Map language-specific operators.
switch(type) {
//.........这里部分代码省略.........
示例2: IdentifyBuiltIns
void IdentifyBuiltIns(EShLanguage language, TSymbolTable& symbolTable)
{
//
// Next, identify which built-ins from the already loaded headers have
// a mapping to an operator. Those that are not identified as such are
// expected to be resolved through a library of functions, versus as
// operations.
//
symbolTable.relateToOperator("fmod", EOpMod); //HLSL version
symbolTable.relateToOperator("radians", EOpRadians);
symbolTable.relateToOperator("degrees", EOpDegrees);
symbolTable.relateToOperator("sin", EOpSin);
symbolTable.relateToOperator("cos", EOpCos);
symbolTable.relateToOperator("tan", EOpTan);
symbolTable.relateToOperator("asin", EOpAsin);
symbolTable.relateToOperator("acos", EOpAcos);
symbolTable.relateToOperator("atan", EOpAtan);
symbolTable.relateToOperator("atan2", EOpAtan2);
symbolTable.relateToOperator("sincos", EOpSinCos);
symbolTable.relateToOperator("pow", EOpPow);
symbolTable.relateToOperator("exp2", EOpExp2);
symbolTable.relateToOperator("log", EOpLog);
symbolTable.relateToOperator("exp", EOpExp);
symbolTable.relateToOperator("log2", EOpLog2);
symbolTable.relateToOperator("log10", EOpLog10);
symbolTable.relateToOperator("sqrt", EOpSqrt);
symbolTable.relateToOperator("rsqrt", EOpInverseSqrt); //HLSL version
symbolTable.relateToOperator("abs", EOpAbs);
symbolTable.relateToOperator("sign", EOpSign);
symbolTable.relateToOperator("floor", EOpFloor);
symbolTable.relateToOperator("ceil", EOpCeil);
symbolTable.relateToOperator("frac", EOpFract); //HLSL version
symbolTable.relateToOperator("min", EOpMin);
symbolTable.relateToOperator("max", EOpMax);
symbolTable.relateToOperator("clamp", EOpClamp);
symbolTable.relateToOperator("lerp", EOpMix); //HLSL version
symbolTable.relateToOperator("step", EOpStep);
symbolTable.relateToOperator("smoothstep", EOpSmoothStep);
symbolTable.relateToOperator("mul", EOpMul); //HLSL mul function
symbolTable.relateToOperator("transpose", EOpTranspose);
symbolTable.relateToOperator("determinant", EOpDeterminant);
symbolTable.relateToOperator("length", EOpLength);
symbolTable.relateToOperator("distance", EOpDistance);
symbolTable.relateToOperator("dot", EOpDot);
symbolTable.relateToOperator("cross", EOpCross);
symbolTable.relateToOperator("normalize", EOpNormalize);
symbolTable.relateToOperator("forward", EOpFaceForward);
symbolTable.relateToOperator("reflect", EOpReflect);
symbolTable.relateToOperator("refract", EOpRefract);
symbolTable.relateToOperator("any", EOpAny);
symbolTable.relateToOperator("all", EOpAll);
symbolTable.relateToOperator("tex1D", EOpTex1D);
symbolTable.relateToOperator("tex1Dproj", EOpTex1DProj);
symbolTable.relateToOperator("tex1Dlod", EOpTex1DLod);
symbolTable.relateToOperator("tex1Dbias", EOpTex1DBias);
symbolTable.relateToOperator("tex1Dgrad", EOpTex1DGrad);
symbolTable.relateToOperator("tex2D", EOpTex2D);
symbolTable.relateToOperator("tex2Dproj", EOpTex2DProj);
symbolTable.relateToOperator("tex2Dlod", EOpTex2DLod);
symbolTable.relateToOperator("tex2Dbias", EOpTex2DBias);
symbolTable.relateToOperator("tex2Dgrad", EOpTex2DGrad);
symbolTable.relateToOperator("tex3D", EOpTex3D);
symbolTable.relateToOperator("tex3Dproj", EOpTex3DProj);
symbolTable.relateToOperator("tex3Dlod", EOpTex3DLod);
symbolTable.relateToOperator("tex3Dbias", EOpTex3DBias);
symbolTable.relateToOperator("tex3Dgrad", EOpTex3DGrad);
symbolTable.relateToOperator("texRECT", EOpTexRect);
symbolTable.relateToOperator("texRECTproj", EOpTexRectProj);
symbolTable.relateToOperator("texCUBE", EOpTexCube);
symbolTable.relateToOperator("texCUBEproj", EOpTexCubeProj);
symbolTable.relateToOperator("texCUBElod", EOpTexCubeLod);
symbolTable.relateToOperator("texCUBEbias", EOpTexCubeBias);
symbolTable.relateToOperator("texCUBEgrad", EOpTexCubeGrad);
symbolTable.relateToOperator("shadow2D", EOpShadow2D);
symbolTable.relateToOperator("shadow2Dproj", EOpShadow2DProj);
symbolTable.relateToOperator("saturate", EOpSaturate);
symbolTable.relateToOperator("modf", EOpModf);
symbolTable.relateToOperator("ldexp", EOpLdexp);
symbolTable.relateToOperator("round", EOpRound);
symbolTable.relateToOperator("trunc", EOpTrunc);
symbolTable.relateToOperator("lit", EOpLit);
symbolTable.relateToOperator("D3DCOLORtoUBYTE4", EOpD3DCOLORtoUBYTE4);
switch (language)
{
case EShLangVertex:
//.........这里部分代码省略.........