Initialize.cpp revision d50c160c55fc7353916a55194c538fe3b53480eb
1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 2d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. 3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// Use of this source code is governed by a BSD-style license that can be 4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// found in the LICENSE file. 5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// Create strings that declare built-in definitions, add built-ins that 9d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens// cannot be expressed in the files, and establish mappings between 10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// built-in functions and operators. 11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// 12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 13cc863da574ed5079b055574127fe5788a9a0fc33Nicolas Capens#include "Initialize.h" 14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 15cc863da574ed5079b055574127fe5788a9a0fc33Nicolas Capens#include "intermediate.h" 16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 1708ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capensvoid InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TSymbolTable &symbolTable) 18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 1970da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *float1 = new TType(EbtFloat); 2070da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *float2 = new TType(EbtFloat, 2); 2170da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *float3 = new TType(EbtFloat, 3); 2270da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *float4 = new TType(EbtFloat, 4); 238fa9d23dda6436369ae1e16dbed3bf1425626ae0Nicolas Capens TType *genType = new TType(EbtGenType); 24d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 252205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *int1 = new TType(EbtInt); 26b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu TType *int2 = new TType(EbtInt, 2); 27b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu TType *int3 = new TType(EbtInt, 3); 282205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *uint1 = new TType(EbtUInt); 292205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *genIType = new TType(EbtGenIType); 302205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *genUType = new TType(EbtGenUType); 312205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *genBType = new TType(EbtGenBType); 322205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu 333d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 343d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Angle and Trigonometric Functions. 353d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 3633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRadians, genType, "radians", genType); 3733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDegrees, genType, "degrees", genType); 3833cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSin, genType, "sin", genType); 3933cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCos, genType, "cos", genType); 4033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpTan, genType, "tan", genType); 4133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAsin, genType, "asin", genType); 4233cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAcos, genType, "acos", genType); 4333cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType, genType); 4433cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType); 452205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSinh, genType, "sinh", genType); 462205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpCosh, genType, "cosh", genType); 472205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTanh, genType, "tanh", genType); 482205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAsinh, genType, "asinh", genType); 492205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAcosh, genType, "acosh", genType); 502205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAtanh, genType, "atanh", genType); 513d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens 523d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 533d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Exponential Functions. 543d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 5533cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpPow, genType, "pow", genType, genType); 5633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp, genType, "exp", genType); 5733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog, genType, "log", genType); 5833cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp2, genType, "exp2", genType); 5933cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog2, genType, "log2", genType); 6033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSqrt, genType, "sqrt", genType); 6133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpInverseSqrt, genType, "inversesqrt", genType); 623d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens 633d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 643d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Common Functions. 653d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 6633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAbs, genType, "abs", genType); 672205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAbs, genIType, "abs", genIType); 6833cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSign, genType, "sign", genType); 692205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSign, genIType, "sign", genIType); 7033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFloor, genType, "floor", genType); 712205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTrunc, genType, "trunc", genType); 722205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRound, genType, "round", genType); 732205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRoundEven, genType, "roundEven", genType); 7433cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCeil, genType, "ceil", genType); 7533cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFract, genType, "fract", genType); 7633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, float1); 7733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, genType); 7833cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, float1); 7933cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, genType); 802205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, genIType); 812205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, int1); 822205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, genUType); 832205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, uint1); 8433cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, float1); 8533cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, genType); 862205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, genIType); 872205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, int1); 882205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, genUType); 892205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, uint1); 9033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, float1, float1); 9133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, genType, genType); 922205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, int1, int1); 932205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, genIType, genIType); 942205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, uint1, uint1); 952205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, genUType, genUType); 9633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, float1); 9733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, genType); 9833cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", genType, genType); 9933cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", float1, genType); 10033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", genType, genType, genType); 10133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", float1, float1, genType); 1023d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens 1032205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsNan, genBType, "isnan", genType); 1042205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsInf, genBType, "isinf", genType); 1052205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, "floatBitsToInt", genType); 1062205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, "floatBitsToUint", genType); 1072205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, "intBitsToFloat", genIType); 108d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUintBitsToFloat, genType, "uintBitsToFloat", genUType); 109d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens 1102205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackSnorm2x16, uint1, "packSnorm2x16", float2); 1112205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackUnorm2x16, uint1, "packUnorm2x16", float2); 1122205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackHalf2x16, uint1, "packHalf2x16", float2); 1132205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackSnorm2x16, float2, "unpackSnorm2x16", uint1); 1142205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackUnorm2x16, float2, "unpackUnorm2x16", uint1); 1152205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackHalf2x16, float2, "unpackHalf2x16", uint1); 1162205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu 1173d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 1183d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Geometric Functions. 1193d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 12033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLength, float1, "length", genType); 12133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDistance, float1, "distance", genType, genType); 12233cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDot, float1, "dot", genType, genType); 12333cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCross, float3, "cross", float3, float3); 12433cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNormalize, genType, "normalize", genType); 12533cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFaceForward, genType, "faceforward", genType, genType, genType); 12633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, "reflect", genType, genType); 12733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, "refract", genType, genType, float1); 128d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 129b14178b68ccb44a1fca9ba4e7db7770c6b6b6fa9Alexis Hetu TType *mat2 = new TType(EbtFloat, 2, 2); 1302205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *mat2x3 = new TType(EbtFloat, 2, 3); 1312205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *mat2x4 = new TType(EbtFloat, 2, 4); 1322205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *mat3x2 = new TType(EbtFloat, 3, 2); 133b14178b68ccb44a1fca9ba4e7db7770c6b6b6fa9Alexis Hetu TType *mat3 = new TType(EbtFloat, 3, 3); 1342205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *mat3x4 = new TType(EbtFloat, 3, 4); 1352205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *mat4x2 = new TType(EbtFloat, 4, 2); 1362205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu TType *mat4x3 = new TType(EbtFloat, 4, 3); 137b14178b68ccb44a1fca9ba4e7db7770c6b6b6fa9Alexis Hetu TType *mat4 = new TType(EbtFloat, 4, 4); 138d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 1393d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 1403d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Matrix Functions. 1413d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 14233cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat2, "matrixCompMult", mat2, mat2); 14333cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat3, "matrixCompMult", mat3, mat3); 14433cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat4, "matrixCompMult", mat4, mat4); 1452205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x3, "matrixCompMult", mat2x3, mat2x3); 1462205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x2, "matrixCompMult", mat3x2, mat3x2); 1472205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x4, "matrixCompMult", mat2x4, mat2x4); 1482205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x2, "matrixCompMult", mat4x2, mat4x2); 1492205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x4, "matrixCompMult", mat3x4, mat3x4); 150d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x3, "matrixCompMult", mat4x3, mat4x3); 151d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens 1522205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2, "outerProduct", float2, float2); 1532205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3, "outerProduct", float3, float3); 1542205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4, "outerProduct", float4, float4); 1552205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, "outerProduct", float3, float2); 1562205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, "outerProduct", float2, float3); 1572205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, "outerProduct", float4, float2); 1582205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, "outerProduct", float2, float4); 1592205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, "outerProduct", float4, float3); 160d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, "outerProduct", float3, float4); 161d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens 1622205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2, "transpose", mat2); 1632205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3, "transpose", mat3); 1642205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4, "transpose", mat4); 1652205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x3, "transpose", mat3x2); 1662205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x2, "transpose", mat2x3); 1672205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x4, "transpose", mat4x2); 1682205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x2, "transpose", mat2x4); 1692205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x4, "transpose", mat4x3); 170d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x3, "transpose", mat3x4); 171d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens 1722205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat2); 1732205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat3); 174d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat4); 175d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens 1762205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat2, "inverse", mat2); 1772205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat3, "inverse", mat3); 178d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat4, "inverse", mat4); 1792205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu 180d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 18170da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *bool1 = new TType(EbtBool); 1828fa9d23dda6436369ae1e16dbed3bf1425626ae0Nicolas Capens TType *vec = new TType(EbtVec); 1838fa9d23dda6436369ae1e16dbed3bf1425626ae0Nicolas Capens TType *ivec = new TType(EbtIVec); 184d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens TType *uvec = new TType(EbtUVec); 1858fa9d23dda6436369ae1e16dbed3bf1425626ae0Nicolas Capens TType *bvec = new TType(EbtBVec); 186d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 1873d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 1883d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Vector relational functions. 1893d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 19033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, "lessThan", vec, vec); 19133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, "lessThan", ivec, ivec); 1922205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThan, bvec, "lessThan", uvec, uvec); 19333cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", vec, vec); 19433cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", ivec, ivec); 1952205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", uvec, uvec); 19633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, "greaterThan", vec, vec); 19733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, "greaterThan", ivec, ivec); 1982205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThan, bvec, "greaterThan", uvec, uvec); 19933cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", vec, vec); 20033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", ivec, ivec); 2012205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", uvec, uvec); 20233cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", vec, vec); 20333cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", ivec, ivec); 2042205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorEqual, bvec, "equal", uvec, uvec); 20533cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", bvec, bvec); 20633cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", vec, vec); 20733cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", ivec, ivec); 2082205c2012c2c9546c7c0fd6b90c674c1486e30a3Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", uvec, uvec); 20933cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", bvec, bvec); 21033cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAny, bool1, "any", bvec); 21133cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAll, bool1, "all", bvec); 21233cda11b476675feccf858c5baa22cbffef51597Nicolas Capens symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorLogicalNot, bvec, "not", bvec); 213d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 21470da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *sampler2D = new TType(EbtSampler2D); 21570da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *samplerCube = new TType(EbtSamplerCube); 21670da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *sampler3D = new TType(EbtSampler3D); 217d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 2183d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 2193d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Texture Functions for GLSL ES 1.0 2203d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 2213d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2); 2223d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3); 2233d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4); 2243d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3); 2253d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3D", sampler3D, float3); 2263d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens 2273d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens if(resources.OES_EGL_image_external) 2283d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens { 22970da3d432409368f214058c466fe0265b6b9a070Nicolas Capens TType *samplerExternalOES = new TType(EbtSamplerExternalOES); 2303d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens 2313d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2); 2323d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float3); 2333d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float4); 2343d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3D", samplerExternalOES, float3); 2353d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens } 236d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 23708ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens if(type == GL_FRAGMENT_SHADER) 23866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman { 2393d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1); 2403d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1); 2413d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, float1); 2423d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, float1); 243894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 2443d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens if(resources.OES_standard_derivatives) 245d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman { 24618d5ef97c6a5112b08c310606ef854cafae864bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdx, "GL_OES_standard_derivatives", genType, "dFdx", genType); 24718d5ef97c6a5112b08c310606ef854cafae864bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdy, "GL_OES_standard_derivatives", genType, "dFdy", genType); 24818d5ef97c6a5112b08c310606ef854cafae864bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth,"GL_OES_standard_derivatives", genType, "fwidth", genType); 249d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman } 250d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman } 251894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 25208ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens if(type == GL_VERTEX_SHADER) 253d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman { 2543d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1); 2553d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1); 2563d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, float1); 2573d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, float1); 2583d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3DLod", sampler3D, float3, float1); 259d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman } 260d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 26182cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens TType *gvec4 = new TType(EbtGVec4); 26282cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens 26382cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens TType *gsampler2D = new TType(EbtGSampler2D); 26482cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens TType *gsamplerCube = new TType(EbtGSamplerCube); 26582cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens TType *gsampler3D = new TType(EbtGSampler3D); 26682cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens TType *gsampler2DArray = new TType(EbtGSampler2DArray); 26782cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens 26882cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens // 26982cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens // Texture Functions for GLSL ES 3.0 27082cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens // 27182cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2); 27282cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3); 27382cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3); 27482cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3); 27582cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3); 27682cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4); 27782cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4); 27882cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1); 27982cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1); 28082cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1); 28182cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1); 28282cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens 28382cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens if(type == GL_FRAGMENT_SHADER) 28482cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens { 28582cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1); 28682cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1); 28782cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1); 28882cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, float1); 28982cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1); 29082cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1); 29182cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1); 29282cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens } 29382cd6d82a079fcad71e686cc075e36186f2a8e66Nicolas Capens 294b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu TType *sampler2DShadow = new TType(EbtSampler2DShadow); 295b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu TType *samplerCubeShadow = new TType(EbtSamplerCubeShadow); 296b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu TType *sampler2DArrayShadow = new TType(EbtSampler2DArrayShadow); 297b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 298b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3); 299b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4); 300b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4); 301b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4); 302b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1); 303b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 304b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu if(type == GL_FRAGMENT_SHADER) 305b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu { 306b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1); 307b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1); 308b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, float1); 309b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu } 310b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 311b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1); 312b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1); 313b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1); 314b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1); 315b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1); 316b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1); 317b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1); 318b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 319b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu if(type == GL_FRAGMENT_SHADER) 320b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu { 321b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdx, genType, "dFdx", genType); 322b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdy, genType, "dFdy", genType); 323b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFwidth, genType, "fwidth", genType); 324b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu } 325b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 326b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2); 327b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3); 328b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2); 329b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2); 330b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 331b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu if(type == GL_FRAGMENT_SHADER) 332b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu { 333b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1); 334b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1); 335b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2, float1); 336b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2, float1); 337b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu } 338b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 339b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2); 340b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2); 341b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3); 342b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2); 343b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 344b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu if(type == GL_FRAGMENT_SHADER) 345b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu { 346b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1); 347b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1); 348b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3, float1); 349b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2, float1); 350b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu } 351b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 352b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, int2); 353b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, int3); 354b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, int2); 355b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2); 356b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 357b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1); 358b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1); 359b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1); 360b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, float1); 361b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 362b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, float1, int2); 363b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, float1, int2); 364b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, float1, int3); 365b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, float4, float1, int2); 366b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 367b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1); 368b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1); 369b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1); 370b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 371b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, int2); 372b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, int3); 373b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, int1, int2); 374b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 375b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, float2); 376b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, float3); 377b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, float3); 378b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, float2, float2); 379b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, float3, float3); 380b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, float2); 381b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, float2, float2); 382b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 383b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, float2, float2, int2); 384b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, float3, float3, int3); 385b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, float2, float2, int2); 386b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, float2, float2, int2); 387b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, float4, float2, float2, int2); 388b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 389b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, float2); 390b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, float2); 391b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, float3); 392b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, float2, float2); 393b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 394b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, float2, float2, int2); 395b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, float2, float2, int2); 396b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, float3, float3, int3); 397b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, float4, float2, float2, int2); 398b5332c54150a1d30991390f77c8a277fd2e90c21Alexis Hetu 3993d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 4003d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Depth range in window coordinates 4013d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 402a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu TFieldList *fields = NewPoolTFieldList(); 403253fdd10c2c3b428302755db0df4ca6fbb60024fAlexis Hetu TSourceLoc zeroSourceLoc = { 0, 0, 0, 0 }; 404253fdd10c2c3b428302755db0df4ca6fbb60024fAlexis Hetu TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"), zeroSourceLoc); 405253fdd10c2c3b428302755db0df4ca6fbb60024fAlexis Hetu TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"), zeroSourceLoc); 406253fdd10c2c3b428302755db0df4ca6fbb60024fAlexis Hetu TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"), zeroSourceLoc); 407a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu fields->push_back(near); 408a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu fields->push_back(far); 409a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu fields->push_back(diff); 410a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu TStructure *depthRangeStruct = new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields); 411a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu TVariable *depthRangeParameters = new TVariable(&depthRangeStruct->name(), depthRangeStruct, true); 412e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insert(COMMON_BUILTINS, *depthRangeParameters); 413a8b364b735624da31500d0fe93ae75f8b36a59d1Alexis Hetu TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct)); 414d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman depthRange->setQualifier(EvqUniform); 415e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insert(COMMON_BUILTINS, *depthRange); 416d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman 4173d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 4183d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // Implementation dependent built-in constants. 4193d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens // 4203d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs); 421e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors); 422e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits); 423e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits); 424e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", resources.MaxTextureImageUnits); 425e2858656575d8bc1f88ad3c885ab3cedf29a482eNicolas Capens symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors); 4263d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors); 4273d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers); 4286743bbf11fe876e0ce063802174c416f5fa05ad4Alexis Hetu symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", resources.MaxVertexOutputVectors); 4296743bbf11fe876e0ce063802174c416f5fa05ad4Alexis Hetu symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors", resources.MaxFragmentInputVectors); 4306743bbf11fe876e0ce063802174c416f5fa05ad4Alexis Hetu symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset", resources.MinProgramTexelOffset); 4316743bbf11fe876e0ce063802174c416f5fa05ad4Alexis Hetu symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset); 432894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 433894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 43408ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capensvoid IdentifyBuiltIns(GLenum shaderType, 4353d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens const ShBuiltInResources &resources, 436d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman TSymbolTable &symbolTable) 437894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 438894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman // 439d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens // First, insert some special built-in variables that are not in 440894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman // the built-in header files. 441894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman // 44208ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens switch(shaderType) 44308ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens { 44408ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens case GL_FRAGMENT_SHADER: 4453d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4))); 4463d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1))); 4473d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2))); 4483d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4))); 4493d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4))); 450fe30f67732fe460e5f579f35418b22d6b89abb03Alexis Hetu symbolTable.insert(ESSL3_BUILTINS, *new TVariable(NewPoolTString("gl_FragDepth"), TType(EbtFloat, EbpHigh, EvqFragDepth, 1))); 451894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman break; 45208ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens case GL_VERTEX_SHADER: 4533d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4))); 4543d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1))); 4556743bbf11fe876e0ce063802174c416f5fa05ad4Alexis Hetu symbolTable.insert(ESSL3_BUILTINS, *new TVariable(NewPoolTString("gl_InstanceID"), TType(EbtInt, EbpHigh, EvqInstanceID, 1))); 456894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman break; 457894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman default: assert(false && "Language not supported"); 458894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 459894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 460894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman // Finally add resource-specific variables. 46108ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens switch(shaderType) 46266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman { 46308ca3c6e18275ed9db5515e470692e700e1a3e12Nicolas Capens case GL_FRAGMENT_SHADER: 46466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman { 465894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman // Set up gl_FragData. The array size. 466b14178b68ccb44a1fca9ba4e7db7770c6b6b6fa9Alexis Hetu TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true); 467894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman fragData.setArraySize(resources.MaxDrawBuffers); 4683d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData)); 46966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman } 47066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman break; 471894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman default: break; 472894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman } 473894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 474894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman 475894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid InitExtensionBehavior(const ShBuiltInResources& resources, 476894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman TExtensionBehavior& extBehavior) 477894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman{ 4783d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens if(resources.OES_standard_derivatives) 47966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman extBehavior["GL_OES_standard_derivatives"] = EBhUndefined; 4803d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens if(resources.OES_fragment_precision_high) 481d4ae863d01d5f448dbbba6be4ecc161971a2324fJohn Bauman extBehavior["GL_FRAGMENT_PRECISION_HIGH"] = EBhUndefined; 4823d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens if(resources.OES_EGL_image_external) 4833d7f6ed87f60694d52606d9338cf9483d62fa8bfNicolas Capens extBehavior["GL_OES_EGL_image_external"] = EBhUndefined; 484d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens if(resources.EXT_draw_buffers) 485d50c160c55fc7353916a55194c538fe3b53480ebNicolas Capens extBehavior["GL_EXT_draw_buffers"] = EBhUndefined; 486894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman} 487