daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Nicolas Capens | 1fbc287 | 2014-01-03 14:12:09 -0500 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 8 | // Create symbols that declare built-in definitions, add built-ins that |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 9 | // cannot be expressed in the files, and establish mappings between |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 10 | // built-in functions and operators. |
| 11 | // |
| 12 | |
Geoff Lang | 1773282 | 2013-08-29 13:46:49 -0400 | [diff] [blame] | 13 | #include "compiler/translator/Initialize.h" |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 14 | #include "compiler/translator/Cache.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 15 | |
Jamie Madill | b1a85f4 | 2014-08-19 15:23:24 -0400 | [diff] [blame] | 16 | #include "compiler/translator/IntermNode.h" |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 17 | #include "angle_gl.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 18 | |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 19 | namespace sh |
| 20 | { |
| 21 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 22 | void InsertBuiltInFunctions(sh::GLenum type, |
| 23 | ShShaderSpec spec, |
| 24 | const ShBuiltInResources &resources, |
| 25 | TSymbolTable &symbolTable) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 26 | { |
Martin Radev | 2cc85b3 | 2016-08-05 16:22:53 +0300 | [diff] [blame] | 27 | const TType *voidType = TCache::getType(EbtVoid); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 28 | const TType *float1 = TCache::getType(EbtFloat); |
| 29 | const TType *float2 = TCache::getType(EbtFloat, 2); |
| 30 | const TType *float3 = TCache::getType(EbtFloat, 3); |
| 31 | const TType *float4 = TCache::getType(EbtFloat, 4); |
| 32 | const TType *int1 = TCache::getType(EbtInt); |
| 33 | const TType *int2 = TCache::getType(EbtInt, 2); |
| 34 | const TType *int3 = TCache::getType(EbtInt, 3); |
| 35 | const TType *uint1 = TCache::getType(EbtUInt); |
| 36 | const TType *bool1 = TCache::getType(EbtBool); |
| 37 | const TType *genType = TCache::getType(EbtGenType); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 38 | const TType *genIType = TCache::getType(EbtGenIType); |
| 39 | const TType *genUType = TCache::getType(EbtGenUType); |
| 40 | const TType *genBType = TCache::getType(EbtGenBType); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 41 | |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 42 | // |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 43 | // Angle and Trigonometric Functions. |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 44 | // |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 45 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRadians, genType, "radians", genType); |
| 46 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDegrees, genType, "degrees", genType); |
| 47 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSin, genType, "sin", genType); |
| 48 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCos, genType, "cos", genType); |
| 49 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpTan, genType, "tan", genType); |
| 50 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAsin, genType, "asin", genType); |
| 51 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAcos, genType, "acos", genType); |
| 52 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType, genType); |
| 53 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType); |
| 54 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSinh, genType, "sinh", genType); |
| 55 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpCosh, genType, "cosh", genType); |
| 56 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTanh, genType, "tanh", genType); |
| 57 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAsinh, genType, "asinh", genType); |
| 58 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAcosh, genType, "acosh", genType); |
| 59 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAtanh, genType, "atanh", genType); |
Olli Etuaho | 5c9cd3d | 2014-12-18 13:04:25 +0200 | [diff] [blame] | 60 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 61 | // |
| 62 | // Exponential Functions. |
| 63 | // |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 64 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpPow, genType, "pow", genType, genType); |
| 65 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp, genType, "exp", genType); |
| 66 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog, genType, "log", genType); |
| 67 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp2, genType, "exp2", genType); |
| 68 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog2, genType, "log2", genType); |
| 69 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSqrt, genType, "sqrt", genType); |
| 70 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpInverseSqrt, genType, "inversesqrt", genType); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 71 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 72 | // |
| 73 | // Common Functions. |
| 74 | // |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 75 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAbs, genType, "abs", genType); |
| 76 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAbs, genIType, "abs", genIType); |
| 77 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSign, genType, "sign", genType); |
| 78 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSign, genIType, "sign", genIType); |
| 79 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFloor, genType, "floor", genType); |
Qingqing Deng | 5dbece5 | 2015-02-27 20:35:38 -0800 | [diff] [blame] | 80 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTrunc, genType, "trunc", genType); |
| 81 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRound, genType, "round", genType); |
| 82 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRoundEven, genType, "roundEven", genType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 83 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCeil, genType, "ceil", genType); |
| 84 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFract, genType, "fract", genType); |
| 85 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, float1); |
| 86 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, genType); |
| 87 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, float1); |
| 88 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, genType); |
| 89 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, genIType); |
| 90 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, int1); |
Arun Patole | 7749005 | 2015-03-03 18:36:05 +0530 | [diff] [blame] | 91 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, genUType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 92 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, uint1); |
| 93 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, float1); |
| 94 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, genType); |
| 95 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, genIType); |
| 96 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, int1); |
| 97 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, genUType); |
| 98 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, uint1); |
| 99 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, float1, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 100 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, genType, |
| 101 | genType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 102 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, int1, int1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 103 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, genIType, |
| 104 | genIType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 105 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, uint1, uint1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 106 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, genUType, |
| 107 | genUType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 108 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, float1); |
| 109 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, genType); |
Arun Patole | d94f664 | 2015-05-18 16:25:12 +0530 | [diff] [blame] | 110 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMix, genType, "mix", genType, genType, genBType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 111 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", genType, genType); |
| 112 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", float1, genType); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 113 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", genType, |
| 114 | genType, genType); |
| 115 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", float1, float1, |
| 116 | genType); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 117 | |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 118 | const TType *outFloat1 = TCache::getType(EbtFloat, EvqOut); |
| 119 | const TType *outFloat2 = TCache::getType(EbtFloat, EvqOut, 2); |
| 120 | const TType *outFloat3 = TCache::getType(EbtFloat, EvqOut, 3); |
| 121 | const TType *outFloat4 = TCache::getType(EbtFloat, EvqOut, 4); |
Olli Etuaho | b6e07a6 | 2015-02-16 12:22:10 +0200 | [diff] [blame] | 122 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 123 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float1, "modf", float1, outFloat1); |
| 124 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float2, "modf", float2, outFloat2); |
| 125 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float3, "modf", float3, outFloat3); |
| 126 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float4, "modf", float4, outFloat4); |
Olli Etuaho | b6e07a6 | 2015-02-16 12:22:10 +0200 | [diff] [blame] | 127 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 128 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsNan, genBType, "isnan", genType); |
| 129 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsInf, genBType, "isinf", genType); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 130 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, "floatBitsToInt", |
| 131 | genType); |
| 132 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, "floatBitsToUint", |
| 133 | genType); |
| 134 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, "intBitsToFloat", |
| 135 | genIType); |
| 136 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUintBitsToFloat, genType, "uintBitsToFloat", |
| 137 | genUType); |
Olli Etuaho | e8d2c07 | 2015-01-08 16:33:54 +0200 | [diff] [blame] | 138 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 139 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackSnorm2x16, uint1, "packSnorm2x16", float2); |
| 140 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackUnorm2x16, uint1, "packUnorm2x16", float2); |
| 141 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackHalf2x16, uint1, "packHalf2x16", float2); |
| 142 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackSnorm2x16, float2, "unpackSnorm2x16", uint1); |
| 143 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackUnorm2x16, float2, "unpackUnorm2x16", uint1); |
| 144 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackHalf2x16, float2, "unpackHalf2x16", uint1); |
Olli Etuaho | 7700ff6 | 2015-01-15 12:16:29 +0200 | [diff] [blame] | 145 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 146 | // |
| 147 | // Geometric Functions. |
| 148 | // |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 149 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLength, float1, "length", genType); |
| 150 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDistance, float1, "distance", genType, genType); |
| 151 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDot, float1, "dot", genType, genType); |
| 152 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCross, float3, "cross", float3, float3); |
| 153 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNormalize, genType, "normalize", genType); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 154 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFaceForward, genType, "faceforward", genType, |
| 155 | genType, genType); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 156 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, "reflect", genType, genType); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 157 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, "refract", genType, genType, |
| 158 | float1); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 159 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 160 | const TType *mat2 = TCache::getType(EbtFloat, 2, 2); |
| 161 | const TType *mat3 = TCache::getType(EbtFloat, 3, 3); |
| 162 | const TType *mat4 = TCache::getType(EbtFloat, 4, 4); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 163 | const TType *mat2x3 = TCache::getType(EbtFloat, 2, 3); |
| 164 | const TType *mat3x2 = TCache::getType(EbtFloat, 3, 2); |
| 165 | const TType *mat2x4 = TCache::getType(EbtFloat, 2, 4); |
| 166 | const TType *mat4x2 = TCache::getType(EbtFloat, 4, 2); |
| 167 | const TType *mat3x4 = TCache::getType(EbtFloat, 3, 4); |
| 168 | const TType *mat4x3 = TCache::getType(EbtFloat, 4, 3); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 169 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 170 | // |
| 171 | // Matrix Functions. |
| 172 | // |
Olli Etuaho | e180559 | 2017-01-02 16:41:20 +0000 | [diff] [blame] | 173 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat2, "matrixCompMult", |
| 174 | mat2, mat2); |
| 175 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat3, "matrixCompMult", |
| 176 | mat3, mat3); |
| 177 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat4, "matrixCompMult", |
| 178 | mat4, mat4); |
| 179 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat2x3, "matrixCompMult", |
| 180 | mat2x3, mat2x3); |
| 181 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat3x2, "matrixCompMult", |
| 182 | mat3x2, mat3x2); |
| 183 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat2x4, "matrixCompMult", |
| 184 | mat2x4, mat2x4); |
| 185 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat4x2, "matrixCompMult", |
| 186 | mat4x2, mat4x2); |
| 187 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat3x4, "matrixCompMult", |
| 188 | mat3x4, mat3x4); |
| 189 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat4x3, "matrixCompMult", |
| 190 | mat4x3, mat4x3); |
Olli Etuaho | e39706d | 2014-12-30 16:40:36 +0200 | [diff] [blame] | 191 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 192 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2, "outerProduct", float2, |
| 193 | float2); |
| 194 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3, "outerProduct", float3, |
| 195 | float3); |
| 196 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4, "outerProduct", float4, |
| 197 | float4); |
| 198 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, "outerProduct", float3, |
| 199 | float2); |
| 200 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, "outerProduct", float2, |
| 201 | float3); |
| 202 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, "outerProduct", float4, |
| 203 | float2); |
| 204 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, "outerProduct", float2, |
| 205 | float4); |
| 206 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, "outerProduct", float4, |
| 207 | float3); |
| 208 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, "outerProduct", float3, |
| 209 | float4); |
Olli Etuaho | e39706d | 2014-12-30 16:40:36 +0200 | [diff] [blame] | 210 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 211 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2, "transpose", mat2); |
| 212 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3, "transpose", mat3); |
| 213 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4, "transpose", mat4); |
| 214 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x3, "transpose", mat3x2); |
| 215 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x2, "transpose", mat2x3); |
| 216 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x4, "transpose", mat4x2); |
| 217 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x2, "transpose", mat2x4); |
| 218 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x4, "transpose", mat4x3); |
| 219 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x3, "transpose", mat3x4); |
Olli Etuaho | e39706d | 2014-12-30 16:40:36 +0200 | [diff] [blame] | 220 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 221 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat2); |
| 222 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat3); |
| 223 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat4); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 224 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 225 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat2, "inverse", mat2); |
| 226 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat3, "inverse", mat3); |
| 227 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat4, "inverse", mat4); |
Olli Etuaho | abf6dad | 2015-01-14 14:45:16 +0200 | [diff] [blame] | 228 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 229 | const TType *vec = TCache::getType(EbtVec); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 230 | const TType *ivec = TCache::getType(EbtIVec); |
| 231 | const TType *uvec = TCache::getType(EbtUVec); |
| 232 | const TType *bvec = TCache::getType(EbtBVec); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 233 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 234 | // |
| 235 | // Vector relational functions. |
| 236 | // |
Olli Etuaho | e180559 | 2017-01-02 16:41:20 +0000 | [diff] [blame] | 237 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanComponentWise, bvec, "lessThan", vec, |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 238 | vec); |
Olli Etuaho | e180559 | 2017-01-02 16:41:20 +0000 | [diff] [blame] | 239 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanComponentWise, bvec, "lessThan", ivec, |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 240 | ivec); |
Olli Etuaho | e180559 | 2017-01-02 16:41:20 +0000 | [diff] [blame] | 241 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThanComponentWise, bvec, "lessThan", uvec, |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 242 | uvec); |
Olli Etuaho | e180559 | 2017-01-02 16:41:20 +0000 | [diff] [blame] | 243 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqualComponentWise, bvec, "lessThanEqual", |
| 244 | vec, vec); |
| 245 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqualComponentWise, bvec, "lessThanEqual", |
| 246 | ivec, ivec); |
| 247 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThanEqualComponentWise, bvec, "lessThanEqual", |
| 248 | uvec, uvec); |
| 249 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanComponentWise, bvec, "greaterThan", |
| 250 | vec, vec); |
| 251 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanComponentWise, bvec, "greaterThan", |
| 252 | ivec, ivec); |
| 253 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThanComponentWise, bvec, "greaterThan", |
| 254 | uvec, uvec); |
| 255 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, |
| 256 | "greaterThanEqual", vec, vec); |
| 257 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, |
| 258 | "greaterThanEqual", ivec, ivec); |
| 259 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, |
| 260 | "greaterThanEqual", uvec, uvec); |
| 261 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpEqualComponentWise, bvec, "equal", vec, vec); |
| 262 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpEqualComponentWise, bvec, "equal", ivec, ivec); |
| 263 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpEqualComponentWise, bvec, "equal", uvec, uvec); |
| 264 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpEqualComponentWise, bvec, "equal", bvec, bvec); |
| 265 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, "notEqual", vec, |
| 266 | vec); |
| 267 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, "notEqual", ivec, |
| 268 | ivec); |
| 269 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpNotEqualComponentWise, bvec, "notEqual", uvec, |
| 270 | uvec); |
| 271 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, "notEqual", bvec, |
| 272 | bvec); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 273 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAny, bool1, "any", bvec); |
| 274 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAll, bool1, "all", bvec); |
Olli Etuaho | d68924e | 2017-01-02 17:34:40 +0000 | [diff] [blame] | 275 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLogicalNotComponentWise, bvec, "not", bvec); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 276 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 277 | const TType *sampler2D = TCache::getType(EbtSampler2D); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 278 | const TType *samplerCube = TCache::getType(EbtSamplerCube); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 279 | |
| 280 | // |
| 281 | // Texture Functions for GLSL ES 1.0 |
| 282 | // |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 283 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2); |
| 284 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3); |
| 285 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4); |
| 286 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 287 | |
Ian Ewell | bda7559 | 2016-04-18 17:25:54 -0400 | [diff] [blame] | 288 | if (resources.OES_EGL_image_external || resources.NV_EGL_stream_consumer_external) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 289 | { |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 290 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 291 | |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 292 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 293 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, |
| 294 | float3); |
| 295 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, |
| 296 | float4); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 297 | } |
| 298 | |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 299 | if (resources.ARB_texture_rectangle) |
| 300 | { |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 301 | const TType *sampler2DRect = TCache::getType(EbtSampler2DRect); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 302 | |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 303 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRect", sampler2DRect, float2); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 304 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, |
| 305 | float3); |
| 306 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, |
| 307 | float4); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 308 | } |
| 309 | |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 310 | if (resources.EXT_shader_texture_lod) |
| 311 | { |
| 312 | /* The *Grad* variants are new to both vertex and fragment shaders; the fragment |
| 313 | * shader specific pieces are added separately below. |
| 314 | */ |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 315 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 316 | "texture2DGradEXT", sampler2D, float2, float2, float2); |
| 317 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 318 | "texture2DProjGradEXT", sampler2D, float3, float2, float2); |
| 319 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 320 | "texture2DProjGradEXT", sampler2D, float4, float2, float2); |
| 321 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 322 | "textureCubeGradEXT", samplerCube, float3, float3, float3); |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 323 | } |
| 324 | |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 325 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 326 | { |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 327 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 328 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, |
| 329 | float1); |
| 330 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, |
| 331 | float1); |
| 332 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, |
| 333 | float1); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 334 | |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 335 | if (resources.OES_standard_derivatives) |
| 336 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 337 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdx, "GL_OES_standard_derivatives", |
| 338 | genType, "dFdx", genType); |
| 339 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdy, "GL_OES_standard_derivatives", |
| 340 | genType, "dFdy", genType); |
| 341 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth, "GL_OES_standard_derivatives", |
| 342 | genType, "fwidth", genType); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 343 | } |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 344 | |
| 345 | if (resources.EXT_shader_texture_lod) |
| 346 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 347 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 348 | "texture2DLodEXT", sampler2D, float2, float1); |
| 349 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 350 | "texture2DProjLodEXT", sampler2D, float3, float1); |
| 351 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 352 | "texture2DProjLodEXT", sampler2D, float4, float1); |
| 353 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 354 | "textureCubeLodEXT", samplerCube, float3, float1); |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 355 | } |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 356 | } |
| 357 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 358 | if (type == GL_VERTEX_SHADER) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 359 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 360 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, |
| 361 | float1); |
| 362 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, |
| 363 | float1); |
| 364 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, |
| 365 | float1); |
| 366 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, |
| 367 | float1); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 368 | } |
shannonwoods@chromium.org | c6ac65f | 2013-05-30 00:02:50 +0000 | [diff] [blame] | 369 | |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 370 | const TType *gvec4 = TCache::getType(EbtGVec4); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 371 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 372 | const TType *gsampler2D = TCache::getType(EbtGSampler2D); |
| 373 | const TType *gsamplerCube = TCache::getType(EbtGSamplerCube); |
| 374 | const TType *gsampler3D = TCache::getType(EbtGSampler3D); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 375 | const TType *gsampler2DArray = TCache::getType(EbtGSampler2DArray); |
JiangYizhou | 4021932 | 2016-12-09 09:50:51 +0800 | [diff] [blame^] | 376 | const TType *gsampler2DMS = TCache::getType(EbtGSampler2DMS); |
Nicolas Capens | 73f5bf6 | 2013-06-17 16:13:33 -0400 | [diff] [blame] | 377 | |
shannonwoods@chromium.org | c6ac65f | 2013-05-30 00:02:50 +0000 | [diff] [blame] | 378 | // |
| 379 | // Texture Functions for GLSL ES 3.0 |
| 380 | // |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 381 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2); |
| 382 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3); |
| 383 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3); |
| 384 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3); |
| 385 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3); |
| 386 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4); |
| 387 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4); |
| 388 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1); |
| 389 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1); |
| 390 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1); |
| 391 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1); |
shannonwoods@chromium.org | c6ac65f | 2013-05-30 00:02:50 +0000 | [diff] [blame] | 392 | |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 393 | if (resources.OES_EGL_image_external_essl3) |
| 394 | { |
| 395 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 396 | |
| 397 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2); |
| 398 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 399 | float3); |
| 400 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 401 | float4); |
| 402 | } |
| 403 | |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 404 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 67a819f | 2013-07-09 12:08:58 -0400 | [diff] [blame] | 405 | { |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 406 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1); |
| 407 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1); |
| 408 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 409 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, |
| 410 | float1); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 411 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1); |
| 412 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1); |
| 413 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1); |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 414 | |
| 415 | if (resources.OES_EGL_image_external_essl3) |
| 416 | { |
| 417 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 418 | |
| 419 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2, |
| 420 | float1); |
| 421 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 422 | float3, float1); |
| 423 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 424 | float4, float1); |
| 425 | } |
Nicolas Capens | 67a819f | 2013-07-09 12:08:58 -0400 | [diff] [blame] | 426 | } |
| 427 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 428 | const TType *sampler2DShadow = TCache::getType(EbtSampler2DShadow); |
| 429 | const TType *samplerCubeShadow = TCache::getType(EbtSamplerCubeShadow); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 430 | const TType *sampler2DArrayShadow = TCache::getType(EbtSampler2DArrayShadow); |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 431 | |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 432 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3); |
| 433 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4); |
| 434 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4); |
| 435 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 436 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, |
| 437 | float1); |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 438 | |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 439 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 440 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 441 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, |
| 442 | float1); |
| 443 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, |
| 444 | float1); |
| 445 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, |
| 446 | float1); |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 447 | } |
| 448 | |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 449 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1); |
| 450 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1); |
| 451 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1); |
| 452 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1); |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 453 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1); |
| 454 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1); |
| 455 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1); |
JiangYizhou | 4021932 | 2016-12-09 09:50:51 +0800 | [diff] [blame^] | 456 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2DMS); |
Nicolas Capens | 75fb475 | 2013-07-10 15:14:47 -0400 | [diff] [blame] | 457 | |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 458 | if (resources.OES_EGL_image_external_essl3) |
| 459 | { |
| 460 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 461 | |
| 462 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerExternalOES, int1); |
| 463 | } |
| 464 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 465 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 466 | { |
Olli Etuaho | 687ef22 | 2015-03-03 10:58:05 +0200 | [diff] [blame] | 467 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdx, genType, "dFdx", genType); |
| 468 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdy, genType, "dFdy", genType); |
| 469 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFwidth, genType, "fwidth", genType); |
alokp@chromium.org | 0609889 | 2010-08-26 19:36:42 +0000 | [diff] [blame] | 470 | } |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 471 | |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 472 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2); |
| 473 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 474 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, |
| 475 | int2); |
| 476 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, |
| 477 | int2); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 478 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 479 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 480 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 481 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, |
| 482 | float1); |
| 483 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, |
| 484 | float1); |
| 485 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, |
| 486 | int2, float1); |
| 487 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, |
| 488 | int2, float1); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 489 | } |
Nicolas Capens | 1fbc287 | 2014-01-03 14:12:09 -0500 | [diff] [blame] | 490 | |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 491 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2); |
| 492 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2); |
| 493 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 494 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, |
| 495 | int2); |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 496 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 497 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 498 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 499 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, |
| 500 | int2, float1); |
| 501 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, |
| 502 | int2, float1); |
| 503 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, |
| 504 | int3, float1); |
| 505 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, |
| 506 | float4, int2, float1); |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 507 | } |
| 508 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 509 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, |
| 510 | int2); |
| 511 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, |
| 512 | int3); |
| 513 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, |
| 514 | float1, int2); |
| 515 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, |
| 516 | float1, int2); |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 517 | |
Nicolas Capens | 2adc256 | 2014-02-14 23:50:59 -0500 | [diff] [blame] | 518 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1); |
| 519 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1); |
| 520 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 521 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, |
| 522 | float1); |
Nicolas Capens | 2adc256 | 2014-02-14 23:50:59 -0500 | [diff] [blame] | 523 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 524 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, |
| 525 | float1, int2); |
| 526 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, |
| 527 | float1, int2); |
| 528 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, |
| 529 | float1, int3); |
| 530 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, |
| 531 | float4, float1, int2); |
Nicolas Capens | 2adc256 | 2014-02-14 23:50:59 -0500 | [diff] [blame] | 532 | |
Nicolas Capens | fc01454 | 2014-02-18 14:47:13 -0500 | [diff] [blame] | 533 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1); |
| 534 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1); |
| 535 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1); |
| 536 | |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 537 | if (resources.OES_EGL_image_external_essl3) |
| 538 | { |
| 539 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 540 | |
| 541 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texelFetch", samplerExternalOES, int2, |
| 542 | int1); |
| 543 | } |
| 544 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 545 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, |
| 546 | int2); |
| 547 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, |
| 548 | int3); |
| 549 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, |
| 550 | int1, int2); |
Nicolas Capens | fc01454 | 2014-02-18 14:47:13 -0500 | [diff] [blame] | 551 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 552 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, |
| 553 | float2); |
| 554 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, |
| 555 | float3); |
| 556 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, |
| 557 | float3); |
| 558 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, |
| 559 | float2, float2); |
| 560 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, |
| 561 | float3, float3); |
| 562 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, |
| 563 | float2); |
| 564 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, |
| 565 | float2, float2); |
Nicolas Capens | d11d549 | 2014-02-19 17:06:10 -0500 | [diff] [blame] | 566 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 567 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, |
| 568 | float2, float2, int2); |
| 569 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, |
| 570 | float3, float3, int3); |
| 571 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, |
| 572 | float2, float2, int2); |
| 573 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, |
| 574 | float2, float2, int2); |
| 575 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, |
| 576 | float4, float2, float2, int2); |
Nicolas Capens | bf7db10 | 2014-02-19 17:20:28 -0500 | [diff] [blame] | 577 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 578 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, |
| 579 | float2); |
| 580 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, |
| 581 | float2); |
| 582 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, |
| 583 | float3); |
| 584 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, |
| 585 | float2, float2); |
Nicolas Capens | f7378e3 | 2014-02-19 17:29:32 -0500 | [diff] [blame] | 586 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 587 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, |
| 588 | float2, float2, int2); |
| 589 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, |
| 590 | float2, float2, int2); |
| 591 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, |
| 592 | float3, float3, int3); |
| 593 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, |
| 594 | float4, float2, float2, int2); |
Nicolas Capens | f7378e3 | 2014-02-19 17:29:32 -0500 | [diff] [blame] | 595 | |
Martin Radev | 2cc85b3 | 2016-08-05 16:22:53 +0300 | [diff] [blame] | 596 | const TType *gimage2D = TCache::getType(EbtGImage2D); |
| 597 | const TType *gimage3D = TCache::getType(EbtGImage3D); |
| 598 | const TType *gimage2DArray = TCache::getType(EbtGImage2DArray); |
| 599 | const TType *gimageCube = TCache::getType(EbtGImageCube); |
| 600 | |
| 601 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2D, int2, gvec4); |
| 602 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage3D, int3, gvec4); |
| 603 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2DArray, int3, gvec4); |
| 604 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimageCube, int3, gvec4); |
| 605 | |
| 606 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2D, int2); |
| 607 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage3D, int3); |
| 608 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2DArray, int3); |
| 609 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimageCube, int3); |
| 610 | |
| 611 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimage2D); |
| 612 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage3D); |
| 613 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage2DArray); |
Xinghua Cao | fb02830 | 2016-11-28 18:21:57 +0800 | [diff] [blame] | 614 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimageCube); |
Martin Radev | 2cc85b3 | 2016-08-05 16:22:53 +0300 | [diff] [blame] | 615 | |
Martin Radev | d7c5b0a | 2016-07-27 14:04:43 +0300 | [diff] [blame] | 616 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrier, voidType, |
| 617 | "memoryBarrier"); |
| 618 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierAtomicCounter, |
| 619 | voidType, "memoryBarrierAtomicCounter"); |
| 620 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierBuffer, |
| 621 | voidType, "memoryBarrierBuffer"); |
| 622 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierImage, voidType, |
| 623 | "memoryBarrierImage"); |
| 624 | |
JiangYizhou | 4021932 | 2016-12-09 09:50:51 +0800 | [diff] [blame^] | 625 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "texelFetch", gsampler2DMS, int2, int1); |
| 626 | |
Martin Radev | d7c5b0a | 2016-07-27 14:04:43 +0300 | [diff] [blame] | 627 | if (type == GL_COMPUTE_SHADER) |
| 628 | { |
| 629 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpBarrier, voidType, |
| 630 | "barrier"); |
| 631 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierShared, |
| 632 | voidType, "memoryBarrierShared"); |
| 633 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpGroupMemoryBarrier, |
| 634 | voidType, "groupMemoryBarrier"); |
| 635 | } |
| 636 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 637 | // |
| 638 | // Depth range in window coordinates |
| 639 | // |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 640 | TFieldList *fields = NewPoolTFieldList(); |
Jamie Madill | 37f77d2 | 2014-04-30 16:10:13 -0400 | [diff] [blame] | 641 | TSourceLoc zeroSourceLoc = {0, 0, 0, 0}; |
Jamie Madill | e064d44 | 2016-06-21 20:00:41 -0400 | [diff] [blame] | 642 | auto highpFloat1 = new TType(EbtFloat, EbpHigh, EvqGlobal, 1); |
| 643 | TField *near = new TField(highpFloat1, NewPoolTString("near"), zeroSourceLoc); |
| 644 | TField *far = new TField(highpFloat1, NewPoolTString("far"), zeroSourceLoc); |
| 645 | TField *diff = new TField(highpFloat1, NewPoolTString("diff"), zeroSourceLoc); |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 646 | fields->push_back(near); |
| 647 | fields->push_back(far); |
| 648 | fields->push_back(diff); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 649 | TStructure *depthRangeStruct = |
| 650 | new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields); |
Jamie Madill | e064d44 | 2016-06-21 20:00:41 -0400 | [diff] [blame] | 651 | TVariable *depthRangeParameters = |
| 652 | new TVariable(&depthRangeStruct->name(), TType(depthRangeStruct), true); |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 653 | symbolTable.insert(COMMON_BUILTINS, depthRangeParameters); |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 654 | TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct)); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 655 | depthRange->setQualifier(EvqUniform); |
Jamie Madill | e064d44 | 2016-06-21 20:00:41 -0400 | [diff] [blame] | 656 | // Ensure we evaluate the mangled name for depth range, so we allocate to the current scope. |
| 657 | depthRangeParameters->getType().getMangledName(); |
| 658 | depthRange->getType().getMangledName(); |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 659 | symbolTable.insert(COMMON_BUILTINS, depthRange); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 660 | |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 661 | // |
| 662 | // Implementation dependent built-in constants. |
| 663 | // |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 664 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs, |
| 665 | EbpMedium); |
| 666 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", |
| 667 | resources.MaxVertexUniformVectors, EbpMedium); |
| 668 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", |
| 669 | resources.MaxVertexTextureImageUnits, EbpMedium); |
| 670 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", |
| 671 | resources.MaxCombinedTextureImageUnits, EbpMedium); |
| 672 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", |
| 673 | resources.MaxTextureImageUnits, EbpMedium); |
| 674 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", |
| 675 | resources.MaxFragmentUniformVectors, EbpMedium); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 676 | |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 677 | symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors, |
| 678 | EbpMedium); |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 679 | |
Qiankun Miao | c2c5fc4 | 2016-08-31 15:24:22 +0800 | [diff] [blame] | 680 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers, |
| 681 | EbpMedium); |
| 682 | if (resources.EXT_blend_func_extended) |
shannon.woods%transgaming.com@gtempaccount.com | 5209de8 | 2013-04-13 03:41:53 +0000 | [diff] [blame] | 683 | { |
Qiankun Miao | c2c5fc4 | 2016-08-31 15:24:22 +0800 | [diff] [blame] | 684 | symbolTable.insertConstIntExt(COMMON_BUILTINS, "GL_EXT_blend_func_extended", |
| 685 | "gl_MaxDualSourceDrawBuffersEXT", |
| 686 | resources.MaxDualSourceDrawBuffers); |
shannon.woods%transgaming.com@gtempaccount.com | 5209de8 | 2013-04-13 03:41:53 +0000 | [diff] [blame] | 687 | } |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 688 | |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 689 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", |
| 690 | resources.MaxVertexOutputVectors, EbpMedium); |
| 691 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors", |
| 692 | resources.MaxFragmentInputVectors, EbpMedium); |
| 693 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset", |
| 694 | resources.MinProgramTexelOffset, EbpMedium); |
| 695 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", |
| 696 | resources.MaxProgramTexelOffset, EbpMedium); |
| 697 | |
| 698 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxImageUnits", resources.MaxImageUnits, |
| 699 | EbpMedium); |
| 700 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexImageUniforms", |
| 701 | resources.MaxVertexImageUniforms, EbpMedium); |
| 702 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentImageUniforms", |
| 703 | resources.MaxFragmentImageUniforms, EbpMedium); |
| 704 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeImageUniforms", |
| 705 | resources.MaxComputeImageUniforms, EbpMedium); |
| 706 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedImageUniforms", |
| 707 | resources.MaxCombinedImageUniforms, EbpMedium); |
| 708 | |
| 709 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedShaderOutputResources", |
| 710 | resources.MaxCombinedShaderOutputResources, EbpMedium); |
| 711 | |
| 712 | symbolTable.insertConstIvec3(ESSL3_1_BUILTINS, "gl_MaxComputeWorkGroupCount", |
| 713 | resources.MaxComputeWorkGroupCount, EbpHigh); |
| 714 | symbolTable.insertConstIvec3(ESSL3_1_BUILTINS, "gl_MaxComputeWorkGroupSize", |
| 715 | resources.MaxComputeWorkGroupSize, EbpHigh); |
| 716 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeUniformComponents", |
| 717 | resources.MaxComputeUniformComponents, EbpMedium); |
| 718 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeTextureImageUnits", |
| 719 | resources.MaxComputeTextureImageUnits, EbpMedium); |
| 720 | |
| 721 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeAtomicCounters", |
| 722 | resources.MaxComputeAtomicCounters, EbpMedium); |
| 723 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeAtomicCounterBuffers", |
| 724 | resources.MaxComputeAtomicCounterBuffers, EbpMedium); |
| 725 | |
| 726 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexAtomicCounters", |
| 727 | resources.MaxVertexAtomicCounters, EbpMedium); |
| 728 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentAtomicCounters", |
| 729 | resources.MaxFragmentAtomicCounters, EbpMedium); |
| 730 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedAtomicCounters", |
| 731 | resources.MaxCombinedAtomicCounters, EbpMedium); |
| 732 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBindings", |
| 733 | resources.MaxAtomicCounterBindings, EbpMedium); |
| 734 | |
| 735 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexAtomicCounterBuffers", |
| 736 | resources.MaxVertexAtomicCounterBuffers, EbpMedium); |
| 737 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentAtomicCounterBuffers", |
| 738 | resources.MaxFragmentAtomicCounterBuffers, EbpMedium); |
| 739 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedAtomicCounterBuffers", |
| 740 | resources.MaxCombinedAtomicCounterBuffers, EbpMedium); |
| 741 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBufferSize", |
| 742 | resources.MaxAtomicCounterBufferSize, EbpMedium); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 743 | } |
| 744 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 745 | void IdentifyBuiltIns(sh::GLenum type, |
| 746 | ShShaderSpec spec, |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 747 | const ShBuiltInResources &resources, |
| 748 | TSymbolTable &symbolTable) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 749 | { |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 750 | // |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 751 | // Insert some special built-in variables that are not in |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 752 | // the built-in header files. |
| 753 | // |
Olli Etuaho | 09b04a2 | 2016-12-15 13:30:26 +0000 | [diff] [blame] | 754 | |
| 755 | if (resources.OVR_multiview && type != GL_COMPUTE_SHADER) |
| 756 | { |
| 757 | symbolTable.insert(COMMON_BUILTINS, "GL_OVR_multiview", |
| 758 | new TVariable(NewPoolTString("gl_ViewID_OVR"), |
| 759 | TType(EbtUInt, EbpHigh, EvqViewIDOVR, 1))); |
| 760 | } |
| 761 | |
Olli Etuaho | 61ffec8 | 2015-03-11 10:35:01 +0200 | [diff] [blame] | 762 | switch (type) |
| 763 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 764 | case GL_FRAGMENT_SHADER: |
| 765 | { |
| 766 | symbolTable.insert(COMMON_BUILTINS, |
| 767 | new TVariable(NewPoolTString("gl_FragCoord"), |
| 768 | TType(EbtFloat, EbpMedium, EvqFragCoord, 4))); |
| 769 | symbolTable.insert(COMMON_BUILTINS, |
| 770 | new TVariable(NewPoolTString("gl_FrontFacing"), |
| 771 | TType(EbtBool, EbpUndefined, EvqFrontFacing, 1))); |
| 772 | symbolTable.insert(COMMON_BUILTINS, |
| 773 | new TVariable(NewPoolTString("gl_PointCoord"), |
| 774 | TType(EbtFloat, EbpMedium, EvqPointCoord, 2))); |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 775 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 776 | symbolTable.insert(ESSL1_BUILTINS, |
| 777 | new TVariable(NewPoolTString("gl_FragColor"), |
| 778 | TType(EbtFloat, EbpMedium, EvqFragColor, 4))); |
| 779 | TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true); |
| 780 | fragData.setArraySize(resources.MaxDrawBuffers); |
| 781 | symbolTable.insert(ESSL1_BUILTINS, |
| 782 | new TVariable(NewPoolTString("gl_FragData"), fragData)); |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 783 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 784 | if (resources.EXT_blend_func_extended) |
| 785 | { |
| 786 | symbolTable.insert( |
| 787 | ESSL1_BUILTINS, "GL_EXT_blend_func_extended", |
| 788 | new TVariable(NewPoolTString("gl_SecondaryFragColorEXT"), |
| 789 | TType(EbtFloat, EbpMedium, EvqSecondaryFragColorEXT, 4))); |
| 790 | TType secondaryFragData(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1, true); |
| 791 | secondaryFragData.setArraySize(resources.MaxDualSourceDrawBuffers); |
| 792 | symbolTable.insert( |
| 793 | ESSL1_BUILTINS, "GL_EXT_blend_func_extended", |
| 794 | new TVariable(NewPoolTString("gl_SecondaryFragDataEXT"), secondaryFragData)); |
| 795 | } |
Kimmo Kinnunen | b18609b | 2015-07-16 14:13:11 +0300 | [diff] [blame] | 796 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 797 | if (resources.EXT_frag_depth) |
| 798 | { |
| 799 | symbolTable.insert( |
| 800 | ESSL1_BUILTINS, "GL_EXT_frag_depth", |
| 801 | new TVariable( |
| 802 | NewPoolTString("gl_FragDepthEXT"), |
| 803 | TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, |
| 804 | EvqFragDepthEXT, 1))); |
| 805 | } |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 806 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 807 | symbolTable.insert(ESSL3_BUILTINS, |
| 808 | new TVariable(NewPoolTString("gl_FragDepth"), |
| 809 | TType(EbtFloat, EbpHigh, EvqFragDepth, 1))); |
Kimmo Kinnunen | 5f0246c | 2015-07-22 10:30:35 +0300 | [diff] [blame] | 810 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 811 | if (resources.EXT_shader_framebuffer_fetch || resources.NV_shader_framebuffer_fetch) |
| 812 | { |
| 813 | TType lastFragData(EbtFloat, EbpMedium, EvqLastFragData, 4, 1, true); |
| 814 | lastFragData.setArraySize(resources.MaxDrawBuffers); |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 815 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 816 | if (resources.EXT_shader_framebuffer_fetch) |
| 817 | { |
| 818 | symbolTable.insert( |
| 819 | ESSL1_BUILTINS, "GL_EXT_shader_framebuffer_fetch", |
| 820 | new TVariable(NewPoolTString("gl_LastFragData"), lastFragData)); |
| 821 | } |
| 822 | else if (resources.NV_shader_framebuffer_fetch) |
| 823 | { |
| 824 | symbolTable.insert( |
| 825 | ESSL1_BUILTINS, "GL_NV_shader_framebuffer_fetch", |
| 826 | new TVariable(NewPoolTString("gl_LastFragColor"), |
| 827 | TType(EbtFloat, EbpMedium, EvqLastFragColor, 4))); |
| 828 | symbolTable.insert( |
| 829 | ESSL1_BUILTINS, "GL_NV_shader_framebuffer_fetch", |
| 830 | new TVariable(NewPoolTString("gl_LastFragData"), lastFragData)); |
| 831 | } |
| 832 | } |
| 833 | else if (resources.ARM_shader_framebuffer_fetch) |
| 834 | { |
| 835 | symbolTable.insert(ESSL1_BUILTINS, "GL_ARM_shader_framebuffer_fetch", |
| 836 | new TVariable(NewPoolTString("gl_LastFragColorARM"), |
| 837 | TType(EbtFloat, EbpMedium, EvqLastFragColor, 4))); |
| 838 | } |
| 839 | } |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 840 | |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 841 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 842 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 843 | case GL_VERTEX_SHADER: |
| 844 | symbolTable.insert(COMMON_BUILTINS, |
| 845 | new TVariable(NewPoolTString("gl_Position"), |
| 846 | TType(EbtFloat, EbpHigh, EvqPosition, 4))); |
| 847 | symbolTable.insert(COMMON_BUILTINS, |
| 848 | new TVariable(NewPoolTString("gl_PointSize"), |
| 849 | TType(EbtFloat, EbpMedium, EvqPointSize, 1))); |
| 850 | symbolTable.insert(ESSL3_BUILTINS, |
| 851 | new TVariable(NewPoolTString("gl_InstanceID"), |
| 852 | TType(EbtInt, EbpHigh, EvqInstanceID, 1))); |
| 853 | symbolTable.insert(ESSL3_BUILTINS, |
| 854 | new TVariable(NewPoolTString("gl_VertexID"), |
| 855 | TType(EbtInt, EbpHigh, EvqVertexID, 1))); |
| 856 | break; |
| 857 | case GL_COMPUTE_SHADER: |
| 858 | { |
| 859 | symbolTable.insert(ESSL3_1_BUILTINS, |
| 860 | new TVariable(NewPoolTString("gl_NumWorkGroups"), |
| 861 | TType(EbtUInt, EbpUndefined, EvqNumWorkGroups, 3))); |
| 862 | symbolTable.insert(ESSL3_1_BUILTINS, |
| 863 | new TVariable(NewPoolTString("gl_WorkGroupSize"), |
| 864 | TType(EbtUInt, EbpUndefined, EvqWorkGroupSize, 3))); |
| 865 | symbolTable.insert(ESSL3_1_BUILTINS, |
| 866 | new TVariable(NewPoolTString("gl_WorkGroupID"), |
| 867 | TType(EbtUInt, EbpUndefined, EvqWorkGroupID, 3))); |
| 868 | symbolTable.insert( |
| 869 | ESSL3_1_BUILTINS, |
| 870 | new TVariable(NewPoolTString("gl_LocalInvocationID"), |
| 871 | TType(EbtUInt, EbpUndefined, EvqLocalInvocationID, 3))); |
| 872 | symbolTable.insert( |
| 873 | ESSL3_1_BUILTINS, |
| 874 | new TVariable(NewPoolTString("gl_GlobalInvocationID"), |
| 875 | TType(EbtUInt, EbpUndefined, EvqGlobalInvocationID, 3))); |
| 876 | symbolTable.insert( |
| 877 | ESSL3_1_BUILTINS, |
| 878 | new TVariable(NewPoolTString("gl_LocalInvocationIndex"), |
| 879 | TType(EbtUInt, EbpUndefined, EvqLocalInvocationIndex, 1))); |
| 880 | } |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 881 | break; |
Martin Radev | b088360 | 2016-08-04 17:48:58 +0300 | [diff] [blame] | 882 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 883 | default: |
| 884 | assert(false && "Language not supported"); |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 885 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 886 | } |
| 887 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 888 | void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior) |
alokp@chromium.org | ad771eb | 2010-09-07 17:36:23 +0000 | [diff] [blame] | 889 | { |
| 890 | if (resources.OES_standard_derivatives) |
zmo@google.com | 09c323a | 2011-08-12 18:22:25 +0000 | [diff] [blame] | 891 | extBehavior["GL_OES_standard_derivatives"] = EBhUndefined; |
| 892 | if (resources.OES_EGL_image_external) |
| 893 | extBehavior["GL_OES_EGL_image_external"] = EBhUndefined; |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 894 | if (resources.OES_EGL_image_external_essl3) |
| 895 | extBehavior["GL_OES_EGL_image_external_essl3"] = EBhUndefined; |
Ian Ewell | bda7559 | 2016-04-18 17:25:54 -0400 | [diff] [blame] | 896 | if (resources.NV_EGL_stream_consumer_external) |
| 897 | extBehavior["GL_NV_EGL_stream_consumer_external"] = EBhUndefined; |
kbr@chromium.org | 205fef3 | 2011-11-22 20:50:02 +0000 | [diff] [blame] | 898 | if (resources.ARB_texture_rectangle) |
| 899 | extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined; |
Kimmo Kinnunen | b18609b | 2015-07-16 14:13:11 +0300 | [diff] [blame] | 900 | if (resources.EXT_blend_func_extended) |
| 901 | extBehavior["GL_EXT_blend_func_extended"] = EBhUndefined; |
shannon.woods@transgaming.com | 550cd09 | 2013-02-28 23:19:54 +0000 | [diff] [blame] | 902 | if (resources.EXT_draw_buffers) |
| 903 | extBehavior["GL_EXT_draw_buffers"] = EBhUndefined; |
Jamie Madill | 2aeb26a | 2013-07-08 14:02:55 -0400 | [diff] [blame] | 904 | if (resources.EXT_frag_depth) |
| 905 | extBehavior["GL_EXT_frag_depth"] = EBhUndefined; |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 906 | if (resources.EXT_shader_texture_lod) |
| 907 | extBehavior["GL_EXT_shader_texture_lod"] = EBhUndefined; |
Erik Dahlström | ea7a212 | 2014-11-17 16:15:57 +0100 | [diff] [blame] | 908 | if (resources.EXT_shader_framebuffer_fetch) |
| 909 | extBehavior["GL_EXT_shader_framebuffer_fetch"] = EBhUndefined; |
| 910 | if (resources.NV_shader_framebuffer_fetch) |
| 911 | extBehavior["GL_NV_shader_framebuffer_fetch"] = EBhUndefined; |
| 912 | if (resources.ARM_shader_framebuffer_fetch) |
| 913 | extBehavior["GL_ARM_shader_framebuffer_fetch"] = EBhUndefined; |
Olli Etuaho | 09b04a2 | 2016-12-15 13:30:26 +0000 | [diff] [blame] | 914 | if (resources.OVR_multiview) |
| 915 | { |
| 916 | extBehavior["GL_OVR_multiview"] = EBhUndefined; |
| 917 | extBehavior["GL_OVR_multiview2"] = EBhUndefined; |
| 918 | } |
alokp@chromium.org | ad771eb | 2010-09-07 17:36:23 +0000 | [diff] [blame] | 919 | } |
David Yen | 0fbd128 | 2015-02-02 14:46:09 -0800 | [diff] [blame] | 920 | |
| 921 | void ResetExtensionBehavior(TExtensionBehavior &extBehavior) |
| 922 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 923 | for (auto ext_iter = extBehavior.begin(); ext_iter != extBehavior.end(); ++ext_iter) |
David Yen | 0fbd128 | 2015-02-02 14:46:09 -0800 | [diff] [blame] | 924 | { |
| 925 | ext_iter->second = EBhUndefined; |
| 926 | } |
| 927 | } |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 928 | |
| 929 | } // namespace sh |