Home | History | Annotate | Download | only in sksl
      1 STRINGIFY(
      2 
      3 // defines built-in functions supported by SkiaSL
      4 
      5 $genType radians($genType degrees);
      6 $genType sin($genType angle);
      7 $genType cos($genType angle);
      8 $genType tan($genType angle);
      9 $genType asin($genType x);
     10 $genType acos($genType x);
     11 $genType atan($genType y, $genType x);
     12 $genType atan($genType y_over_x);
     13 $genType sinh($genType x);
     14 $genType cosh($genType x);
     15 $genType tanh($genType x);
     16 $genType asinh($genType x);
     17 $genType acosh($genType x);
     18 $genType atanh($genType x);
     19 $genType pow($genType x, $genType y);
     20 $genType exp($genType x);
     21 $genType log($genType x);
     22 $genType exp2($genType x);
     23 $genType log2($genType x);
     24 $genType sqrt($genType x);
     25 //$genDType sqrt($genDType x);
     26 $genType inversesqrt($genType x);
     27 //$genDType inversesqrt($genDType x);
     28 $genType abs($genType x);
     29 $genIType abs($genIType x);
     30 //$genDType abs($genDType x);
     31 $genType sign($genType x);
     32 $genIType sign($genIType x);
     33 //$genDType sign($genDType x);
     34 $genType floor($genType x);
     35 //$genDType floor($genDType x);
     36 $genType trunc($genType x);
     37 //$genDType trunc($genDType x);
     38 $genType round($genType x);
     39 //$genDType round($genDType x);
     40 $genType roundEven($genType x);
     41 //$genDType roundEven($genDType x);
     42 $genType ceil($genType x);
     43 //$genDType ceil($genDType x);
     44 $genType fract($genType x);
     45 //$genDType fract($genDType x);
     46 $genType mod($genType x, float y);
     47 $genType mod($genType x, $genType y);
     48 //$genDType mod($genDType x, double y);
     49 //$genDType mod($genDType x, $genDType y);
     50 $genType modf($genType x, out $genType i);
     51 //$genDType modf($genDType x, out $genDType i);
     52 $genType min($genType x, $genType y);
     53 $genType min($genType x, float y);
     54 //$genDType min($genDType x, $genDType y);
     55 //$genDType min($genDType x, double y);
     56 $genIType min($genIType x, $genIType y);
     57 $genIType min($genIType x, int y);
     58 //$genUType min($genUType x, $genUType y);
     59 //$genUType min($genUType x, uint y);
     60 $genType max($genType x, $genType y);
     61 $genType max($genType x, float y);
     62 //$genDType max($genDType x, $genDType y);
     63 //$genDType max($genDType x, double y);
     64 $genIType max($genIType x, $genIType y);
     65 $genIType max($genIType x, int y);
     66 //$genUType max($genUType x, $genUType y);
     67 //$genUType max($genUType x, uint y);
     68 $genType clamp($genType x, $genType minVal, $genType maxVal);
     69 $genType clamp($genType x, float minVal, float maxVal);
     70 //$genDType clamp($genDType x, $genDType minVal, $genDType maxVal);
     71 //$genDType clamp($genDType x, double minVal, double maxVal);
     72 $genIType clamp($genIType x, $genIType minVal, $genIType maxVal);
     73 $genIType clamp($genIType x, int minVal, int maxVal);
     74 //$genUType clamp($genUType x, $genUType minVal, $genUType maxVal);
     75 //$genUType clamp($genUType x, uint minVal, uint maxVal);
     76 $genType saturate($genType x);
     77 $genType mix($genType x, $genType y, $genType a);
     78 $genType mix($genType x, $genType y, float a);
     79 //$genDType mix($genDType x, $genDType y, $genDType a);
     80 //$genDType mix($genDType x, $genDType y, double a);
     81 $genType mix($genType x, $genType y, $genBType a);
     82 //$genDType mix($genDType x, $genDType y, $genBType a);
     83 $genIType mix($genIType x, $genIType y, $genBType a);
     84 //$genUType mix($genUType x, $genUType y, $genBType a);
     85 $genBType mix($genBType x, $genBType y, $genBType a);
     86 $genType step($genType edge, $genType x);
     87 $genType step(float edge, $genType x);
     88 //$genDType step($genDType edge, $genDType x);
     89 //$genDType step(double edge, $genDType x);
     90 $genType smoothstep($genType edge0, $genType edge1, $genType x);
     91 $genType smoothstep(float edge0, float edge1, $genType x);
     92 //$genDType smoothstep($genDType edge0, $genDType edge1, $genDType x);
     93 //$genDType smoothstep(double edge0, double edge1, $genDType x);
     94 $genBType isnan($genType x);
     95 $genBType isnan($genDType x);
     96 $genBType isinf($genType x);
     97 $genBType isinf($genDType x);
     98 $genIType floatBitsToInt($genType value);
     99 //$genUType floatBitsToUint($genType value);
    100 $genType intBitsTofloat($genIType value);
    101 $genType uintBitsTofloat($genUType value);
    102 $genType fma($genType a, $genType b, $genType c);
    103 $genHType fma($genHType a, $genHType b, $genHType c);
    104 $genDType fma($genDType a, $genDType b, $genDType c);
    105 //$genDType fma($genDType a, $genDType b, $genDType c);
    106 sk_has_side_effects $genType frexp($genType x, out $genIType exp);
    107 //$genDType frexp($genDType x, out $genIType exp);
    108 $genType ldexp($genType x, in $genIType exp);
    109 //$genDType ldexp($genDType x, in $genIType exp);
    110 uint packUnorm2x16(float2 v);
    111 uint packSnorm2x16(float2 v);
    112 uint packUnorm4x8(float4 v);
    113 uint packSnorm4x8(float4 v);
    114 float2 unpackUnorm2x16(uint p);
    115 float2 unpackSnorm2x16(uint p);
    116 float4 unpackUnorm4x8(uint p);
    117 float4 unpackSnorm4x8(uint p);
    118 //double packDouble2x32(uint2 v);
    119 uint2 unpackDouble2x32(double v);
    120 uint packHalf2x16(float2 v);
    121 float2 unpackHalf2x16(uint v);
    122 float length($genType x);
    123 half length($genHType x);
    124 double length($genDType x);
    125 float distance($genType p0, $genType p1);
    126 half distance($genHType p0, $genHType p1);
    127 double distance($genDType p0, $genDType p1);
    128 float dot($genType x, $genType y);
    129 half dot($genHType x, $genHType y);
    130 double dot($genDType x, $genDType y);
    131 float3 cross(float3 x, float3 y);
    132 half3 cross(half3 x, half3 y);
    133 double3 cross(double3 x, double3 y);
    134 $genType normalize($genType x);
    135 $genHType normalize($genHType x);
    136 $genDType normalize($genDType x);
    137 float4 ftransform();
    138 $genType faceforward($genType N, $genType I, $genType Nref);
    139 $genHType faceforward($genHType N, $genHType I, $genHType Nref);
    140 $genDType faceforward($genDType N, $genDType I, $genDType Nref);
    141 $genType reflect($genType I, $genType N);
    142 $genHType reflect($genHType I, $genHType N);
    143 $genDType reflect($genDType I, $genDType N);
    144 $genType refract($genType I, $genType N, float eta);
    145 $genHType refract($genHType I, $genHType N, float eta);
    146 $genDType refract($genDType I, $genDType N, float eta);
    147 $mat matrixCompMult($mat x, $mat y);
    148 float2x2 outerProduct(float2 c, float2 r);
    149 float3x3 outerProduct(float3 c, float3 r);
    150 float4x3 outerProduct(float4 c, float4 r);
    151 float2x3 outerProduct(float3 c, float2 r);
    152 float3x2 outerProduct(float2 c, float3 r);
    153 float2x4 outerProduct(float4 c, float2 r);
    154 float4x2 outerProduct(float2 c, float4 r);
    155 float3x4 outerProduct(float4 c, float3 r);
    156 float4x3 outerProduct(float3 c, float4 r);
    157 float2x2 transpose(float2x2 m);
    158 float3x3 transpose(float3x3 m);
    159 float4x4 transpose(float4x4 m);
    160 float2x3 transpose(float3x2 m);
    161 float3x2 transpose(float2x3 m);
    162 float2x4 transpose(float4x2 m);
    163 float4x2 transpose(float2x4 m);
    164 float3x4 transpose(float4x3 m);
    165 float4x3 transpose(float3x4 m);
    166 float determinant(float2x2 m);
    167 float determinant(float3x3 m);
    168 float determinant(float4x4 m);
    169 float2x2 inverse(float2x2 m);
    170 float3x3 inverse(float3x3 m);
    171 float4x4 inverse(float4x4 m);
    172 $bvec lessThan($vec x, $vec y);
    173 $bvec lessThan($hvec x, $hvec y);
    174 $bvec lessThan($dvec x, $dvec y);
    175 $bvec lessThan($ivec x, $ivec y);
    176 $bvec lessThan($svec x, $svec y);
    177 $bvec lessThan($usvec x, $usvec y);
    178 $bvec lessThan($uvec x, $uvec y);
    179 $bvec lessThanEqual($vec x, $vec y);
    180 $bvec lessThanEqual($hvec x, $hvec y);
    181 $bvec lessThanEqual($dvec x, $dvec y);
    182 $bvec lessThanEqual($ivec x, $ivec y);
    183 $bvec lessThanEqual($uvec x, $uvec y);
    184 $bvec lessThanEqual($svec x, $svec y);
    185 $bvec lessThanEqual($usvec x, $usvec y);
    186 $bvec greaterThan($vec x, $vec y);
    187 $bvec greaterThan($hvec x, $hvec y);
    188 $bvec greaterThan($dvec x, $dvec y);
    189 $bvec greaterThan($ivec x, $ivec y);
    190 $bvec greaterThan($uvec x, $uvec y);
    191 $bvec greaterThan($svec x, $svec y);
    192 $bvec greaterThan($usvec x, $usvec y);
    193 $bvec greaterThanEqual($vec x, $vec y);
    194 $bvec greaterThanEqual($hvec x, $hvec y);
    195 $bvec greaterThanEqual($dvec x, $dvec y);
    196 $bvec greaterThanEqual($ivec x, $ivec y);
    197 $bvec greaterThanEqual($uvec x, $uvec y);
    198 $bvec greaterThanEqual($svec x, $svec y);
    199 $bvec greaterThanEqual($usvec x, $usvec y);
    200 $bvec equal($vec x, $vec y);
    201 $bvec equal($hvec x, $hvec y);
    202 $bvec equal($dvec x, $dvec y);
    203 $bvec equal($ivec x, $ivec y);
    204 $bvec equal($uvec x, $uvec y);
    205 $bvec equal($svec x, $svec y);
    206 $bvec equal($usvec x, $usvec y);
    207 $bvec equal($bvec x, $bvec y);
    208 $bvec notEqual($vec x, $vec y);
    209 $bvec notEqual($hvec x, $hvec y);
    210 $bvec notEqual($dvec x, $dvec y);
    211 $bvec notEqual($ivec x, $ivec y);
    212 $bvec notEqual($uvec x, $uvec y);
    213 $bvec notEqual($svec x, $svec y);
    214 $bvec notEqual($usvec x, $usvec y);
    215 $bvec notEqual($bvec x, $bvec y);
    216 bool any($bvec x);
    217 bool all($bvec x);
    218 $bvec not($bvec x);
    219 
    220 $genIType bitCount($genIType value);
    221 $genIType bitCount($genUType value);
    222 $genIType findLSB($genIType value);
    223 $genIType findLSB($genUType value);
    224 $genIType findMSB($genIType value);
    225 $genIType findMSB($genUType value);
    226 
    227 /*
    228 //$genUType uaddCarry($genUType x, $genUType y, out $genUType carry);
    229 //$genUType usubBorrow($genUType x, $genUType y, out $genUType borrow);
    230 void umulExtended($genUType x, $genUType y, out $genUType msb, out $genUType lsb);
    231 void imulExtended($genIType x, $genIType y, out $genIType msb, out $genIType lsb);
    232 $genIType bitfieldExtract($genIType value, int offset, int bits);
    233 //$genUType bitfieldExtract($genUType value, int offset, int bits);
    234 $genIType bitfieldInsert($genIType base, $genIType insert, int offset, int bits);
    235 //$genUType bitfieldInsert($genUType base, $genUType insert, int offset, int bits);
    236 $genIType bitfieldReverse($genIType value);
    237 //$genUType bitfieldReverse($genUType value);
    238 int textureSize($gsampler1D sampler, int lod);
    239 int2 textureSize($gsampler2D sampler, int lod);
    240 int3 textureSize($gsampler3D sampler, int lod);
    241 int2 textureSize($gsamplerCube sampler, int lod);
    242 int textureSize(sampler1DShadow sampler, int lod);
    243 int2 textureSize(sampler2DShadow sampler, int lod);
    244 int2 textureSize(samplerCubeShadow sampler, int lod);
    245 int3 textureSize($gsamplerCubeArray sampler, int lod);
    246 int3 textureSize(samplerCubeArrayShadow sampler, int lod);
    247 */
    248 int2 textureSize($gsampler2DRect sampler);
    249 /*
    250 int2 textureSize(sampler2DRectShadow sampler);
    251 int2 textureSize($gsampler1DArray sampler, int lod);
    252 int3 textureSize($gsampler2DArray sampler, int lod);
    253 int2 textureSize(sampler1DArrayShadow sampler, int lod);
    254 int3 textureSize(sampler2DArrayShadow sampler, int lod);
    255 int textureSize($gsamplerBuffer sampler);
    256 int2 textureSize($gsampler2DMS sampler);
    257 int3 textureSize($gsampler2DMSArray sampler);
    258 float2 textureQueryLod($gsampler1D sampler, float P);
    259 float2 textureQueryLod($gsampler2D sampler, float2 P);
    260 float2 textureQueryLod($gsampler3D sampler, float3 P);
    261 float2 textureQueryLod($gsamplerCube sampler, float3 P);
    262 float2 textureQueryLod($gsampler1DArray sampler, float P);
    263 float2 textureQueryLod($gsampler2DArray sampler, float2 P);
    264 float2 textureQueryLod($gsamplerCubeArray sampler, float3 P);
    265 float2 textureQueryLod(sampler1DShadow sampler, float P);
    266 float2 textureQueryLod(sampler2DShadow sampler, float2 P);
    267 float2 textureQueryLod(samplerCubeShadow sampler, float3 P);
    268 float2 textureQueryLod(sampler1DArrayShadow sampler, float P);
    269 float2 textureQueryLod(sampler2DArrayShadow sampler, float2 P);
    270 float2 textureQueryLod(samplerCubeArrayShadow sampler, float3 P);
    271 int textureQueryLevels($gsampler1D sampler);
    272 int textureQueryLevels($gsampler2D sampler);
    273 int textureQueryLevels($gsampler3D sampler);
    274 int textureQueryLevels($gsamplerCube sampler);
    275 int textureQueryLevels($gsampler1DArray sampler);
    276 int textureQueryLevels($gsampler2DArray sampler);
    277 int textureQueryLevels($gsamplerCubeArray sampler);
    278 int textureQueryLevels(sampler1DShadow sampler);
    279 int textureQueryLevels(sampler2DShadow sampler);
    280 int textureQueryLevels(samplerCubeShadow sampler);
    281 int textureQueryLevels(sampler1DArrayShadow sampler);
    282 int textureQueryLevels(sampler2DArrayShadow sampler);
    283 int textureQueryLevels(samplerCubeArrayShadow sampler);
    284 */
    285 
    286 half4 texture($gsampler1D sampler, float P);
    287 half4 texture($gsampler1D sampler, float P, float bias);
    288 half4 texture($gsampler2D sampler, float2 P);
    289 // The above currently only expand to handle the float/fixed case. So we also declare this integer
    290 // version of texture().
    291 int4 texture(isampler2D sampler, float2 P);
    292 half4 texture(samplerExternalOES sampler, float2 P, float bias);
    293 half4 texture(samplerExternalOES sampler, float2 P);
    294 
    295 /*
    296 $gfloat4 texture($gsampler2D sampler, float2 P, float bias);
    297 $gfloat4 texture($gsampler3D sampler, float3 P);
    298 $gfloat4 texture($gsampler3D sampler, float3 P, float bias);
    299 $gfloat4 texture($gsamplerCube sampler, float3 P);
    300 $gfloat4 texture($gsamplerCube sampler, float3 P, float bias);
    301 float texture(sampler1DShadow sampler, float3 P);
    302 float texture(sampler1DShadow sampler, float3 P, float bias);
    303 float texture(sampler2DShadow sampler, float3 P);
    304 float texture(sampler2DShadow sampler, float3 P, float bias);
    305 float texture(samplerCubeShadow sampler, float4 P);
    306 float texture(samplerCubeShadow sampler, float4 P, float bias);
    307 $gfloat4 texture($gsampler1DArray sampler, float2 P);
    308 $gfloat4 texture($gsampler1DArray sampler, float2 P, float bias);
    309 $gfloat4 texture($gsampler2DArray sampler, float3 P);
    310 $gfloat4 texture($gsampler2DArray sampler, float3 P, float bias);
    311 $gfloat4 texture($gsamplerCubeArray sampler, float4 P);
    312 $gfloat4 texture($gsamplerCubeArray sampler, float4 P, float bias);
    313 float texture(sampler1DArrayShadow sampler, float3 P);
    314 float texture(sampler1DArrayShadow sampler, float3 P, float bias);
    315 float texture(sampler2DArrayShadow sampler, float4 P);
    316 */
    317 
    318 half4 texture($gsampler2DRect sampler, float2 P);
    319 half4 texture($gsampler2DRect sampler, float3 P);
    320 
    321 /*
    322 float texture(sampler2DRectShadow sampler, float3 P);
    323 float texture($gsamplerCubeArrayShadow sampler, float4 P, float compare);
    324 */
    325 
    326 // Currently we do not support the generic types of loading subpassInput so we have some explicit
    327 // versions that we currently use
    328 float4 subpassLoad(subpassInput subpass);
    329 float4 subpassLoad(subpassInputMS subpass, int sample);
    330 /*
    331 $gfloat4subpassLoad(gsubpassInput subpass);
    332 $gfloat4subpassLoad(gsubpassInputMS subpass, int sample);
    333 */
    334 )
    335 
    336 // split into multiple chunks, as MSVC++ complains if a single string is too long
    337 
    338 STRINGIFY(
    339 
    340 half4 texture($gsampler1D sampler, float2 P);
    341 half4 texture($gsampler1D sampler, float2 P, float bias);
    342 half4 texture($gsampler2D sampler, float3 P);
    343 half4 texture($gsampler2D sampler, float3 P, float bias);
    344 /*
    345 $gfloat4 textureProj($gsampler3D sampler, float4 P);
    346 $gfloat4 textureProj($gsampler3D sampler, float4 P, float bias);
    347 float textureProj(sampler1DShadow sampler, float4 P);
    348 float textureProj(sampler1DShadow sampler, float4 P, float bias);
    349 float textureProj(sampler2DShadow sampler, float4 P);
    350 float textureProj(sampler2DShadow sampler, float4 P, float bias);
    351 $gfloat4 textureProj($gsampler2DRect sampler, float4 P);
    352 float textureProj(sampler2DRectShadow sampler, float4 P);
    353 $gfloat4 textureLod($gsampler1D sampler, float P, float lod);
    354 $gfloat4 textureLod($gsampler2D sampler, float2 P, float lod);
    355 $gfloat4 textureLod($gsampler3D sampler, float3 P, float lod);
    356 $gfloat4 textureLod($gsamplerCube sampler, float3 P, float lod);
    357 float textureLod(sampler1DShadow sampler, float3 P, float lod);
    358 float textureLod(sampler2DShadow sampler, float3 P, float lod);
    359 $gfloat4 textureLod($gsampler1DArray sampler, float2 P, float lod);
    360 $gfloat4 textureLod($gsampler2DArray sampler, float3 P, float lod);
    361 float textureLod(sampler1DArrayShadow sampler, float3 P, float lod);
    362 $gfloat4 textureLod($gsamplerCubeArray sampler, float4 P, float lod);
    363 $gfloat4 textureOffset($gsampler1D sampler, float P, int offset);
    364 $gfloat4 textureOffset($gsampler1D sampler, float P, int offset, float bias);
    365 $gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset);
    366 $gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset, float bias);
    367 $gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset);
    368 $gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset, float bias);
    369 $gfloat4 textureOffset($gsampler2DRect sampler, float2 P, int2 offset);
    370 float textureOffset(sampler2DRectShadow sampler, float3 P, int2 offset);
    371 float textureOffset(sampler1DShadow sampler, float3 P, int offset);
    372 float textureOffset(sampler1DShadow sampler, float3 P, int offset, float bias);
    373 float textureOffset(sampler2DShadow sampler, float3 P, int2 offset);
    374 float textureOffset(sampler2DShadow sampler, float3 P, int2 offset, float bias);
    375 $gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset);
    376 $gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset, float bias);
    377 $gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset);
    378 $gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset, float bias);
    379 float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset);
    380 float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset, float bias);
    381 float textureOffset(sampler2DArrayShadow sampler, float4 P, int2 offset);
    382 float4 texelFetch(samplerBuffer sampler, int P);
    383 $gfloat4 texelFetch($gsampler1D sampler, int P, int lod);
    384 $gfloat4 texelFetch($gsampler2D sampler, int2 P, int lod);
    385 $gfloat4 texelFetch($gsampler2DRect sampler, int2 P);
    386 $gfloat4 texelFetch($gsampler3D sampler, int3 P, int lod);
    387 $gfloat4 texelFetch($gsampler1DArray sampler, int2 P, int lod);
    388 $gfloat4 texelFetch($gsampler2DArray sampler, int3 P, int lod);
    389 $gfloat4 texelFetch($gsampler2DMS sampler, int2 P, int sample);
    390 $gfloat4 texelFetch($gsampler2DMSArray sampler, int3 P, int sample);
    391 $gfloat4 texelFetchOffset($gsampler1D sampler, int P, int lod, int offset);
    392 $gfloat4 texelFetchOffset($gsampler2D sampler, int2 P, int lod, int2 offset);
    393 $gfloat4 texelFetchOffset($gsampler3D sampler, int3 P, int lod, int3 offset);
    394 $gfloat4 texelFetchOffset($gsampler2DRect sampler, int2 P, int2 offset);
    395 $gfloat4 texelFetchOffset($gsampler1DArray sampler, int2 P, int lod, int offset);
    396 $gfloat4 texelFetchOffset($gsampler2DArray sampler, int3 P, int lod, int2 offset);
    397 $gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset);
    398 $gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset, float bias);
    399 $gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset);
    400 $gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset, float bias);
    401 $gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset);
    402 $gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset, float bias);
    403 $gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset);
    404 $gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset, float bias);
    405 $gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset);
    406 $gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset, float bias);
    407 $gfloat4 textureProjOffset($gsampler2DRect sampler, float3 P, int2 offset);
    408 $gfloat4 textureProjOffset($gsampler2DRect sampler, float4 P, int2 offset);
    409 float textureProjOffset(sampler2DRectShadow sampler, float4 P, int2 offset);
    410 float textureProjOffset(sampler1DShadow sampler, float4 P, int offset);
    411 float textureProjOffset(sampler1DShadow sampler, float4 P, int offset, float bias);
    412 float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset);
    413 float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset, float bias);
    414 $gfloat4 textureLodOffset($gsampler1D sampler, float P, float lod, int offset);
    415 $gfloat4 textureLodOffset($gsampler2D sampler, float2 P, float lod, int2 offset);
    416 $gfloat4 textureLodOffset($gsampler3D sampler, float3 P, float lod, int3 offset);
    417 float textureLodOffset(sampler1DShadow sampler, float3 P, float lod, int offset);
    418 float textureLodOffset(sampler2DShadow sampler, float3 P, float lod, int2 offset);
    419 $gfloat4 textureLodOffset($gsampler1DArray sampler, float2 P, float lod, int offset);
    420 $gfloat4 textureLodOffset($gsampler2DArray sampler, float3 P, float lod, int2 offset);
    421 float textureLodOffset(sampler1DArrayShadow sampler, float3 P, float lod, int offset);
    422 $gfloat4 textureProjLod($gsampler1D sampler, float2 P, float lod);
    423 $gfloat4 textureProjLod($gsampler1D sampler, float4 P, float lod);
    424 $gfloat4 textureProjLod($gsampler2D sampler, float3 P, float lod);
    425 $gfloat4 textureProjLod($gsampler2D sampler, float4 P, float lod);
    426 $gfloat4 textureProjLod($gsampler3D sampler, float4 P, float lod);
    427 float textureProjLod(sampler1DShadow sampler, float4 P, float lod);
    428 float textureProjLod(sampler2DShadow sampler, float4 P, float lod);
    429 $gfloat4 textureProjLodOffset($gsampler1D sampler, float2 P, float lod, int offset);
    430 $gfloat4 textureProjLodOffset($gsampler1D sampler, float4 P, float lod, int offset);
    431 $gfloat4 textureProjLodOffset($gsampler2D sampler, float3 P, float lod, int2 offset);
    432 $gfloat4 textureProjLodOffset($gsampler2D sampler, float4 P, float lod, int2 offset);
    433 $gfloat4 textureProjLodOffset($gsampler3D sampler, float4 P, float lod, int3 offset);
    434 float textureProjLodOffset(sampler1DShadow sampler, float4 P, float lod, int offset);
    435 float textureProjLodOffset(sampler2DShadow sampler, float4 P, float lod, int2 offset);
    436 $gfloat4 textureGrad($gsampler1D sampler, float P, float dPdx, float dPdy);
    437 $gfloat4 textureGrad($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy);
    438 $gfloat4 textureGrad($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy);
    439 $gfloat4 textureGrad($gsamplerCube sampler, float3 P, float3 dPdx, float3 dPdy);
    440 $gfloat4 textureGrad($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy);
    441 float textureGrad(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy);
    442 float textureGrad(sampler1DShadow sampler, float3 P, float dPdx, float dPdy);
    443 float textureGrad(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy);
    444 float textureGrad(samplerCubeShadow sampler, float4 P, float3 dPdx, float3 dPdy);
    445 $gfloat4 textureGrad($gsampler1DArray sampler, float2 P, float dPdx, float dPdy);
    446 $gfloat4 textureGrad($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy);
    447 float textureGrad(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy);
    448 float textureGrad(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy);
    449 $gfloat4 textureGrad($gsamplerCubeArray sampler, float4 P, float3 dPdx, float3 dPdy);
    450 $gfloat4 textureGradOffset($gsampler1D sampler, float P, float dPdx, float dPdy, int offset);
    451 $gfloat4 textureGradOffset($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset);
    452 $gfloat4 textureGradOffset($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy, int3 offset);
    453 $gfloat4 textureGradOffset($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset);
    454 float textureGradOffset(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
    455 float textureGradOffset(sampler1DShadow sampler, float3 P, float dPdx, float dPdy, int offset );
    456 float textureGradOffset(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
    457 $gfloat4 textureGradOffset($gsampler1DArray sampler, float2 P, float dPdx, float dPdy, int offset);
    458 $gfloat4 textureGradOffset($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
    459 float textureGradOffset(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy, int offset);
    460 float textureGradOffset(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
    461 $gfloat4 textureProjGrad($gsampler1D sampler, float2 P, float dPdx, float dPdy);
    462 $gfloat4 textureProjGrad($gsampler1D sampler, float4 P, float dPdx, float dPdy);
    463 $gfloat4 textureProjGrad($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy);
    464 $gfloat4 textureProjGrad($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy);
    465 $gfloat4 textureProjGrad($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy);
    466 $gfloat4 textureProjGrad($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy);
    467 $gfloat4 textureProjGrad($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy);
    468 float textureProjGrad(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy);
    469 float textureProjGrad(sampler1DShadow sampler, float4 P, float dPdx, float dPdy);
    470 float textureProjGrad(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy);
    471 $gfloat4 textureProjGradOffset($gsampler1D sampler, float2 P, float dPdx, float dPdy, int offset);
    472 $gfloat4 textureProjGradOffset($gsampler1D sampler, float4 P, float dPdx, float dPdy, int offset);
    473 $gfloat4 textureProjGradOffset($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
    474 $gfloat4 textureProjGradOffset($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
    475 $gfloat4 textureProjGradOffset($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset);
    476 $gfloat4 textureProjGradOffset($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
    477 float textureProjGradOffset(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
    478 $gfloat4 textureProjGradOffset($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy, int3 offset);
    479 float textureProjGradOffset(sampler1DShadow sampler, float4 P, float dPdx, float dPdy, int offset);
    480 float textureProjGradOffset(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset);
    481 $gfloat4 textureGather($gsampler2D sampler, float2 P);
    482 $gfloat4 textureGather($gsampler2D sampler, float2 P, int comp);
    483 $gfloat4 textureGather($gsampler2DArray sampler, float3 P);
    484 $gfloat4 textureGather($gsampler2DArray sampler, float3 P, int comp);
    485 $gfloat4 textureGather($gsamplerCube sampler, float3 P);
    486 $gfloat4 textureGather($gsamplerCube sampler, float3 P, int comp);
    487 $gfloat4 textureGather($gsamplerCubeArray sampler, float4 P);
    488 $gfloat4 textureGather($gsamplerCubeArray sampler, float4 P, int comp);
    489 $gfloat4 textureGather($gsampler2DRect sampler, float2 P);
    490 $gfloat4 textureGather($gsampler2DRect sampler, float2 P, int comp);
    491 float4 textureGather(sampler2DShadow sampler, float2 P, float refZ);
    492 float4 textureGather(sampler2DArrayShadow sampler, float3 P, float refZ);
    493 float4 textureGather(samplerCubeShadow sampler, float3 P, float refZ);
    494 float4 textureGather(samplerCubeArrayShadow sampler, float4 P, float refZ);
    495 float4 textureGather(sampler2DRectShadow sampler, float2 P, float refZ);
    496 $gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset);
    497 $gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset, int comp);
    498 $gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset);
    499 $gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset, int comp);
    500 $gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset);
    501 $gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset, int comp);
    502 float4 textureGatherOffset(sampler2DShadow sampler, float2 P, float refZ, int2 offset);
    503 float4 textureGatherOffset(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offset);
    504 float4 textureGatherOffset(sampler2DRectShadow sampler, float2 P, float refZ, int2 offset);
    505 $gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4]);
    506 $gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4], int comp);
    507 $gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4]);
    508 $gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4], int comp);
    509 $gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4]);
    510 $gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4], int comp);
    511 float4 textureGatherOffsets(sampler2DShadow sampler, float2 P, float refZ, int2 offsets[4]);
    512 float4 textureGatherOffsets(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offsets[4]);
    513 float4 textureGatherOffsets(sampler2DRectShadow sampler, float2 P, float refZ, int2 offsets[4]);
    514 uint atomicCounterIncrement(atomic_uint c);
    515 uint atomicCounter(atomic_uint c);
    516 uint atomicAdd(inout uint mem, uint data);
    517 int atomicAdd(inout int mem, int data);
    518 uint atomicMin(inout uint mem, uint data);
    519 int atomicMin(inout int mem, int data);
    520 uint atomicMax(inout uint mem, uint data);
    521 int atomicMax(inout int mem, int data);
    522 uint atomicAnd(inout uint mem, uint data);
    523 int atomicAnd(inout int mem, int data);
    524 uint atomicOr(inout uint mem, uint data);
    525 int atomicOr(inout int mem, int data);
    526 uint atomicXor(inout uint mem, uint data);
    527 int atomicXor(inout int mem, int data);
    528 uint atomicExchange(inout uint mem, uint data);
    529 int atomicExchange(inout int mem, int data);
    530 uint atomicCompSwap(inout uint mem, uint compare, uint data);
    531 int atomicCompSwap(inout int mem, int compare, int data);
    532 */
    533 // section 8.12 Additional Image Functions will go here if and when we add
    534 // support for them
    535 float4 imageLoad(image2D image, int2 P);
    536 int4 imageLoad(iimage2D image, int2 P);
    537 $genType dFdx($genType p);
    538 $genType dFdy($genType p);
    539 $genType fwidth($genType p);
    540 float interpolateAtSample(float interpolant, int sample);
    541 float2 interpolateAtSample(float2 interpolant, int sample);
    542 float3 interpolateAtSample(float3 interpolant, int sample);
    543 float4 interpolateAtSample(float4 interpolant, int sample);
    544 float interpolateAtOffset(float interpolant, float2 offset);
    545 float2 interpolateAtOffset(float2 interpolant, float2 offset);
    546 float3 interpolateAtOffset(float3 interpolant, float2 offset);
    547 float4 interpolateAtOffset(float4 interpolant, float2 offset);
    548 
    549 /*
    550 $genType fwidth($genType p);
    551 $genType fwidthCoarse($genType p);
    552 $genType fwidthFine($genType p);
    553 void barrier();
    554 void memoryBarrier();
    555 void memoryBarrierAtomicCounter();
    556 void memoryBarrierBuffer();
    557 void memoryBarrierShared();
    558 void memoryBarrierImage();
    559 void groupMemoryBarrier();
    560 */
    561 
    562 )
    563