Commit 0fc4338f by John Kessenich

Implement GL_OES_shader_multisample_interpolation, as well as core desktop versions of it.

parent ba01ebd5
...@@ -341,3 +341,59 @@ void goodImageAtom() ...@@ -341,3 +341,59 @@ void goodImageAtom()
imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
} }
sample in vec4 colorSampInBad; // ERROR, reserved
centroid out vec4 colorCentroidBad; // ERROR
flat out vec4 colorBadFlat; // ERROR
smooth out vec4 colorBadSmooth; // ERROR
noperspective out vec4 colorBadNo; // ERROR
flat centroid in vec2 colorfc;
in float scalarIn;
void badInterp()
{
interpolateAtCentroid(colorfc); // ERROR, need extension
interpolateAtSample(colorfc, 1); // ERROR, need extension
interpolateAtOffset(colorfc, vec2(0.2)); // ERROR, need extension
}
#if defined GL_OES_shader_multisample_interpolation
#extension GL_OES_shader_multisample_interpolation : enable
#endif
sample in vec4 colorSampIn;
sample out vec4 colorSampleBad; // ERROR
flat sample in vec4 colorfsi;
sample in vec3 sampInArray[4];
void interp()
{
float res;
vec2 res2;
vec3 res3;
vec4 res4;
res2 = interpolateAtCentroid(colorfc);
res4 = interpolateAtCentroid(colorSampIn);
res4 = interpolateAtCentroid(colorfsi);
res = interpolateAtCentroid(scalarIn);
res3 = interpolateAtCentroid(sampInArray); // ERROR
res3 = interpolateAtCentroid(sampInArray[2]);
res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
res3 = interpolateAtSample(sampInArray, 1); // ERROR
res3 = interpolateAtSample(sampInArray[i], 0);
res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
res = interpolateAtSample(scalarIn, 1);
res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
res = interpolateAtOffset(scalarIn, vec2(0.2));
float f;
res = interpolateAtCentroid(f); // ERROR, not interpolant
res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
}
...@@ -373,3 +373,19 @@ void goodImageAtom() ...@@ -373,3 +373,19 @@ void goodImageAtom()
imageAtomicCompSwap(im2Di, P, 3, dati); imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu); imageAtomicCompSwap(im2Du, P, 5u, datu);
} }
sample out vec4 colorSampInBad; // ERROR, reserved
#extension GL_OES_shader_multisample_interpolation : enable
sample out vec4 colorSample;
flat sample out vec4 colorfsi;
sample out vec3 sampInArray[4];
in vec4 inv4;
void badInterp()
{
interpolateAtCentroid(inv4); // ERROR, wrong stage
interpolateAtSample(inv4, 1); // ERROR, need extension
interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
}
...@@ -99,3 +99,43 @@ void foodc2() ...@@ -99,3 +99,43 @@ void foodc2()
d = packDouble2x32(u2); d = packDouble2x32(u2);
u2 = unpackDouble2x32(d); u2 = unpackDouble2x32(d);
} }
sample in vec4 colorSampIn;
sample out vec4 colorSampleBad; // ERROR
noperspective in vec4 colorfsi;
sample in vec3 sampInArray[4];
smooth in float scalarIn;
flat centroid in vec2 colorfc;
struct S {
float x;
};
in S s1;
sample S s2;
void interp()
{
interpolateAtCentroid(colorfc);
interpolateAtCentroid(colorSampIn);
interpolateAtCentroid(colorfsi);
interpolateAtCentroid(scalarIn);
interpolateAtCentroid(sampInArray); // ERROR
interpolateAtCentroid(sampInArray[2]);
interpolateAtCentroid(sampInArray[2].xy); // ERROR
interpolateAtSample(sampInArray, 1); // ERROR
interpolateAtSample(sampInArray[i], 0);
interpolateAtSample(s1.x, 2); // ERROR
interpolateAtSample(scalarIn, 1);
interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
interpolateAtOffset(sampInArray[2], vec2(0.2));
interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
interpolateAtOffset(s2.x, vec2(0.2)); // ERROR
float f;
interpolateAtCentroid(f); // ERROR, not interpolant
interpolateAtSample(outp, 0); // ERROR, not interpolant
}
\ No newline at end of file
...@@ -138,3 +138,10 @@ layout(std430, align = 128) uniform block24301 { ...@@ -138,3 +138,10 @@ layout(std430, align = 128) uniform block24301 {
int aconst[gl_MaxTransformFeedbackBuffers]; int aconst[gl_MaxTransformFeedbackBuffers];
int bconst[gl_MaxTransformFeedbackInterleavedComponents]; int bconst[gl_MaxTransformFeedbackInterleavedComponents];
sample in vec3 sampInArray[4];
void interp()
{
interpolateAtCentroid(sampInArray[2].xy);
}
...@@ -90,7 +90,11 @@ ERROR: 0:318: 'sampler/image' : type requires declaration of default precision q ...@@ -90,7 +90,11 @@ ERROR: 0:318: 'sampler/image' : type requires declaration of default precision q
ERROR: 0:319: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:319: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:339: 'textureSize' : no matching overloaded function found ERROR: 0:339: 'textureSize' : no matching overloaded function found
ERROR: 0:339: '=' : cannot convert from 'const float' to 'temp highp 3-component vector of int' ERROR: 0:339: '=' : cannot convert from 'const float' to 'temp highp 3-component vector of int'
ERROR: 86 compilation errors. No code generated. ERROR: 0:377: 'sample' : Reserved word.
ERROR: 0:388: 'interpolateAtCentroid' : no matching overloaded function found
ERROR: 0:389: 'interpolateAtSample' : no matching overloaded function found
ERROR: 0:390: 'interpolateAtOffset' : no matching overloaded function found
ERROR: 90 compilation errors. No code generated.
Shader version: 310 Shader version: 310
...@@ -98,6 +102,7 @@ Requested GL_EXT_texture_buffer ...@@ -98,6 +102,7 @@ Requested GL_EXT_texture_buffer
Requested GL_OES_gpu_shader5 Requested GL_OES_gpu_shader5
Requested GL_OES_shader_image_atomic Requested GL_OES_shader_image_atomic
Requested GL_OES_shader_io_blocks Requested GL_OES_shader_io_blocks
Requested GL_OES_shader_multisample_interpolation
Requested GL_OES_texture_buffer Requested GL_OES_texture_buffer
Requested GL_OES_texture_cube_map_array Requested GL_OES_texture_cube_map_array
Requested GL_OES_texture_storage_multisample_2d_array Requested GL_OES_texture_storage_multisample_2d_array
...@@ -852,6 +857,15 @@ ERROR: node is still EOpNull! ...@@ -852,6 +857,15 @@ ERROR: node is still EOpNull!
0:374 Constant: 0:374 Constant:
0:374 5 (const uint) 0:374 5 (const uint)
0:374 'datu' (temp highp uint) 0:374 'datu' (temp highp uint)
0:386 Function Definition: badInterp( (global void)
0:386 Function Parameters:
0:388 Sequence
0:388 Constant:
0:388 0.000000
0:389 Constant:
0:389 0.000000
0:390 Constant:
0:390 0.000000
0:? Linker Objects 0:? Linker Objects
0:? 's' (shared highp 4-component vector of float) 0:? 's' (shared highp 4-component vector of float)
0:? 'v' (buffer highp 4-component vector of float) 0:? 'v' (buffer highp 4-component vector of float)
...@@ -953,6 +967,11 @@ ERROR: node is still EOpNull! ...@@ -953,6 +967,11 @@ ERROR: node is still EOpNull!
0:? 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:? 'im2Du' (layout(r32ui ) uniform highp uimage2D)
0:? 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:? 'im2Di' (layout(r32i ) uniform highp iimage2D)
0:? 'P' (uniform highp 2-component vector of int) 0:? 'P' (uniform highp 2-component vector of int)
0:? 'colorSampInBad' (smooth sample out highp 4-component vector of float)
0:? 'colorSample' (smooth sample out highp 4-component vector of float)
0:? 'colorfsi' (flat sample out highp 4-component vector of float)
0:? 'sampInArray' (smooth sample out 4-element array of highp 3-component vector of float)
0:? 'inv4' (in highp 4-component vector of float)
0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId)
...@@ -965,6 +984,7 @@ Requested GL_EXT_texture_buffer ...@@ -965,6 +984,7 @@ Requested GL_EXT_texture_buffer
Requested GL_OES_gpu_shader5 Requested GL_OES_gpu_shader5
Requested GL_OES_shader_image_atomic Requested GL_OES_shader_image_atomic
Requested GL_OES_shader_io_blocks Requested GL_OES_shader_io_blocks
Requested GL_OES_shader_multisample_interpolation
Requested GL_OES_texture_buffer Requested GL_OES_texture_buffer
Requested GL_OES_texture_cube_map_array Requested GL_OES_texture_cube_map_array
Requested GL_OES_texture_storage_multisample_2d_array Requested GL_OES_texture_storage_multisample_2d_array
...@@ -1719,6 +1739,15 @@ ERROR: node is still EOpNull! ...@@ -1719,6 +1739,15 @@ ERROR: node is still EOpNull!
0:374 Constant: 0:374 Constant:
0:374 5 (const uint) 0:374 5 (const uint)
0:374 'datu' (temp highp uint) 0:374 'datu' (temp highp uint)
0:386 Function Definition: badInterp( (global void)
0:386 Function Parameters:
0:388 Sequence
0:388 Constant:
0:388 0.000000
0:389 Constant:
0:389 0.000000
0:390 Constant:
0:390 0.000000
0:? Linker Objects 0:? Linker Objects
0:? 's' (shared highp 4-component vector of float) 0:? 's' (shared highp 4-component vector of float)
0:? 'v' (buffer highp 4-component vector of float) 0:? 'v' (buffer highp 4-component vector of float)
...@@ -1820,6 +1849,11 @@ ERROR: node is still EOpNull! ...@@ -1820,6 +1849,11 @@ ERROR: node is still EOpNull!
0:? 'im2Du' (layout(r32ui ) uniform highp uimage2D) 0:? 'im2Du' (layout(r32ui ) uniform highp uimage2D)
0:? 'im2Di' (layout(r32i ) uniform highp iimage2D) 0:? 'im2Di' (layout(r32i ) uniform highp iimage2D)
0:? 'P' (uniform highp 2-component vector of int) 0:? 'P' (uniform highp 2-component vector of int)
0:? 'colorSampInBad' (smooth sample out highp 4-component vector of float)
0:? 'colorSample' (smooth sample out highp 4-component vector of float)
0:? 'colorfsi' (flat sample out highp 4-component vector of float)
0:? 'sampInArray' (smooth sample out 4-element array of highp 3-component vector of float)
0:? 'inv4' (in highp 4-component vector of float)
0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId)
0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId)
...@@ -53,6 +53,20 @@ ERROR: 48 compilation errors. No code generated. ...@@ -53,6 +53,20 @@ ERROR: 48 compilation errors. No code generated.
Shader version: 440 Shader version: 440
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:144 Function Definition: interp( (global void)
0:144 Function Parameters:
0:146 Sequence
0:146 interpolateAtCentroid (global 2-component vector of float)
0:146 vector swizzle (temp 2-component vector of float)
0:146 direct index (smooth sample temp 3-component vector of float)
0:146 'sampInArray' (smooth sample in 4-element array of 3-component vector of float)
0:146 Constant:
0:146 2 (const int)
0:146 Sequence
0:146 Constant:
0:146 0 (const int)
0:146 Constant:
0:146 1 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float) 0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float)
0:? 'b' (layout(location=4 component=1 ) smooth in float) 0:? 'b' (layout(location=4 component=1 ) smooth in float)
...@@ -88,6 +102,7 @@ ERROR: node is still EOpNull! ...@@ -88,6 +102,7 @@ ERROR: node is still EOpNull!
0:? 'specExample4301' (layout(column_major std430 align=128 ) uniform block{layout(column_major std430 offset=0 align=128 ) uniform 4-component vector of float a, layout(column_major std430 offset=128 align=128 ) uniform 3-component vector of float b, layout(column_major std430 offset=256 align=128 ) uniform 2-component vector of float d, layout(column_major std430 offset=512 align=128 ) uniform float e, layout(column_major std430 offset=520 align=8 ) uniform double f, layout(column_major std430 offset=640 align=128 ) uniform float h, layout(column_major std430 offset=768 align=128 ) uniform 3-component vector of double i}) 0:? 'specExample4301' (layout(column_major std430 align=128 ) uniform block{layout(column_major std430 offset=0 align=128 ) uniform 4-component vector of float a, layout(column_major std430 offset=128 align=128 ) uniform 3-component vector of float b, layout(column_major std430 offset=256 align=128 ) uniform 2-component vector of float d, layout(column_major std430 offset=512 align=128 ) uniform float e, layout(column_major std430 offset=520 align=8 ) uniform double f, layout(column_major std430 offset=640 align=128 ) uniform float h, layout(column_major std430 offset=768 align=128 ) uniform 3-component vector of double i})
0:? 'aconst' (global 4-element array of int) 0:? 'aconst' (global 4-element array of int)
0:? 'bconst' (global 64-element array of int) 0:? 'bconst' (global 64-element array of int)
0:? 'sampInArray' (smooth sample in 4-element array of 3-component vector of float)
Linked fragment stage: Linked fragment stage:
...@@ -96,6 +111,20 @@ ERROR: Linking fragment stage: Missing entry point: Each stage requires one "voi ...@@ -96,6 +111,20 @@ ERROR: Linking fragment stage: Missing entry point: Each stage requires one "voi
Shader version: 440 Shader version: 440
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:144 Function Definition: interp( (global void)
0:144 Function Parameters:
0:146 Sequence
0:146 interpolateAtCentroid (global 2-component vector of float)
0:146 vector swizzle (temp 2-component vector of float)
0:146 direct index (smooth sample temp 3-component vector of float)
0:146 'sampInArray' (smooth sample in 4-element array of 3-component vector of float)
0:146 Constant:
0:146 2 (const int)
0:146 Sequence
0:146 Constant:
0:146 0 (const int)
0:146 Constant:
0:146 1 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float) 0:? 'a' (layout(location=4 component=2 ) smooth in 2-component vector of float)
0:? 'b' (layout(location=4 component=1 ) smooth in float) 0:? 'b' (layout(location=4 component=1 ) smooth in float)
...@@ -131,4 +160,5 @@ ERROR: node is still EOpNull! ...@@ -131,4 +160,5 @@ ERROR: node is still EOpNull!
0:? 'specExample4301' (layout(column_major std430 align=128 ) uniform block{layout(column_major std430 offset=0 align=128 ) uniform 4-component vector of float a, layout(column_major std430 offset=128 align=128 ) uniform 3-component vector of float b, layout(column_major std430 offset=256 align=128 ) uniform 2-component vector of float d, layout(column_major std430 offset=512 align=128 ) uniform float e, layout(column_major std430 offset=520 align=8 ) uniform double f, layout(column_major std430 offset=640 align=128 ) uniform float h, layout(column_major std430 offset=768 align=128 ) uniform 3-component vector of double i}) 0:? 'specExample4301' (layout(column_major std430 align=128 ) uniform block{layout(column_major std430 offset=0 align=128 ) uniform 4-component vector of float a, layout(column_major std430 offset=128 align=128 ) uniform 3-component vector of float b, layout(column_major std430 offset=256 align=128 ) uniform 2-component vector of float d, layout(column_major std430 offset=512 align=128 ) uniform float e, layout(column_major std430 offset=520 align=8 ) uniform double f, layout(column_major std430 offset=640 align=128 ) uniform float h, layout(column_major std430 offset=768 align=128 ) uniform 3-component vector of double i})
0:? 'aconst' (global 4-element array of int) 0:? 'aconst' (global 4-element array of int)
0:? 'bconst' (global 64-element array of int) 0:? 'bconst' (global 64-element array of int)
0:? 'sampInArray' (smooth sample in 4-element array of 3-component vector of float)
...@@ -226,6 +226,10 @@ enum TOperator { ...@@ -226,6 +226,10 @@ enum TOperator {
EOpDPdyCoarse, // Fragment only EOpDPdyCoarse, // Fragment only
EOpFwidthCoarse, // Fragment only EOpFwidthCoarse, // Fragment only
EOpInterpolateAtCentroid, // Fragment only
EOpInterpolateAtSample, // Fragment only
EOpInterpolateAtOffset, // Fragment only
EOpMatrixTimesMatrix, EOpMatrixTimesMatrix,
EOpOuterProduct, EOpOuterProduct,
EOpDeterminant, EOpDeterminant,
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "3.0.730" #define GLSLANG_REVISION "3.0.732"
#define GLSLANG_DATE "21-Aug-2015" #define GLSLANG_DATE "22-Aug-2015"
...@@ -1185,6 +1185,28 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1185,6 +1185,28 @@ void TBuiltIns::initialize(int version, EProfile profile)
"\n"); "\n");
} }
// GL_OES_shader_multisample_interpolation
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
stageBuiltins[EShLangFragment].append(
"float interpolateAtCentroid(float);"
"vec2 interpolateAtCentroid(vec2);"
"vec3 interpolateAtCentroid(vec3);"
"vec4 interpolateAtCentroid(vec4);"
"float interpolateAtSample(float, int);"
"vec2 interpolateAtSample(vec2, int);"
"vec3 interpolateAtSample(vec3, int);"
"vec4 interpolateAtSample(vec4, int);"
"float interpolateAtOffset(float, vec2);"
"vec2 interpolateAtOffset(vec2, vec2);"
"vec3 interpolateAtOffset(vec3, vec2);"
"vec4 interpolateAtOffset(vec4, vec2);"
"\n");
}
//============================================================================ //============================================================================
// //
// Standard Uniforms // Standard Uniforms
...@@ -3009,8 +3031,12 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb ...@@ -3009,8 +3031,12 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives); symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives);
symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives); symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives);
} }
if (version >= 310) if (version >= 310) {
symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);
symbolTable.setFunctionExtensions("interpolateAtCentroid", 1, &E_GL_OES_shader_multisample_interpolation);
symbolTable.setFunctionExtensions("interpolateAtSample", 1, &E_GL_OES_shader_multisample_interpolation);
symbolTable.setFunctionExtensions("interpolateAtOffset", 1, &E_GL_OES_shader_multisample_interpolation);
}
} else if (version < 130) { } else if (version < 130) {
symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod); symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod);
symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod); symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod);
...@@ -3351,6 +3377,9 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb ...@@ -3351,6 +3377,9 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse); symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse);
symbolTable.relateToOperator("fwidthCoarse", EOpFwidthCoarse); symbolTable.relateToOperator("fwidthCoarse", EOpFwidthCoarse);
} }
symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);
symbolTable.relateToOperator("interpolateAtSample", EOpInterpolateAtSample);
symbolTable.relateToOperator("interpolateAtOffset", EOpInterpolateAtOffset);
break; break;
case EShLangCompute: case EShLangCompute:
......
...@@ -861,6 +861,35 @@ TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, const TSourceLoc& ...@@ -861,6 +861,35 @@ TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, const TSourceLoc&
} }
// //
// Follow the left branches down to the root of an l-value
// expression (just "." and []).
//
// Return the base of the l-value (where following indexing quits working).
// Return nullptr if a chain following dereferences cannot be followed.
//
// 'swizzleOkay' says whether or not it is okay to consider a swizzle
// a valid part of the dereference chain.
//
const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool swizzleOkay)
{
do {
const TIntermBinary* binary = node->getAsBinaryNode();
if (binary == nullptr)
return node;
TOperator op = binary->getOp();
if (op != EOpIndexDirect && op != EOpIndexIndirect && op != EOpIndexDirectStruct && op != EOpVectorSwizzle)
return nullptr;
if (! swizzleOkay) {
if (op == EOpVectorSwizzle)
return nullptr;
if ((op == EOpIndexDirect || op == EOpIndexIndirect) && binary->getLeft()->getType().isVector() && ! binary->getLeft()->getType().isArray())
return nullptr;
}
node = node->getAsBinaryNode()->getLeft();
} while (true);
}
//
// Create loop nodes. // Create loop nodes.
// //
TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc) TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc)
......
...@@ -1485,6 +1485,30 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan ...@@ -1485,6 +1485,30 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
break; break;
} }
case EOpInterpolateAtCentroid:
case EOpInterpolateAtSample:
case EOpInterpolateAtOffset:
// "For the interpolateAt* functions, the call will return a precision
// qualification matching the precision of the 'interpolant' argument to
// the function call."
callNode.getQualifier().precision = arg0->getQualifier().precision;
// Make sure the first argument is an interpolant, or an array element of an interpolant
if (arg0->getType().getQualifier().storage != EvqVaryingIn) {
// It might still be an array element.
//
// We could check more, but the semantics of the first argument are already met; the
// only way to turn an array into a float/vec* is array dereference and swizzle.
//
// ES and desktop 4.3 and earlier: swizzles may not be used
// desktop 4.4 and later: swizzles may be used
bool swizzleOkay = (profile != EEsProfile) && (version >= 440);
const TIntermTyped* base = TIntermediate::findLValueBase(arg0, swizzleOkay);
if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn)
error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), "");
}
break;
default: default:
break; break;
} }
...@@ -2456,6 +2480,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali ...@@ -2456,6 +2480,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
error(loc, "cannot be a matrix", GetStorageQualifierString(qualifier.storage), ""); error(loc, "cannot be a matrix", GetStorageQualifierString(qualifier.storage), "");
return; return;
} }
if (qualifier.isAuxiliary())
error(loc, "can't use auxiliary qualifier on a fragment output", "centroid/sample/patch", "");
if (qualifier.isInterpolation())
error(loc, "can't use interpolation qualifier on a fragment output", "flat/smooth/noperspective", "");
break; break;
case EShLangCompute: case EShLangCompute:
......
...@@ -738,6 +738,10 @@ int TScanContext::tokenizeIdentifier() ...@@ -738,6 +738,10 @@ int TScanContext::tokenizeIdentifier()
return es30ReservedFromGLSL(400); return es30ReservedFromGLSL(400);
case SAMPLE: case SAMPLE:
if (parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
return keyword;
return es30ReservedFromGLSL(400);
case SUBROUTINE: case SUBROUTINE:
return es30ReservedFromGLSL(400); return es30ReservedFromGLSL(400);
......
...@@ -183,7 +183,7 @@ void TParseContext::initializeExtensionBehavior() ...@@ -183,7 +183,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisablePartial; extensionBehavior[E_GL_KHR_blend_equation_advanced] = EBhDisablePartial;
extensionBehavior[E_GL_OES_sample_variables] = EBhDisable; extensionBehavior[E_GL_OES_sample_variables] = EBhDisable;
extensionBehavior[E_GL_OES_shader_image_atomic] = EBhDisable; extensionBehavior[E_GL_OES_shader_image_atomic] = EBhDisable;
extensionBehavior[E_GL_OES_shader_multisample_interpolation] = EBhDisablePartial; extensionBehavior[E_GL_OES_shader_multisample_interpolation] = EBhDisable;
extensionBehavior[E_GL_OES_texture_storage_multisample_2d_array] = EBhDisable; extensionBehavior[E_GL_OES_texture_storage_multisample_2d_array] = EBhDisable;
extensionBehavior[E_GL_EXT_geometry_shader] = EBhDisable; extensionBehavior[E_GL_EXT_geometry_shader] = EBhDisable;
extensionBehavior[E_GL_EXT_geometry_point_size] = EBhDisable; extensionBehavior[E_GL_EXT_geometry_point_size] = EBhDisable;
......
...@@ -286,6 +286,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) ...@@ -286,6 +286,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpDPdxCoarse: out.debug << "dPdxCoarse"; break; case EOpDPdxCoarse: out.debug << "dPdxCoarse"; break;
case EOpDPdyCoarse: out.debug << "dPdyCoarse"; break; case EOpDPdyCoarse: out.debug << "dPdyCoarse"; break;
case EOpFwidthCoarse: out.debug << "fwidthCoarse"; break; case EOpFwidthCoarse: out.debug << "fwidthCoarse"; break;
case EOpInterpolateAtCentroid: out.debug << "interpolateAtCentroid"; break;
case EOpDeterminant: out.debug << "determinant"; break; case EOpDeterminant: out.debug << "determinant"; break;
case EOpMatrixInverse: out.debug << "inverse"; break; case EOpMatrixInverse: out.debug << "inverse"; break;
case EOpTranspose: out.debug << "transpose"; break; case EOpTranspose: out.debug << "transpose"; break;
...@@ -473,8 +476,11 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node ...@@ -473,8 +476,11 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpBitfieldInsert: out.debug << "bitfieldInsert"; break; case EOpBitfieldInsert: out.debug << "bitfieldInsert"; break;
case EOpFma: out.debug << "fma"; break; case EOpFma: out.debug << "fma"; break;
case EOpFrexp: out.debug << "frexp"; break; case EOpFrexp: out.debug << "frexp"; break;
case EOpLdexp: out.debug << "ldexp"; break; case EOpLdexp: out.debug << "ldexp"; break;
case EOpInterpolateAtSample: out.debug << "interpolateAtSample"; break;
case EOpInterpolateAtOffset: out.debug << "interpolateAtOffset"; break;
default: out.debug.message(EPrefixError, "Bad aggregation op"); default: out.debug.message(EPrefixError, "Bad aggregation op");
} }
......
...@@ -192,6 +192,9 @@ public: ...@@ -192,6 +192,9 @@ public:
TIntermTyped* foldDereference(TIntermTyped* node, int index, const TSourceLoc&); TIntermTyped* foldDereference(TIntermTyped* node, int index, const TSourceLoc&);
TIntermTyped* foldSwizzle(TIntermTyped* node, TVectorFields& fields, const TSourceLoc&); TIntermTyped* foldSwizzle(TIntermTyped* node, TVectorFields& fields, const TSourceLoc&);
// Tree ops
static const TIntermTyped* findLValueBase(const TIntermTyped*, bool swizzleOkay);
// Linkage related // Linkage related
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&); void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&); void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment