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 | // |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 173 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat2, "matrixCompMult", mat2, mat2); |
| 174 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat3, "matrixCompMult", mat3, mat3); |
| 175 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat4, "matrixCompMult", mat4, mat4); |
| 176 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x3, "matrixCompMult", mat2x3, mat2x3); |
| 177 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x2, "matrixCompMult", mat3x2, mat3x2); |
| 178 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x4, "matrixCompMult", mat2x4, mat2x4); |
| 179 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x2, "matrixCompMult", mat4x2, mat4x2); |
| 180 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x4, "matrixCompMult", mat3x4, mat3x4); |
| 181 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x3, "matrixCompMult", mat4x3, mat4x3); |
Olli Etuaho | e39706d | 2014-12-30 16:40:36 +0200 | [diff] [blame] | 182 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 183 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2, "outerProduct", float2, |
| 184 | float2); |
| 185 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3, "outerProduct", float3, |
| 186 | float3); |
| 187 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4, "outerProduct", float4, |
| 188 | float4); |
| 189 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, "outerProduct", float3, |
| 190 | float2); |
| 191 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, "outerProduct", float2, |
| 192 | float3); |
| 193 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, "outerProduct", float4, |
| 194 | float2); |
| 195 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, "outerProduct", float2, |
| 196 | float4); |
| 197 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, "outerProduct", float4, |
| 198 | float3); |
| 199 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, "outerProduct", float3, |
| 200 | float4); |
Olli Etuaho | e39706d | 2014-12-30 16:40:36 +0200 | [diff] [blame] | 201 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 202 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2, "transpose", mat2); |
| 203 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3, "transpose", mat3); |
| 204 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4, "transpose", mat4); |
| 205 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x3, "transpose", mat3x2); |
| 206 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x2, "transpose", mat2x3); |
| 207 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x4, "transpose", mat4x2); |
| 208 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x2, "transpose", mat2x4); |
| 209 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x4, "transpose", mat4x3); |
| 210 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x3, "transpose", mat3x4); |
Olli Etuaho | e39706d | 2014-12-30 16:40:36 +0200 | [diff] [blame] | 211 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 212 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat2); |
| 213 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat3); |
| 214 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat4); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 215 | |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 216 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat2, "inverse", mat2); |
| 217 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat3, "inverse", mat3); |
| 218 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat4, "inverse", mat4); |
Olli Etuaho | abf6dad | 2015-01-14 14:45:16 +0200 | [diff] [blame] | 219 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 220 | const TType *vec = TCache::getType(EbtVec); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 221 | const TType *ivec = TCache::getType(EbtIVec); |
| 222 | const TType *uvec = TCache::getType(EbtUVec); |
| 223 | const TType *bvec = TCache::getType(EbtBVec); |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 224 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 225 | // |
| 226 | // Vector relational functions. |
| 227 | // |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 228 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, "lessThan", vec, vec); |
| 229 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, "lessThan", ivec, ivec); |
| 230 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThan, bvec, "lessThan", uvec, uvec); |
| 231 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", vec, vec); |
| 232 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", ivec, ivec); |
| 233 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", uvec, uvec); |
| 234 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, "greaterThan", vec, vec); |
| 235 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, "greaterThan", ivec, ivec); |
| 236 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThan, bvec, "greaterThan", uvec, uvec); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 237 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", vec, |
| 238 | vec); |
| 239 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", ivec, |
| 240 | ivec); |
| 241 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", uvec, |
| 242 | uvec); |
Nicolas Capens | 482907e | 2015-02-23 16:56:33 -0500 | [diff] [blame] | 243 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", vec, vec); |
| 244 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", ivec, ivec); |
| 245 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorEqual, bvec, "equal", uvec, uvec); |
| 246 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", bvec, bvec); |
| 247 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", vec, vec); |
| 248 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", ivec, ivec); |
| 249 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", uvec, uvec); |
| 250 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", bvec, bvec); |
| 251 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAny, bool1, "any", bvec); |
| 252 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAll, bool1, "all", bvec); |
| 253 | symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorLogicalNot, bvec, "not", bvec); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 254 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 255 | const TType *sampler2D = TCache::getType(EbtSampler2D); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 256 | const TType *samplerCube = TCache::getType(EbtSamplerCube); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 257 | |
| 258 | // |
| 259 | // Texture Functions for GLSL ES 1.0 |
| 260 | // |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 261 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2); |
| 262 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3); |
| 263 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4); |
| 264 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 265 | |
Ian Ewell | bda7559 | 2016-04-18 17:25:54 -0400 | [diff] [blame] | 266 | if (resources.OES_EGL_image_external || resources.NV_EGL_stream_consumer_external) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 267 | { |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 268 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 269 | |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 270 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 271 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, |
| 272 | float3); |
| 273 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, |
| 274 | float4); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 275 | } |
| 276 | |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 277 | if (resources.ARB_texture_rectangle) |
| 278 | { |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 279 | const TType *sampler2DRect = TCache::getType(EbtSampler2DRect); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 280 | |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 281 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRect", sampler2DRect, float2); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 282 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, |
| 283 | float3); |
| 284 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, |
| 285 | float4); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 286 | } |
| 287 | |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 288 | if (resources.EXT_shader_texture_lod) |
| 289 | { |
| 290 | /* The *Grad* variants are new to both vertex and fragment shaders; the fragment |
| 291 | * shader specific pieces are added separately below. |
| 292 | */ |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 293 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 294 | "texture2DGradEXT", sampler2D, float2, float2, float2); |
| 295 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 296 | "texture2DProjGradEXT", sampler2D, float3, float2, float2); |
| 297 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 298 | "texture2DProjGradEXT", sampler2D, float4, float2, float2); |
| 299 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 300 | "textureCubeGradEXT", samplerCube, float3, float3, float3); |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 301 | } |
| 302 | |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 303 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 304 | { |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 305 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 306 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, |
| 307 | float1); |
| 308 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, |
| 309 | float1); |
| 310 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, |
| 311 | float1); |
shannonwoods@chromium.org | 2ac0be9 | 2013-05-30 00:02:27 +0000 | [diff] [blame] | 312 | |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 313 | if (resources.OES_standard_derivatives) |
| 314 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 315 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdx, "GL_OES_standard_derivatives", |
| 316 | genType, "dFdx", genType); |
| 317 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdy, "GL_OES_standard_derivatives", |
| 318 | genType, "dFdy", genType); |
| 319 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth, "GL_OES_standard_derivatives", |
| 320 | genType, "fwidth", genType); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 321 | } |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 322 | |
| 323 | if (resources.EXT_shader_texture_lod) |
| 324 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 325 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 326 | "texture2DLodEXT", sampler2D, float2, float1); |
| 327 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 328 | "texture2DProjLodEXT", sampler2D, float3, float1); |
| 329 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 330 | "texture2DProjLodEXT", sampler2D, float4, float1); |
| 331 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, "GL_EXT_shader_texture_lod", float4, |
| 332 | "textureCubeLodEXT", samplerCube, float3, float1); |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 333 | } |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 334 | } |
| 335 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 336 | if (type == GL_VERTEX_SHADER) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 337 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 338 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, |
| 339 | float1); |
| 340 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, |
| 341 | float1); |
| 342 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, |
| 343 | float1); |
| 344 | symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, |
| 345 | float1); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 346 | } |
shannonwoods@chromium.org | c6ac65f | 2013-05-30 00:02:50 +0000 | [diff] [blame] | 347 | |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 348 | const TType *gvec4 = TCache::getType(EbtGVec4); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 349 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 350 | const TType *gsampler2D = TCache::getType(EbtGSampler2D); |
| 351 | const TType *gsamplerCube = TCache::getType(EbtGSamplerCube); |
| 352 | const TType *gsampler3D = TCache::getType(EbtGSampler3D); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 353 | const TType *gsampler2DArray = TCache::getType(EbtGSampler2DArray); |
Nicolas Capens | 73f5bf6 | 2013-06-17 16:13:33 -0400 | [diff] [blame] | 354 | |
shannonwoods@chromium.org | c6ac65f | 2013-05-30 00:02:50 +0000 | [diff] [blame] | 355 | // |
| 356 | // Texture Functions for GLSL ES 3.0 |
| 357 | // |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 358 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2); |
| 359 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3); |
| 360 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3); |
| 361 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3); |
| 362 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3); |
| 363 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4); |
| 364 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4); |
| 365 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1); |
| 366 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1); |
| 367 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1); |
| 368 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1); |
shannonwoods@chromium.org | c6ac65f | 2013-05-30 00:02:50 +0000 | [diff] [blame] | 369 | |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 370 | if (resources.OES_EGL_image_external_essl3) |
| 371 | { |
| 372 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 373 | |
| 374 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2); |
| 375 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 376 | float3); |
| 377 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 378 | float4); |
| 379 | } |
| 380 | |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 381 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 67a819f | 2013-07-09 12:08:58 -0400 | [diff] [blame] | 382 | { |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 383 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1); |
| 384 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1); |
| 385 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 386 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, |
| 387 | float1); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 388 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1); |
| 389 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1); |
| 390 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1); |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 391 | |
| 392 | if (resources.OES_EGL_image_external_essl3) |
| 393 | { |
| 394 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 395 | |
| 396 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2, |
| 397 | float1); |
| 398 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 399 | float3, float1); |
| 400 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, |
| 401 | float4, float1); |
| 402 | } |
Nicolas Capens | 67a819f | 2013-07-09 12:08:58 -0400 | [diff] [blame] | 403 | } |
| 404 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 405 | const TType *sampler2DShadow = TCache::getType(EbtSampler2DShadow); |
| 406 | const TType *samplerCubeShadow = TCache::getType(EbtSamplerCubeShadow); |
Dmitry Skiba | 0197111 | 2015-07-10 14:54:00 -0400 | [diff] [blame] | 407 | const TType *sampler2DArrayShadow = TCache::getType(EbtSampler2DArrayShadow); |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 408 | |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 409 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3); |
| 410 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4); |
| 411 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4); |
| 412 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 413 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, |
| 414 | float1); |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 415 | |
Jamie Madill | 183bde5 | 2014-07-02 15:31:19 -0400 | [diff] [blame] | 416 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 417 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 418 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, |
| 419 | float1); |
| 420 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, |
| 421 | float1); |
| 422 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, |
| 423 | float1); |
Nicolas Capens | 77c9d1a | 2013-07-11 11:10:34 -0400 | [diff] [blame] | 424 | } |
| 425 | |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 426 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1); |
| 427 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1); |
| 428 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1); |
| 429 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1); |
Nicolas Capens | 8f80e02 | 2013-07-11 11:20:50 -0400 | [diff] [blame] | 430 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1); |
| 431 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1); |
| 432 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1); |
Nicolas Capens | 75fb475 | 2013-07-10 15:14:47 -0400 | [diff] [blame] | 433 | |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 434 | if (resources.OES_EGL_image_external_essl3) |
| 435 | { |
| 436 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 437 | |
| 438 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerExternalOES, int1); |
| 439 | } |
| 440 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 441 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 442 | { |
Olli Etuaho | 687ef22 | 2015-03-03 10:58:05 +0200 | [diff] [blame] | 443 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdx, genType, "dFdx", genType); |
| 444 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdy, genType, "dFdy", genType); |
| 445 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFwidth, genType, "fwidth", genType); |
alokp@chromium.org | 0609889 | 2010-08-26 19:36:42 +0000 | [diff] [blame] | 446 | } |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 447 | |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 448 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2); |
| 449 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 450 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, |
| 451 | int2); |
| 452 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, |
| 453 | int2); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 454 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 455 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 456 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 457 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, |
| 458 | float1); |
| 459 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, |
| 460 | float1); |
| 461 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, |
| 462 | int2, float1); |
| 463 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, |
| 464 | int2, float1); |
Nicolas Capens | 4fd5e4a | 2014-02-14 18:17:15 -0500 | [diff] [blame] | 465 | } |
Nicolas Capens | 1fbc287 | 2014-01-03 14:12:09 -0500 | [diff] [blame] | 466 | |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 467 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2); |
| 468 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2); |
| 469 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 470 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, |
| 471 | int2); |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 472 | |
Nicolas Capens | f3cc4ae | 2015-02-23 13:51:25 -0500 | [diff] [blame] | 473 | if (type == GL_FRAGMENT_SHADER) |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 474 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 475 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, |
| 476 | int2, float1); |
| 477 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, |
| 478 | int2, float1); |
| 479 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, |
| 480 | int3, float1); |
| 481 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, |
| 482 | float4, int2, float1); |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 483 | } |
| 484 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 485 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, |
| 486 | int2); |
| 487 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, |
| 488 | int3); |
| 489 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, |
| 490 | float1, int2); |
| 491 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, |
| 492 | float1, int2); |
Nicolas Capens | df86c6b | 2014-02-14 20:09:17 -0500 | [diff] [blame] | 493 | |
Nicolas Capens | 2adc256 | 2014-02-14 23:50:59 -0500 | [diff] [blame] | 494 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1); |
| 495 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1); |
| 496 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 497 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, |
| 498 | float1); |
Nicolas Capens | 2adc256 | 2014-02-14 23:50:59 -0500 | [diff] [blame] | 499 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 500 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, |
| 501 | float1, int2); |
| 502 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, |
| 503 | float1, int2); |
| 504 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, |
| 505 | float1, int3); |
| 506 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, |
| 507 | float4, float1, int2); |
Nicolas Capens | 2adc256 | 2014-02-14 23:50:59 -0500 | [diff] [blame] | 508 | |
Nicolas Capens | fc01454 | 2014-02-18 14:47:13 -0500 | [diff] [blame] | 509 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1); |
| 510 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1); |
| 511 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1); |
| 512 | |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 513 | if (resources.OES_EGL_image_external_essl3) |
| 514 | { |
| 515 | const TType *samplerExternalOES = TCache::getType(EbtSamplerExternalOES); |
| 516 | |
| 517 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texelFetch", samplerExternalOES, int2, |
| 518 | int1); |
| 519 | } |
| 520 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 521 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, |
| 522 | int2); |
| 523 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, |
| 524 | int3); |
| 525 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, |
| 526 | int1, int2); |
Nicolas Capens | fc01454 | 2014-02-18 14:47:13 -0500 | [diff] [blame] | 527 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 528 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, |
| 529 | float2); |
| 530 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, |
| 531 | float3); |
| 532 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, |
| 533 | float3); |
| 534 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, |
| 535 | float2, float2); |
| 536 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, |
| 537 | float3, float3); |
| 538 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, |
| 539 | float2); |
| 540 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, |
| 541 | float2, float2); |
Nicolas Capens | d11d549 | 2014-02-19 17:06:10 -0500 | [diff] [blame] | 542 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 543 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, |
| 544 | float2, float2, int2); |
| 545 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, |
| 546 | float3, float3, int3); |
| 547 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, |
| 548 | float2, float2, int2); |
| 549 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, |
| 550 | float2, float2, int2); |
| 551 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, |
| 552 | float4, float2, float2, int2); |
Nicolas Capens | bf7db10 | 2014-02-19 17:20:28 -0500 | [diff] [blame] | 553 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 554 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, |
| 555 | float2); |
| 556 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, |
| 557 | float2); |
| 558 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, |
| 559 | float3); |
| 560 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, |
| 561 | float2, float2); |
Nicolas Capens | f7378e3 | 2014-02-19 17:29:32 -0500 | [diff] [blame] | 562 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 563 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, |
| 564 | float2, float2, int2); |
| 565 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, |
| 566 | float2, float2, int2); |
| 567 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, |
| 568 | float3, float3, int3); |
| 569 | symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, |
| 570 | float4, float2, float2, int2); |
Nicolas Capens | f7378e3 | 2014-02-19 17:29:32 -0500 | [diff] [blame] | 571 | |
Martin Radev | 2cc85b3 | 2016-08-05 16:22:53 +0300 | [diff] [blame] | 572 | const TType *gimage2D = TCache::getType(EbtGImage2D); |
| 573 | const TType *gimage3D = TCache::getType(EbtGImage3D); |
| 574 | const TType *gimage2DArray = TCache::getType(EbtGImage2DArray); |
| 575 | const TType *gimageCube = TCache::getType(EbtGImageCube); |
| 576 | |
| 577 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2D, int2, gvec4); |
| 578 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage3D, int3, gvec4); |
| 579 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2DArray, int3, gvec4); |
| 580 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimageCube, int3, gvec4); |
| 581 | |
| 582 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2D, int2); |
| 583 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage3D, int3); |
| 584 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2DArray, int3); |
| 585 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimageCube, int3); |
| 586 | |
| 587 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimage2D); |
| 588 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage3D); |
| 589 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage2DArray); |
Xinghua Cao | fb02830 | 2016-11-28 18:21:57 +0800 | [diff] [blame] | 590 | symbolTable.insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimageCube); |
Martin Radev | 2cc85b3 | 2016-08-05 16:22:53 +0300 | [diff] [blame] | 591 | |
Martin Radev | d7c5b0a | 2016-07-27 14:04:43 +0300 | [diff] [blame^] | 592 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrier, voidType, |
| 593 | "memoryBarrier"); |
| 594 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierAtomicCounter, |
| 595 | voidType, "memoryBarrierAtomicCounter"); |
| 596 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierBuffer, |
| 597 | voidType, "memoryBarrierBuffer"); |
| 598 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierImage, voidType, |
| 599 | "memoryBarrierImage"); |
| 600 | |
| 601 | if (type == GL_COMPUTE_SHADER) |
| 602 | { |
| 603 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpBarrier, voidType, |
| 604 | "barrier"); |
| 605 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierShared, |
| 606 | voidType, "memoryBarrierShared"); |
| 607 | symbolTable.insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpGroupMemoryBarrier, |
| 608 | voidType, "groupMemoryBarrier"); |
| 609 | } |
| 610 | |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 611 | // |
| 612 | // Depth range in window coordinates |
| 613 | // |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 614 | TFieldList *fields = NewPoolTFieldList(); |
Jamie Madill | 37f77d2 | 2014-04-30 16:10:13 -0400 | [diff] [blame] | 615 | TSourceLoc zeroSourceLoc = {0, 0, 0, 0}; |
Jamie Madill | e064d44 | 2016-06-21 20:00:41 -0400 | [diff] [blame] | 616 | auto highpFloat1 = new TType(EbtFloat, EbpHigh, EvqGlobal, 1); |
| 617 | TField *near = new TField(highpFloat1, NewPoolTString("near"), zeroSourceLoc); |
| 618 | TField *far = new TField(highpFloat1, NewPoolTString("far"), zeroSourceLoc); |
| 619 | TField *diff = new TField(highpFloat1, NewPoolTString("diff"), zeroSourceLoc); |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 620 | fields->push_back(near); |
| 621 | fields->push_back(far); |
| 622 | fields->push_back(diff); |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 623 | TStructure *depthRangeStruct = |
| 624 | new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields); |
Jamie Madill | e064d44 | 2016-06-21 20:00:41 -0400 | [diff] [blame] | 625 | TVariable *depthRangeParameters = |
| 626 | new TVariable(&depthRangeStruct->name(), TType(depthRangeStruct), true); |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 627 | symbolTable.insert(COMMON_BUILTINS, depthRangeParameters); |
Jamie Madill | 98493dd | 2013-07-08 14:39:03 -0400 | [diff] [blame] | 628 | TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct)); |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 629 | depthRange->setQualifier(EvqUniform); |
Jamie Madill | e064d44 | 2016-06-21 20:00:41 -0400 | [diff] [blame] | 630 | // Ensure we evaluate the mangled name for depth range, so we allocate to the current scope. |
| 631 | depthRangeParameters->getType().getMangledName(); |
| 632 | depthRange->getType().getMangledName(); |
Nicolas Capens | adfffe4 | 2014-06-17 02:13:36 -0400 | [diff] [blame] | 633 | symbolTable.insert(COMMON_BUILTINS, depthRange); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 634 | |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 635 | // |
| 636 | // Implementation dependent built-in constants. |
| 637 | // |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 638 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs, |
| 639 | EbpMedium); |
| 640 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", |
| 641 | resources.MaxVertexUniformVectors, EbpMedium); |
| 642 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", |
| 643 | resources.MaxVertexTextureImageUnits, EbpMedium); |
| 644 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", |
| 645 | resources.MaxCombinedTextureImageUnits, EbpMedium); |
| 646 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", |
| 647 | resources.MaxTextureImageUnits, EbpMedium); |
| 648 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", |
| 649 | resources.MaxFragmentUniformVectors, EbpMedium); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 650 | |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 651 | symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors, |
| 652 | EbpMedium); |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 653 | |
Qiankun Miao | c2c5fc4 | 2016-08-31 15:24:22 +0800 | [diff] [blame] | 654 | symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers, |
| 655 | EbpMedium); |
| 656 | if (resources.EXT_blend_func_extended) |
shannon.woods%transgaming.com@gtempaccount.com | 5209de8 | 2013-04-13 03:41:53 +0000 | [diff] [blame] | 657 | { |
Qiankun Miao | c2c5fc4 | 2016-08-31 15:24:22 +0800 | [diff] [blame] | 658 | symbolTable.insertConstIntExt(COMMON_BUILTINS, "GL_EXT_blend_func_extended", |
| 659 | "gl_MaxDualSourceDrawBuffersEXT", |
| 660 | resources.MaxDualSourceDrawBuffers); |
shannon.woods%transgaming.com@gtempaccount.com | 5209de8 | 2013-04-13 03:41:53 +0000 | [diff] [blame] | 661 | } |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 662 | |
Martin Radev | e93d24e | 2016-07-28 12:06:05 +0300 | [diff] [blame] | 663 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", |
| 664 | resources.MaxVertexOutputVectors, EbpMedium); |
| 665 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors", |
| 666 | resources.MaxFragmentInputVectors, EbpMedium); |
| 667 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset", |
| 668 | resources.MinProgramTexelOffset, EbpMedium); |
| 669 | symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", |
| 670 | resources.MaxProgramTexelOffset, EbpMedium); |
| 671 | |
| 672 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxImageUnits", resources.MaxImageUnits, |
| 673 | EbpMedium); |
| 674 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexImageUniforms", |
| 675 | resources.MaxVertexImageUniforms, EbpMedium); |
| 676 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentImageUniforms", |
| 677 | resources.MaxFragmentImageUniforms, EbpMedium); |
| 678 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeImageUniforms", |
| 679 | resources.MaxComputeImageUniforms, EbpMedium); |
| 680 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedImageUniforms", |
| 681 | resources.MaxCombinedImageUniforms, EbpMedium); |
| 682 | |
| 683 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedShaderOutputResources", |
| 684 | resources.MaxCombinedShaderOutputResources, EbpMedium); |
| 685 | |
| 686 | symbolTable.insertConstIvec3(ESSL3_1_BUILTINS, "gl_MaxComputeWorkGroupCount", |
| 687 | resources.MaxComputeWorkGroupCount, EbpHigh); |
| 688 | symbolTable.insertConstIvec3(ESSL3_1_BUILTINS, "gl_MaxComputeWorkGroupSize", |
| 689 | resources.MaxComputeWorkGroupSize, EbpHigh); |
| 690 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeUniformComponents", |
| 691 | resources.MaxComputeUniformComponents, EbpMedium); |
| 692 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeTextureImageUnits", |
| 693 | resources.MaxComputeTextureImageUnits, EbpMedium); |
| 694 | |
| 695 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeAtomicCounters", |
| 696 | resources.MaxComputeAtomicCounters, EbpMedium); |
| 697 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxComputeAtomicCounterBuffers", |
| 698 | resources.MaxComputeAtomicCounterBuffers, EbpMedium); |
| 699 | |
| 700 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexAtomicCounters", |
| 701 | resources.MaxVertexAtomicCounters, EbpMedium); |
| 702 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentAtomicCounters", |
| 703 | resources.MaxFragmentAtomicCounters, EbpMedium); |
| 704 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedAtomicCounters", |
| 705 | resources.MaxCombinedAtomicCounters, EbpMedium); |
| 706 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBindings", |
| 707 | resources.MaxAtomicCounterBindings, EbpMedium); |
| 708 | |
| 709 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxVertexAtomicCounterBuffers", |
| 710 | resources.MaxVertexAtomicCounterBuffers, EbpMedium); |
| 711 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxFragmentAtomicCounterBuffers", |
| 712 | resources.MaxFragmentAtomicCounterBuffers, EbpMedium); |
| 713 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxCombinedAtomicCounterBuffers", |
| 714 | resources.MaxCombinedAtomicCounterBuffers, EbpMedium); |
| 715 | symbolTable.insertConstInt(ESSL3_1_BUILTINS, "gl_MaxAtomicCounterBufferSize", |
| 716 | resources.MaxAtomicCounterBufferSize, EbpMedium); |
alokp@chromium.org | e4249f0 | 2010-07-26 18:13:52 +0000 | [diff] [blame] | 717 | } |
| 718 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 719 | void IdentifyBuiltIns(sh::GLenum type, |
| 720 | ShShaderSpec spec, |
Nicolas Capens | 49a8887 | 2013-06-20 09:54:03 -0400 | [diff] [blame] | 721 | const ShBuiltInResources &resources, |
| 722 | TSymbolTable &symbolTable) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 723 | { |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 724 | // |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 725 | // Insert some special built-in variables that are not in |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 726 | // the built-in header files. |
| 727 | // |
Olli Etuaho | 09b04a2 | 2016-12-15 13:30:26 +0000 | [diff] [blame] | 728 | |
| 729 | if (resources.OVR_multiview && type != GL_COMPUTE_SHADER) |
| 730 | { |
| 731 | symbolTable.insert(COMMON_BUILTINS, "GL_OVR_multiview", |
| 732 | new TVariable(NewPoolTString("gl_ViewID_OVR"), |
| 733 | TType(EbtUInt, EbpHigh, EvqViewIDOVR, 1))); |
| 734 | } |
| 735 | |
Olli Etuaho | 61ffec8 | 2015-03-11 10:35:01 +0200 | [diff] [blame] | 736 | switch (type) |
| 737 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 738 | case GL_FRAGMENT_SHADER: |
| 739 | { |
| 740 | symbolTable.insert(COMMON_BUILTINS, |
| 741 | new TVariable(NewPoolTString("gl_FragCoord"), |
| 742 | TType(EbtFloat, EbpMedium, EvqFragCoord, 4))); |
| 743 | symbolTable.insert(COMMON_BUILTINS, |
| 744 | new TVariable(NewPoolTString("gl_FrontFacing"), |
| 745 | TType(EbtBool, EbpUndefined, EvqFrontFacing, 1))); |
| 746 | symbolTable.insert(COMMON_BUILTINS, |
| 747 | new TVariable(NewPoolTString("gl_PointCoord"), |
| 748 | TType(EbtFloat, EbpMedium, EvqPointCoord, 2))); |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 749 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 750 | symbolTable.insert(ESSL1_BUILTINS, |
| 751 | new TVariable(NewPoolTString("gl_FragColor"), |
| 752 | TType(EbtFloat, EbpMedium, EvqFragColor, 4))); |
| 753 | TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true); |
| 754 | fragData.setArraySize(resources.MaxDrawBuffers); |
| 755 | symbolTable.insert(ESSL1_BUILTINS, |
| 756 | new TVariable(NewPoolTString("gl_FragData"), fragData)); |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 757 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 758 | if (resources.EXT_blend_func_extended) |
| 759 | { |
| 760 | symbolTable.insert( |
| 761 | ESSL1_BUILTINS, "GL_EXT_blend_func_extended", |
| 762 | new TVariable(NewPoolTString("gl_SecondaryFragColorEXT"), |
| 763 | TType(EbtFloat, EbpMedium, EvqSecondaryFragColorEXT, 4))); |
| 764 | TType secondaryFragData(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1, true); |
| 765 | secondaryFragData.setArraySize(resources.MaxDualSourceDrawBuffers); |
| 766 | symbolTable.insert( |
| 767 | ESSL1_BUILTINS, "GL_EXT_blend_func_extended", |
| 768 | new TVariable(NewPoolTString("gl_SecondaryFragDataEXT"), secondaryFragData)); |
| 769 | } |
Kimmo Kinnunen | b18609b | 2015-07-16 14:13:11 +0300 | [diff] [blame] | 770 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 771 | if (resources.EXT_frag_depth) |
| 772 | { |
| 773 | symbolTable.insert( |
| 774 | ESSL1_BUILTINS, "GL_EXT_frag_depth", |
| 775 | new TVariable( |
| 776 | NewPoolTString("gl_FragDepthEXT"), |
| 777 | TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, |
| 778 | EvqFragDepthEXT, 1))); |
| 779 | } |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 780 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 781 | symbolTable.insert(ESSL3_BUILTINS, |
| 782 | new TVariable(NewPoolTString("gl_FragDepth"), |
| 783 | TType(EbtFloat, EbpHigh, EvqFragDepth, 1))); |
Kimmo Kinnunen | 5f0246c | 2015-07-22 10:30:35 +0300 | [diff] [blame] | 784 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 785 | if (resources.EXT_shader_framebuffer_fetch || resources.NV_shader_framebuffer_fetch) |
| 786 | { |
| 787 | TType lastFragData(EbtFloat, EbpMedium, EvqLastFragData, 4, 1, true); |
| 788 | lastFragData.setArraySize(resources.MaxDrawBuffers); |
Olli Etuaho | 4f52da4 | 2015-03-11 10:48:41 +0200 | [diff] [blame] | 789 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 790 | if (resources.EXT_shader_framebuffer_fetch) |
| 791 | { |
| 792 | symbolTable.insert( |
| 793 | ESSL1_BUILTINS, "GL_EXT_shader_framebuffer_fetch", |
| 794 | new TVariable(NewPoolTString("gl_LastFragData"), lastFragData)); |
| 795 | } |
| 796 | else if (resources.NV_shader_framebuffer_fetch) |
| 797 | { |
| 798 | symbolTable.insert( |
| 799 | ESSL1_BUILTINS, "GL_NV_shader_framebuffer_fetch", |
| 800 | new TVariable(NewPoolTString("gl_LastFragColor"), |
| 801 | TType(EbtFloat, EbpMedium, EvqLastFragColor, 4))); |
| 802 | symbolTable.insert( |
| 803 | ESSL1_BUILTINS, "GL_NV_shader_framebuffer_fetch", |
| 804 | new TVariable(NewPoolTString("gl_LastFragData"), lastFragData)); |
| 805 | } |
| 806 | } |
| 807 | else if (resources.ARM_shader_framebuffer_fetch) |
| 808 | { |
| 809 | symbolTable.insert(ESSL1_BUILTINS, "GL_ARM_shader_framebuffer_fetch", |
| 810 | new TVariable(NewPoolTString("gl_LastFragColorARM"), |
| 811 | TType(EbtFloat, EbpMedium, EvqLastFragColor, 4))); |
| 812 | } |
| 813 | } |
maxvujovic@gmail.com | 430f5e0 | 2012-06-08 17:47:59 +0000 | [diff] [blame] | 814 | |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 815 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 816 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 817 | case GL_VERTEX_SHADER: |
| 818 | symbolTable.insert(COMMON_BUILTINS, |
| 819 | new TVariable(NewPoolTString("gl_Position"), |
| 820 | TType(EbtFloat, EbpHigh, EvqPosition, 4))); |
| 821 | symbolTable.insert(COMMON_BUILTINS, |
| 822 | new TVariable(NewPoolTString("gl_PointSize"), |
| 823 | TType(EbtFloat, EbpMedium, EvqPointSize, 1))); |
| 824 | symbolTable.insert(ESSL3_BUILTINS, |
| 825 | new TVariable(NewPoolTString("gl_InstanceID"), |
| 826 | TType(EbtInt, EbpHigh, EvqInstanceID, 1))); |
| 827 | symbolTable.insert(ESSL3_BUILTINS, |
| 828 | new TVariable(NewPoolTString("gl_VertexID"), |
| 829 | TType(EbtInt, EbpHigh, EvqVertexID, 1))); |
| 830 | break; |
| 831 | case GL_COMPUTE_SHADER: |
| 832 | { |
| 833 | symbolTable.insert(ESSL3_1_BUILTINS, |
| 834 | new TVariable(NewPoolTString("gl_NumWorkGroups"), |
| 835 | TType(EbtUInt, EbpUndefined, EvqNumWorkGroups, 3))); |
| 836 | symbolTable.insert(ESSL3_1_BUILTINS, |
| 837 | new TVariable(NewPoolTString("gl_WorkGroupSize"), |
| 838 | TType(EbtUInt, EbpUndefined, EvqWorkGroupSize, 3))); |
| 839 | symbolTable.insert(ESSL3_1_BUILTINS, |
| 840 | new TVariable(NewPoolTString("gl_WorkGroupID"), |
| 841 | TType(EbtUInt, EbpUndefined, EvqWorkGroupID, 3))); |
| 842 | symbolTable.insert( |
| 843 | ESSL3_1_BUILTINS, |
| 844 | new TVariable(NewPoolTString("gl_LocalInvocationID"), |
| 845 | TType(EbtUInt, EbpUndefined, EvqLocalInvocationID, 3))); |
| 846 | symbolTable.insert( |
| 847 | ESSL3_1_BUILTINS, |
| 848 | new TVariable(NewPoolTString("gl_GlobalInvocationID"), |
| 849 | TType(EbtUInt, EbpUndefined, EvqGlobalInvocationID, 3))); |
| 850 | symbolTable.insert( |
| 851 | ESSL3_1_BUILTINS, |
| 852 | new TVariable(NewPoolTString("gl_LocalInvocationIndex"), |
| 853 | TType(EbtUInt, EbpUndefined, EvqLocalInvocationIndex, 1))); |
| 854 | } |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 855 | break; |
Martin Radev | b088360 | 2016-08-04 17:48:58 +0300 | [diff] [blame] | 856 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 857 | default: |
| 858 | assert(false && "Language not supported"); |
daniel@transgaming.com | 0578f81 | 2010-05-17 09:58:39 +0000 | [diff] [blame] | 859 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 860 | } |
| 861 | |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 862 | void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavior &extBehavior) |
alokp@chromium.org | ad771eb | 2010-09-07 17:36:23 +0000 | [diff] [blame] | 863 | { |
| 864 | if (resources.OES_standard_derivatives) |
zmo@google.com | 09c323a | 2011-08-12 18:22:25 +0000 | [diff] [blame] | 865 | extBehavior["GL_OES_standard_derivatives"] = EBhUndefined; |
| 866 | if (resources.OES_EGL_image_external) |
| 867 | extBehavior["GL_OES_EGL_image_external"] = EBhUndefined; |
Geoff Lang | b66a909 | 2016-05-16 15:59:14 -0400 | [diff] [blame] | 868 | if (resources.OES_EGL_image_external_essl3) |
| 869 | extBehavior["GL_OES_EGL_image_external_essl3"] = EBhUndefined; |
Ian Ewell | bda7559 | 2016-04-18 17:25:54 -0400 | [diff] [blame] | 870 | if (resources.NV_EGL_stream_consumer_external) |
| 871 | extBehavior["GL_NV_EGL_stream_consumer_external"] = EBhUndefined; |
kbr@chromium.org | 205fef3 | 2011-11-22 20:50:02 +0000 | [diff] [blame] | 872 | if (resources.ARB_texture_rectangle) |
| 873 | extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined; |
Kimmo Kinnunen | b18609b | 2015-07-16 14:13:11 +0300 | [diff] [blame] | 874 | if (resources.EXT_blend_func_extended) |
| 875 | extBehavior["GL_EXT_blend_func_extended"] = EBhUndefined; |
shannon.woods@transgaming.com | 550cd09 | 2013-02-28 23:19:54 +0000 | [diff] [blame] | 876 | if (resources.EXT_draw_buffers) |
| 877 | extBehavior["GL_EXT_draw_buffers"] = EBhUndefined; |
Jamie Madill | 2aeb26a | 2013-07-08 14:02:55 -0400 | [diff] [blame] | 878 | if (resources.EXT_frag_depth) |
| 879 | extBehavior["GL_EXT_frag_depth"] = EBhUndefined; |
Nicolas Capens | 4648508 | 2014-04-15 13:12:50 -0400 | [diff] [blame] | 880 | if (resources.EXT_shader_texture_lod) |
| 881 | extBehavior["GL_EXT_shader_texture_lod"] = EBhUndefined; |
Erik Dahlström | ea7a212 | 2014-11-17 16:15:57 +0100 | [diff] [blame] | 882 | if (resources.EXT_shader_framebuffer_fetch) |
| 883 | extBehavior["GL_EXT_shader_framebuffer_fetch"] = EBhUndefined; |
| 884 | if (resources.NV_shader_framebuffer_fetch) |
| 885 | extBehavior["GL_NV_shader_framebuffer_fetch"] = EBhUndefined; |
| 886 | if (resources.ARM_shader_framebuffer_fetch) |
| 887 | extBehavior["GL_ARM_shader_framebuffer_fetch"] = EBhUndefined; |
Olli Etuaho | 09b04a2 | 2016-12-15 13:30:26 +0000 | [diff] [blame] | 888 | if (resources.OVR_multiview) |
| 889 | { |
| 890 | extBehavior["GL_OVR_multiview"] = EBhUndefined; |
| 891 | extBehavior["GL_OVR_multiview2"] = EBhUndefined; |
| 892 | } |
alokp@chromium.org | ad771eb | 2010-09-07 17:36:23 +0000 | [diff] [blame] | 893 | } |
David Yen | 0fbd128 | 2015-02-02 14:46:09 -0800 | [diff] [blame] | 894 | |
| 895 | void ResetExtensionBehavior(TExtensionBehavior &extBehavior) |
| 896 | { |
Jamie Madill | d7b1ab5 | 2016-12-12 14:42:19 -0500 | [diff] [blame] | 897 | for (auto ext_iter = extBehavior.begin(); ext_iter != extBehavior.end(); ++ext_iter) |
David Yen | 0fbd128 | 2015-02-02 14:46:09 -0800 | [diff] [blame] | 898 | { |
| 899 | ext_iter->second = EBhUndefined; |
| 900 | } |
| 901 | } |
Jamie Madill | 45bcc78 | 2016-11-07 13:58:48 -0500 | [diff] [blame] | 902 | |
| 903 | } // namespace sh |