Commit e2858656 by Nicolas Capens

Split builtin symbols over multiple levels.

Bug 19331817 Change-Id: Ia1ab8f4da90c62ca846961c97691aacdbdf62a6a Reviewed-on: https://swiftshader-review.googlesource.com/2361Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent d603ecd6
......@@ -25,288 +25,288 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
TType *int3 = new TType(EbtInt, EbpUndefined, EvqGlobal, 3);
TType *int4 = new TType(EbtInt, EbpUndefined, EvqGlobal, 4);
symbolTable.insertBuiltIn(float1, "radians", float1);
symbolTable.insertBuiltIn(float2, "radians", float2);
symbolTable.insertBuiltIn(float3, "radians", float3);
symbolTable.insertBuiltIn(float4, "radians", float4);
symbolTable.insertBuiltIn(float1, "degrees", float1);
symbolTable.insertBuiltIn(float2, "degrees", float2);
symbolTable.insertBuiltIn(float3, "degrees", float3);
symbolTable.insertBuiltIn(float4, "degrees", float4);
symbolTable.insertBuiltIn(float1, "sin", float1);
symbolTable.insertBuiltIn(float2, "sin", float2);
symbolTable.insertBuiltIn(float3, "sin", float3);
symbolTable.insertBuiltIn(float4, "sin", float4);
symbolTable.insertBuiltIn(float1, "cos", float1);
symbolTable.insertBuiltIn(float2, "cos", float2);
symbolTable.insertBuiltIn(float3, "cos", float3);
symbolTable.insertBuiltIn(float4, "cos", float4);
symbolTable.insertBuiltIn(float1, "tan", float1);
symbolTable.insertBuiltIn(float2, "tan", float2);
symbolTable.insertBuiltIn(float3, "tan", float3);
symbolTable.insertBuiltIn(float4, "tan", float4);
symbolTable.insertBuiltIn(float1, "asin", float1);
symbolTable.insertBuiltIn(float2, "asin", float2);
symbolTable.insertBuiltIn(float3, "asin", float3);
symbolTable.insertBuiltIn(float4, "asin", float4);
symbolTable.insertBuiltIn(float1, "acos", float1);
symbolTable.insertBuiltIn(float2, "acos", float2);
symbolTable.insertBuiltIn(float3, "acos", float3);
symbolTable.insertBuiltIn(float4, "acos", float4);
symbolTable.insertBuiltIn(float1, "atan", float1, float1);
symbolTable.insertBuiltIn(float2, "atan", float2, float2);
symbolTable.insertBuiltIn(float3, "atan", float3, float3);
symbolTable.insertBuiltIn(float4, "atan", float4, float4);
symbolTable.insertBuiltIn(float1, "atan", float1);
symbolTable.insertBuiltIn(float2, "atan", float2);
symbolTable.insertBuiltIn(float3, "atan", float3);
symbolTable.insertBuiltIn(float4, "atan", float4);
symbolTable.insertBuiltIn(float1, "pow", float1, float1);
symbolTable.insertBuiltIn(float2, "pow", float2, float2);
symbolTable.insertBuiltIn(float3, "pow", float3, float3);
symbolTable.insertBuiltIn(float4, "pow", float4, float4);
symbolTable.insertBuiltIn(float1, "exp", float1);
symbolTable.insertBuiltIn(float2, "exp", float2);
symbolTable.insertBuiltIn(float3, "exp", float3);
symbolTable.insertBuiltIn(float4, "exp", float4);
symbolTable.insertBuiltIn(float1, "log", float1);
symbolTable.insertBuiltIn(float2, "log", float2);
symbolTable.insertBuiltIn(float3, "log", float3);
symbolTable.insertBuiltIn(float4, "log", float4);
symbolTable.insertBuiltIn(float1, "exp2", float1);
symbolTable.insertBuiltIn(float2, "exp2", float2);
symbolTable.insertBuiltIn(float3, "exp2", float3);
symbolTable.insertBuiltIn(float4, "exp2", float4);
symbolTable.insertBuiltIn(float1, "log2", float1);
symbolTable.insertBuiltIn(float2, "log2", float2);
symbolTable.insertBuiltIn(float3, "log2", float3);
symbolTable.insertBuiltIn(float4, "log2", float4);
symbolTable.insertBuiltIn(float1, "sqrt", float1);
symbolTable.insertBuiltIn(float2, "sqrt", float2);
symbolTable.insertBuiltIn(float3, "sqrt", float3);
symbolTable.insertBuiltIn(float4, "sqrt", float4);
symbolTable.insertBuiltIn(float1, "inversesqrt", float1);
symbolTable.insertBuiltIn(float2, "inversesqrt", float2);
symbolTable.insertBuiltIn(float3, "inversesqrt", float3);
symbolTable.insertBuiltIn(float4, "inversesqrt", float4);
symbolTable.insertBuiltIn(float1, "abs", float1);
symbolTable.insertBuiltIn(float2, "abs", float2);
symbolTable.insertBuiltIn(float3, "abs", float3);
symbolTable.insertBuiltIn(float4, "abs", float4);
symbolTable.insertBuiltIn(float1, "sign", float1);
symbolTable.insertBuiltIn(float2, "sign", float2);
symbolTable.insertBuiltIn(float3, "sign", float3);
symbolTable.insertBuiltIn(float4, "sign", float4);
symbolTable.insertBuiltIn(float1, "floor", float1);
symbolTable.insertBuiltIn(float2, "floor", float2);
symbolTable.insertBuiltIn(float3, "floor", float3);
symbolTable.insertBuiltIn(float4, "floor", float4);
symbolTable.insertBuiltIn(float1, "ceil", float1);
symbolTable.insertBuiltIn(float2, "ceil", float2);
symbolTable.insertBuiltIn(float3, "ceil", float3);
symbolTable.insertBuiltIn(float4, "ceil", float4);
symbolTable.insertBuiltIn(float1, "fract", float1);
symbolTable.insertBuiltIn(float2, "fract", float2);
symbolTable.insertBuiltIn(float3, "fract", float3);
symbolTable.insertBuiltIn(float4, "fract", float4);
symbolTable.insertBuiltIn(float1, "mod", float1, float1);
symbolTable.insertBuiltIn(float2, "mod", float2, float1);
symbolTable.insertBuiltIn(float3, "mod", float3, float1);
symbolTable.insertBuiltIn(float4, "mod", float4, float1);
symbolTable.insertBuiltIn(float2, "mod", float2, float2);
symbolTable.insertBuiltIn(float3, "mod", float3, float3);
symbolTable.insertBuiltIn(float4, "mod", float4, float4);
symbolTable.insertBuiltIn(float1, "min", float1, float1);
symbolTable.insertBuiltIn(float2, "min", float2, float1);
symbolTable.insertBuiltIn(float3, "min", float3, float1);
symbolTable.insertBuiltIn(float4, "min", float4, float1);
symbolTable.insertBuiltIn(float2, "min", float2, float2);
symbolTable.insertBuiltIn(float3, "min", float3, float3);
symbolTable.insertBuiltIn(float4, "min", float4, float4);
symbolTable.insertBuiltIn(float1, "max", float1, float1);
symbolTable.insertBuiltIn(float2, "max", float2, float1);
symbolTable.insertBuiltIn(float3, "max", float3, float1);
symbolTable.insertBuiltIn(float4, "max", float4, float1);
symbolTable.insertBuiltIn(float2, "max", float2, float2);
symbolTable.insertBuiltIn(float3, "max", float3, float3);
symbolTable.insertBuiltIn(float4, "max", float4, float4);
symbolTable.insertBuiltIn(float1, "clamp", float1, float1, float1);
symbolTable.insertBuiltIn(float2, "clamp", float2, float1, float1);
symbolTable.insertBuiltIn(float3, "clamp", float3, float1, float1);
symbolTable.insertBuiltIn(float4, "clamp", float4, float1, float1);
symbolTable.insertBuiltIn(float2, "clamp", float2, float2, float2);
symbolTable.insertBuiltIn(float3, "clamp", float3, float3, float3);
symbolTable.insertBuiltIn(float4, "clamp", float4, float4, float4);
symbolTable.insertBuiltIn(float1, "mix", float1, float1, float1);
symbolTable.insertBuiltIn(float2, "mix", float2, float2, float1);
symbolTable.insertBuiltIn(float3, "mix", float3, float3, float1);
symbolTable.insertBuiltIn(float4, "mix", float4, float4, float1);
symbolTable.insertBuiltIn(float2, "mix", float2, float2, float2);
symbolTable.insertBuiltIn(float3, "mix", float3, float3, float3);
symbolTable.insertBuiltIn(float4, "mix", float4, float4, float4);
symbolTable.insertBuiltIn(float1, "step", float1, float1);
symbolTable.insertBuiltIn(float2, "step", float2, float2);
symbolTable.insertBuiltIn(float3, "step", float3, float3);
symbolTable.insertBuiltIn(float4, "step", float4, float4);
symbolTable.insertBuiltIn(float2, "step", float1, float2);
symbolTable.insertBuiltIn(float3, "step", float1, float3);
symbolTable.insertBuiltIn(float4, "step", float1, float4);
symbolTable.insertBuiltIn(float1, "smoothstep", float1, float1, float1);
symbolTable.insertBuiltIn(float2, "smoothstep", float2, float2, float2);
symbolTable.insertBuiltIn(float3, "smoothstep", float3, float3, float3);
symbolTable.insertBuiltIn(float4, "smoothstep", float4, float4, float4);
symbolTable.insertBuiltIn(float2, "smoothstep", float1, float1, float2);
symbolTable.insertBuiltIn(float3, "smoothstep", float1, float1, float3);
symbolTable.insertBuiltIn(float4, "smoothstep", float1, float1, float4);
symbolTable.insertBuiltIn(float1, "length", float1);
symbolTable.insertBuiltIn(float1, "length", float2);
symbolTable.insertBuiltIn(float1, "length", float3);
symbolTable.insertBuiltIn(float1, "length", float4);
symbolTable.insertBuiltIn(float1, "distance", float1, float1);
symbolTable.insertBuiltIn(float1, "distance", float2, float2);
symbolTable.insertBuiltIn(float1, "distance", float3, float3);
symbolTable.insertBuiltIn(float1, "distance", float4, float4);
symbolTable.insertBuiltIn(float1, "dot", float1, float1);
symbolTable.insertBuiltIn(float1, "dot", float2, float2);
symbolTable.insertBuiltIn(float1, "dot", float3, float3);
symbolTable.insertBuiltIn(float1, "dot", float4, float4);
symbolTable.insertBuiltIn(float3, "cross", float3, float3);
symbolTable.insertBuiltIn(float1, "normalize", float1);
symbolTable.insertBuiltIn(float2, "normalize", float2);
symbolTable.insertBuiltIn(float3, "normalize", float3);
symbolTable.insertBuiltIn(float4, "normalize", float4);
symbolTable.insertBuiltIn(float1, "faceforward", float1, float1, float1);
symbolTable.insertBuiltIn(float2, "faceforward", float2, float2, float2);
symbolTable.insertBuiltIn(float3, "faceforward", float3, float3, float3);
symbolTable.insertBuiltIn(float4, "faceforward", float4, float4, float4);
symbolTable.insertBuiltIn(float1, "reflect", float1, float1);
symbolTable.insertBuiltIn(float2, "reflect", float2, float2);
symbolTable.insertBuiltIn(float3, "reflect", float3, float3);
symbolTable.insertBuiltIn(float4, "reflect", float4, float4);
symbolTable.insertBuiltIn(float1, "refract", float1, float1, float1);
symbolTable.insertBuiltIn(float2, "refract", float2, float2, float1);
symbolTable.insertBuiltIn(float3, "refract", float3, float3, float1);
symbolTable.insertBuiltIn(float4, "refract", float4, float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "radians", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "radians", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "radians", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "radians", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "degrees", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "degrees", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "degrees", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "degrees", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sin", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sin", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sin", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sin", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "cos", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "cos", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cos", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "cos", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "tan", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "tan", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "tan", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "tan", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "asin", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "asin", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "asin", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "asin", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "acos", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "acos", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "acos", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "acos", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "atan", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "atan", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "atan", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "atan", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "pow", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "pow", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "pow", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "pow", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "exp2", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "exp2", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "exp2", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "exp2", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "log2", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "log2", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "log2", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "log2", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sqrt", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sqrt", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sqrt", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sqrt", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "inversesqrt", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "inversesqrt", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "inversesqrt", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "inversesqrt", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "abs", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "abs", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "abs", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "abs", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "sign", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "sign", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "sign", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "sign", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "floor", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "floor", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "floor", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "floor", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "ceil", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "ceil", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "ceil", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "ceil", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "fract", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "fract", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "fract", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "fract", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "mod", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mod", float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mod", float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mod", float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mod", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mod", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mod", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "min", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "min", float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "min", float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "min", float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "min", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "min", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "min", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "max", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "max", float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "max", float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "max", float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "max", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "max", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "max", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "clamp", float1, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "clamp", float2, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "clamp", float3, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "clamp", float4, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "clamp", float2, float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "clamp", float3, float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "clamp", float4, float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "mix", float1, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mix", float2, float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mix", float3, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mix", float4, float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "mix", float2, float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "mix", float3, float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "mix", float4, float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "step", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "step", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "step", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "step", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "step", float1, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "step", float1, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "step", float1, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "smoothstep", float1, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "smoothstep", float2, float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float3, float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float4, float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "smoothstep", float1, float1, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "smoothstep", float1, float1, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "smoothstep", float1, float1, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "length", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "distance", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dot", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "cross", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "normalize", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "normalize", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "normalize", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "normalize", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "faceforward", float1, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "faceforward", float2, float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "faceforward", float3, float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "faceforward", float4, float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "reflect", float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "reflect", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "reflect", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "reflect", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "refract", float1, float1, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "refract", float2, float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "refract", float3, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "refract", float4, float4, float1);
TType *mat2 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 2, true);
TType *mat3 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 3, true);
TType *mat4 = new TType(EbtFloat, EbpUndefined, EvqGlobal, 4, true);
symbolTable.insertBuiltIn(mat2, "matrixCompMult", mat2, mat2);
symbolTable.insertBuiltIn(mat3, "matrixCompMult", mat3, mat3);
symbolTable.insertBuiltIn(mat4, "matrixCompMult", mat4, mat4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, mat2, "matrixCompMult", mat2, mat2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, mat3, "matrixCompMult", mat3, mat3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, mat4, "matrixCompMult", mat4, mat4);
TType *bool1 = new TType(EbtBool, EbpUndefined, EvqGlobal, 1);
TType *bool2 = new TType(EbtBool, EbpUndefined, EvqGlobal, 2);
TType *bool3 = new TType(EbtBool, EbpUndefined, EvqGlobal, 3);
TType *bool4 = new TType(EbtBool, EbpUndefined, EvqGlobal, 4);
symbolTable.insertBuiltIn(bool2, "lessThan", float2, float2);
symbolTable.insertBuiltIn(bool3, "lessThan", float3, float3);
symbolTable.insertBuiltIn(bool4, "lessThan", float4, float4);
symbolTable.insertBuiltIn(bool2, "lessThan", int2, int2);
symbolTable.insertBuiltIn(bool3, "lessThan", int3, int3);
symbolTable.insertBuiltIn(bool4, "lessThan", int4, int4);
symbolTable.insertBuiltIn(bool2, "lessThanEqual", float2, float2);
symbolTable.insertBuiltIn(bool3, "lessThanEqual", float3, float3);
symbolTable.insertBuiltIn(bool4, "lessThanEqual", float4, float4);
symbolTable.insertBuiltIn(bool2, "lessThanEqual", int2, int2);
symbolTable.insertBuiltIn(bool3, "lessThanEqual", int3, int3);
symbolTable.insertBuiltIn(bool4, "lessThanEqual", int4, int4);
symbolTable.insertBuiltIn(bool2, "greaterThan", float2, float2);
symbolTable.insertBuiltIn(bool3, "greaterThan", float3, float3);
symbolTable.insertBuiltIn(bool4, "greaterThan", float4, float4);
symbolTable.insertBuiltIn(bool2, "greaterThan", int2, int2);
symbolTable.insertBuiltIn(bool3, "greaterThan", int3, int3);
symbolTable.insertBuiltIn(bool4, "greaterThan", int4, int4);
symbolTable.insertBuiltIn(bool2, "greaterThanEqual", float2, float2);
symbolTable.insertBuiltIn(bool3, "greaterThanEqual", float3, float3);
symbolTable.insertBuiltIn(bool4, "greaterThanEqual", float4, float4);
symbolTable.insertBuiltIn(bool2, "greaterThanEqual", int2, int2);
symbolTable.insertBuiltIn(bool3, "greaterThanEqual", int3, int3);
symbolTable.insertBuiltIn(bool4, "greaterThanEqual", int4, int4);
symbolTable.insertBuiltIn(bool2, "equal", float2, float2);
symbolTable.insertBuiltIn(bool3, "equal", float3, float3);
symbolTable.insertBuiltIn(bool4, "equal", float4, float4);
symbolTable.insertBuiltIn(bool2, "equal", int2, int2);
symbolTable.insertBuiltIn(bool3, "equal", int3, int3);
symbolTable.insertBuiltIn(bool4, "equal", int4, int4);
symbolTable.insertBuiltIn(bool2, "equal", bool2, bool2);
symbolTable.insertBuiltIn(bool3, "equal", bool3, bool3);
symbolTable.insertBuiltIn(bool4, "equal", bool4, bool4);
symbolTable.insertBuiltIn(bool2, "notEqual", float2, float2);
symbolTable.insertBuiltIn(bool3, "notEqual", float3, float3);
symbolTable.insertBuiltIn(bool4, "notEqual", float4, float4);
symbolTable.insertBuiltIn(bool2, "notEqual", int2, int2);
symbolTable.insertBuiltIn(bool3, "notEqual", int3, int3);
symbolTable.insertBuiltIn(bool4, "notEqual", int4, int4);
symbolTable.insertBuiltIn(bool2, "notEqual", bool2, bool2);
symbolTable.insertBuiltIn(bool3, "notEqual", bool3, bool3);
symbolTable.insertBuiltIn(bool4, "notEqual", bool4, bool4);
symbolTable.insertBuiltIn(bool1, "any", bool2);
symbolTable.insertBuiltIn(bool1, "any", bool3);
symbolTable.insertBuiltIn(bool1, "any", bool4);
symbolTable.insertBuiltIn(bool1, "all", bool2);
symbolTable.insertBuiltIn(bool1, "all", bool3);
symbolTable.insertBuiltIn(bool1, "all", bool4);
symbolTable.insertBuiltIn(bool2, "not", bool2);
symbolTable.insertBuiltIn(bool3, "not", bool3);
symbolTable.insertBuiltIn(bool4, "not", bool4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThan", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThan", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThan", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThan", int2, int2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThan", int3, int3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThan", int4, int4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThanEqual", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThanEqual", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThanEqual", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "lessThanEqual", int2, int2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "lessThanEqual", int3, int3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "lessThanEqual", int4, int4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThan", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThan", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThan", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThan", int2, int2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThan", int3, int3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThan", int4, int4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThanEqual", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThanEqual", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThanEqual", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "greaterThanEqual", int2, int2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "greaterThanEqual", int3, int3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "greaterThanEqual", int4, int4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", int2, int2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", int3, int3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", int4, int4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "equal", bool2, bool2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "equal", bool3, bool3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "equal", bool4, bool4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", float2, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", float3, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", float4, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", int2, int2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", int3, int3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", int4, int4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "notEqual", bool2, bool2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "notEqual", bool3, bool3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "notEqual", bool4, bool4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "any", bool4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, "all", bool4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, "not", bool2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, "not", bool3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, "not", bool4);
TType *sampler2D = new TType(EbtSampler2D, EbpUndefined, EvqGlobal, 1);
TType *samplerCube = new TType(EbtSamplerCube, EbpUndefined, EvqGlobal, 1);
TType *sampler3D = new TType(EbtSampler3D, EbpUndefined, EvqGlobal, 1);
symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, float2);
symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float3);
symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float4);
symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, float3);
symbolTable.insertBuiltIn(float4, "texture3D", sampler3D, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2D", sampler2D, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProj", sampler2D, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProj", sampler2D, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "textureCube", samplerCube, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture3D", sampler3D, float3);
if(type == GL_FRAGMENT_SHADER)
{
symbolTable.insertBuiltIn(float4, "texture2D", sampler2D, float2, float1);
symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float3, float1);
symbolTable.insertBuiltIn(float4, "texture2DProj", sampler2D, float4, float1);
symbolTable.insertBuiltIn(float4, "textureCube", samplerCube, float3, float1);
symbolTable.insertBuiltIn(float4, "texture3D", sampler3D, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProj", sampler2D, float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "textureCube", samplerCube, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture3D", sampler3D, float3, float1);
if (resources.OES_standard_derivatives)
{
symbolTable.insertBuiltIn(float1, "dFdx", float1);
symbolTable.insertBuiltIn(float2, "dFdx", float2);
symbolTable.insertBuiltIn(float3, "dFdx", float3);
symbolTable.insertBuiltIn(float4, "dFdx", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dFdx", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "dFdx", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "dFdx", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "dFdx", float4);
symbolTable.insertBuiltIn(float1, "dFdy", float1);
symbolTable.insertBuiltIn(float2, "dFdy", float2);
symbolTable.insertBuiltIn(float3, "dFdy", float3);
symbolTable.insertBuiltIn(float4, "dFdy", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "dFdy", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "dFdy", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "dFdy", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "dFdy", float4);
symbolTable.insertBuiltIn(float1, "fwidth", float1);
symbolTable.insertBuiltIn(float2, "fwidth", float2);
symbolTable.insertBuiltIn(float3, "fwidth", float3);
symbolTable.insertBuiltIn(float4, "fwidth", float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, "fwidth", float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, "fwidth", float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, "fwidth", float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "fwidth", float4);
}
}
if(type == GL_VERTEX_SHADER)
{
symbolTable.insertBuiltIn(float4, "texture2DLod", sampler2D, float2, float1);
symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, float3, float1);
symbolTable.insertBuiltIn(float4, "texture2DProjLod", sampler2D, float4, float1);
symbolTable.insertBuiltIn(float4, "textureCubeLod", samplerCube, float3, float1);
symbolTable.insertBuiltIn(float4, "texture3DLod", sampler3D, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "textureCubeLod", samplerCube, float3, float1);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture3DLod", sampler3D, float3, float1);
}
TType *samplerExternalOES = new TType(EbtSamplerExternalOES, EbpUndefined, EvqGlobal, 1);
if(resources.OES_EGL_image_external)
{
symbolTable.insertBuiltIn(float4, "texture2D", samplerExternalOES, float2);
symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, float3);
symbolTable.insertBuiltIn(float4, "texture2DProj", samplerExternalOES, float4);
symbolTable.insertBuiltIn(float4, "texture3D", samplerExternalOES, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2D", samplerExternalOES, float2);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProj", samplerExternalOES, float3);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture2DProj", samplerExternalOES, float4);
symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, "texture3D", samplerExternalOES, float3);
}
TTypeList *members = NewPoolTTypeList();
......@@ -320,19 +320,19 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
members->push_back(far);
members->push_back(diff);
TVariable *depthRangeParameters = new TVariable(NewPoolTString("gl_DepthRangeParameters"), TType(members, "gl_DepthRangeParameters"), true);
symbolTable.insert(0, *depthRangeParameters);
symbolTable.insert(COMMON_BUILTINS, *depthRangeParameters);
TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(members, "gl_DepthRangeParameters"));
depthRange->setQualifier(EvqUniform);
symbolTable.insert(0, *depthRange);
symbolTable.insert(COMMON_BUILTINS, *depthRange);
symbolTable.insertConstInt("gl_MaxVertexAttribs", resources.MaxVertexAttribs);
symbolTable.insertConstInt("gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
symbolTable.insertConstInt("gl_MaxVaryingVectors", resources.MaxVaryingVectors);
symbolTable.insertConstInt("gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
symbolTable.insertConstInt("gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
symbolTable.insertConstInt("gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
symbolTable.insertConstInt("gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
symbolTable.insertConstInt("gl_MaxDrawBuffers", resources.MaxDrawBuffers);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers);
}
void IdentifyBuiltIns(GLenum shaderType,
......@@ -346,15 +346,15 @@ void IdentifyBuiltIns(GLenum shaderType,
switch(shaderType)
{
case GL_FRAGMENT_SHADER:
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
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_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
break;
case GL_VERTEX_SHADER:
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
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");
}
......@@ -365,58 +365,58 @@ void IdentifyBuiltIns(GLenum shaderType,
// expected to be resolved through a library of functions, versus as
// operations.
//
symbolTable.relateToOperator("not", EOpVectorLogicalNot);
symbolTable.relateToOperator(COMMON_BUILTINS, "not", EOpVectorLogicalNot);
symbolTable.relateToOperator("matrixCompMult", EOpMul);
symbolTable.relateToOperator(COMMON_BUILTINS, "matrixCompMult", EOpMul);
symbolTable.relateToOperator("equal", EOpVectorEqual);
symbolTable.relateToOperator("notEqual", EOpVectorNotEqual);
symbolTable.relateToOperator("lessThan", EOpLessThan);
symbolTable.relateToOperator("greaterThan", EOpGreaterThan);
symbolTable.relateToOperator("lessThanEqual", EOpLessThanEqual);
symbolTable.relateToOperator("greaterThanEqual", EOpGreaterThanEqual);
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("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(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("pow", EOpPow);
symbolTable.relateToOperator("exp2", EOpExp2);
symbolTable.relateToOperator("log", EOpLog);
symbolTable.relateToOperator("exp", EOpExp);
symbolTable.relateToOperator("log2", EOpLog2);
symbolTable.relateToOperator("sqrt", EOpSqrt);
symbolTable.relateToOperator("inversesqrt", EOpInverseSqrt);
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("abs", EOpAbs);
symbolTable.relateToOperator("sign", EOpSign);
symbolTable.relateToOperator("floor", EOpFloor);
symbolTable.relateToOperator("ceil", EOpCeil);
symbolTable.relateToOperator("fract", EOpFract);
symbolTable.relateToOperator("mod", EOpMod);
symbolTable.relateToOperator("min", EOpMin);
symbolTable.relateToOperator("max", EOpMax);
symbolTable.relateToOperator("clamp", EOpClamp);
symbolTable.relateToOperator("mix", EOpMix);
symbolTable.relateToOperator("step", EOpStep);
symbolTable.relateToOperator("smoothstep", EOpSmoothStep);
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("length", EOpLength);
symbolTable.relateToOperator("distance", EOpDistance);
symbolTable.relateToOperator("dot", EOpDot);
symbolTable.relateToOperator("cross", EOpCross);
symbolTable.relateToOperator("normalize", EOpNormalize);
symbolTable.relateToOperator("faceforward", EOpFaceForward);
symbolTable.relateToOperator("reflect", EOpReflect);
symbolTable.relateToOperator("refract", EOpRefract);
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("any", EOpAny);
symbolTable.relateToOperator("all", EOpAll);
symbolTable.relateToOperator(COMMON_BUILTINS, "any", EOpAny);
symbolTable.relateToOperator(COMMON_BUILTINS, "all", EOpAll);
// Map language-specific operators.
switch(shaderType)
......@@ -425,13 +425,13 @@ void IdentifyBuiltIns(GLenum shaderType,
break;
case GL_FRAGMENT_SHADER:
if (resources.OES_standard_derivatives) {
symbolTable.relateToOperator("dFdx", EOpDFdx);
symbolTable.relateToOperator("dFdy", EOpDFdy);
symbolTable.relateToOperator("fwidth", EOpFwidth);
symbolTable.relateToOperator(COMMON_BUILTINS, "dFdx", EOpDFdx);
symbolTable.relateToOperator(COMMON_BUILTINS, "dFdy", EOpDFdy);
symbolTable.relateToOperator(COMMON_BUILTINS, "fwidth", EOpFwidth);
symbolTable.relateToExtension("dFdx", "GL_OES_standard_derivatives");
symbolTable.relateToExtension("dFdy", "GL_OES_standard_derivatives");
symbolTable.relateToExtension("fwidth", "GL_OES_standard_derivatives");
symbolTable.relateToExtension(COMMON_BUILTINS, "dFdx", "GL_OES_standard_derivatives");
symbolTable.relateToExtension(COMMON_BUILTINS, "dFdy", "GL_OES_standard_derivatives");
symbolTable.relateToExtension(COMMON_BUILTINS, "fwidth", "GL_OES_standard_derivatives");
}
break;
default: break;
......@@ -445,7 +445,7 @@ void IdentifyBuiltIns(GLenum shaderType,
// Set up gl_FragData. The array size.
TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, false, true);
fragData.setArraySize(resources.MaxDrawBuffers);
symbolTable.insert(0, *new TVariable(NewPoolTString("gl_FragData"), fragData));
symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData));
}
break;
default: break;
......
......@@ -181,6 +181,38 @@ void TSymbolTableLevel::relateToExtension(const char* name, const TString& ext)
}
}
TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope) const
{
int level = currentLevel();
TSymbol *symbol = nullptr;
do
{
symbol = table[level]->find(name);
--level;
}
while(!symbol && level >= 0);
level++;
if(builtIn)
{
*builtIn = (level == 0);
}
if(sameScope)
{
*sameScope = (level == currentLevel());
}
return symbol;
}
TSymbol *TSymbolTable::findBuiltIn(const TString &name, int shaderVersion) const
{
return table[0]->find(name);
}
TSymbol::TSymbol(const TSymbol& copyOf)
{
name = NewPoolTString(copyOf.name->c_str());
......
......@@ -219,6 +219,14 @@ protected:
static int uniqueId; // for unique identification in code generation
};
enum ESymbolLevel
{
COMMON_BUILTINS = 0,
ESSL1_BUILTINS = 0,
LAST_BUILTIN_LEVEL = ESSL1_BUILTINS,
GLOBAL_LEVEL = 1
};
class TSymbolTable
{
public:
......@@ -233,19 +241,15 @@ public:
~TSymbolTable()
{
// level 0 is always built In symbols, so we never pop that out
while (table.size() > 1)
pop();
while(currentLevel() > LAST_BUILTIN_LEVEL)
{
pop();
}
}
//
// When the symbol table is initialized with the built-ins, there should
// 'push' calls, so that built-ins are at level 0 and the shader
// globals are at level 1.
//
bool isEmpty() { return table.size() == 0; }
bool atBuiltInLevel() { return table.size() == 1; }
bool atGlobalLevel() { return table.size() <= 2; }
bool isEmpty() { return table.empty(); }
bool atBuiltInLevel() { return currentLevel() <= LAST_BUILTIN_LEVEL; }
bool atGlobalLevel() { return currentLevel() <= GLOBAL_LEVEL; }
void push()
{
table.push_back(new TSymbolTableLevel);
......@@ -264,19 +268,19 @@ public:
return insert(currentLevel(), symbol);
}
bool insert(int level, TSymbol &symbol)
bool insert(ESymbolLevel level, TSymbol &symbol)
{
return table[level]->insert(symbol);
}
bool insertConstInt(const char *name, int value)
bool insertConstInt(ESymbolLevel level, const char *name, int value)
{
TVariable *constant = new TVariable(NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1));
constant->getConstPointer()->setIConst(value);
return insert(0, *constant);
return insert(level, *constant);
}
bool insertBuiltIn(TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0)
bool insertBuiltIn(ESymbolLevel level, TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0)
{
TFunction *function = new TFunction(NewPoolTString(name), *rvalue);
......@@ -295,50 +299,26 @@ public:
function->addParameter(param3);
}
return insert(0, *function);
}
TSymbol *find(const TString &name, int shaderVersion, bool *builtIn = false, bool *sameScope = false) const
{
int level = currentLevel();
TSymbol* symbol;
do {
symbol = table[level]->find(name);
--level;
} while (symbol == 0 && level >= 0);
level++;
if (builtIn)
*builtIn = level == 0;
if (sameScope)
*sameScope = level == currentLevel();
return symbol;
}
TSymbol *findBuiltIn(const TString &name, int shaderVersion) const
{
return table[0]->find(name);
return insert(level, *function);
}
TSymbolTableLevel *getGlobalLevel() const
{
assert(table.size() >= 2);
return table[1];
}
TSymbol *find(const TString &name, int shaderVersion, bool *builtIn = false, bool *sameScope = false) const;
TSymbol *findBuiltIn(const TString &name, int shaderVersion) const;
TSymbolTableLevel *getOuterLevel() const
{
assert(table.size() >= 2);
assert(currentLevel() >= 1);
return table[currentLevel() - 1];
}
void relateToOperator(const char* name, TOperator op)
void relateToOperator(ESymbolLevel level, const char *name, TOperator op)
{
table[0]->relateToOperator(name, op);
table[level]->relateToOperator(name, op);
}
void relateToExtension(const char* name, const TString& ext)
void relateToExtension(ESymbolLevel level, const char *name, const TString &ext)
{
table[0]->relateToExtension(name, ext);
table[level]->relateToExtension(name, ext);
}
bool setDefaultPrecision(const TPublicType &type, TPrecision prec)
......@@ -377,7 +357,7 @@ public:
}
protected:
int currentLevel() const { return static_cast<int>(table.size() - 1); }
ESymbolLevel currentLevel() const { return static_cast<ESymbolLevel>(table.size() - 1); }
std::vector<TSymbolTableLevel*> table;
typedef std::map< TBasicType, TPrecision > PrecisionStackLevel;
......
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