Commit 453bb26e by John Kessenich

glslang AEP: The extension scheme, extension-enabled stage-existence testing,…

glslang AEP: The extension scheme, extension-enabled stage-existence testing, and compute-shader interface. Still needs in/out blocks, unsized arrays, etc. before real testing can be done. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31479 e7fa87d3-cd2b-0410-9028-fcbf551c1848
parent 4751ce3f
#version 310 es
#extension GL_EXT_geometry_shader : enable
precision mediump float;
in fromVertex {
in vec3 color;
} fromV[];
out toFragment {
out vec3 color;
} toF;
out fromVertex { // okay to reuse a block name for another block name
vec3 color;
};
out fooB {
vec2 color;
} fromVertex; // ERROR, cannot reuse block name as block instance
int fromVertex; // ERROR, cannot reuse a block name for something else
out fooC {
vec2 color;
} fooC; // ERROR, cannot have same name for block and instance name
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV[0].color;
gl_ClipDistance[3] = gl_in[1].gl_ClipDistance[2];
gl_Position = gl_in[0].gl_Position;
gl_PointSize = gl_in[3].gl_PointSize;
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = 2;
}
out vec4 ov0; // stream should be 0
layout(stream = 4) out vec4 ov4;
out vec4 o1v0; // stream should be 0
layout(stream = 3) uniform; // ERROR
layout(stream = 3) in; // ERROR
layout(stream = 3) uniform int ua; // ERROR
layout(stream = 3) uniform ubb { int ua; } ibb; // ERROR
layout(line_strip, points, triangle_strip, stream = 3, points, triangle_strip) out; // just means "stream = 3, triangle_strip"
layout(stream = 3, triangle_strip) out;
out vec4 ov3; // stream should be 3
layout(stream = 6) out ooutb { vec4 a; } ouuaa6;
layout(stream = 6) out ooutb2 {
layout(stream = 6) vec4 a;
} ouua6;
layout(stream = 7) out ooutb3 {
layout(stream = 6) vec4 a; // ERROR
} ouua7;
out vec4 ov2s3; // stream should be 3
layout(max_vertices = 200) out;
layout(max_vertices = 300) out; // ERROR, too big
void foo(layout(max_vertices = 4) int a) // ERROR
{
ouuaa6.a = vec4(1.0);
}
layout(line_strip, points, triangle_strip, stream = 3, points) out; // ERROR, changing output primitive
layout(line_strip, points, stream = 3) out; // ERROR, changing output primitive
layout(triangle_strip) in; // ERROR, not an input primitive
layout(triangle_strip) uniform; // ERROR
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
out outbn2 {
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
layout(max_vertices = 3) int b; // ERROR, not on a block member
layout(triangle_strip) int c; // ERROR, not on a block member
} outbi;
layout(lines) out; // ERROR, not on output
layout(lines_adjacency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4) in; // ERROR, not until 4.0
in inbn {
layout(stream = 2) int a; // ERROR, stream on input
} inbi[];
in sameName {
int a15;
} insn[];
out sameName {
float f15;
};
uniform sameName {
bool b15;
};
float summ = gl_MaxVertexAttribs +
gl_MaxVertexUniformComponents +
gl_MaxVaryingFloats +
gl_MaxVaryingComponents +
gl_MaxVertexOutputComponents +
gl_MaxGeometryInputComponents +
gl_MaxGeometryOutputComponents +
gl_MaxFragmentInputComponents +
gl_MaxVertexTextureImageUnits +
gl_MaxCombinedTextureImageUnits +
gl_MaxTextureImageUnits +
gl_MaxFragmentUniformComponents +
gl_MaxDrawBuffers +
gl_MaxClipDistances +
gl_MaxGeometryTextureImageUnits +
gl_MaxGeometryOutputVertices +
gl_MaxGeometryTotalOutputComponents +
gl_MaxGeometryUniformComponents +
gl_MaxGeometryVaryingComponents;
void fooe1()
{
gl_ViewportIndex = gl_MaxViewports - 1;
}
#extension GL_ARB_viewport_array : enable
void fooe2()
{
gl_ViewportIndex = gl_MaxViewports - 1;
}
out int gl_ViewportIndex;
...@@ -15,7 +15,7 @@ Shader version: 110 ...@@ -15,7 +15,7 @@ Shader version: 110
0:? Linker Objects 0:? Linker Objects
noMain1.geom noMain1.geom
ERROR: #version: geometry shaders require non-es profile and version 150 or above ERROR: #version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above
ERROR: 1 compilation errors. No code generated. ERROR: 1 compilation errors. No code generated.
......
...@@ -38,6 +38,7 @@ comment.frag ...@@ -38,6 +38,7 @@ comment.frag
300block.frag 300block.frag
310.comp 310.comp
310.vert 310.vert
310.geom
310.frag 310.frag
310implicitSizeArrayError.vert 310implicitSizeArrayError.vert
310AofA.vert 310AofA.vert
......
...@@ -989,7 +989,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -989,7 +989,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check "vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
"vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check "vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
"vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod "vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod
"\n"); "\n");
} }
if ( profile == ECompatibilityProfile || if ( profile == ECompatibilityProfile ||
...@@ -1026,14 +1026,15 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1026,14 +1026,15 @@ void TBuiltIns::initialize(int version, EProfile profile)
"\n"); "\n");
} }
if (profile != EEsProfile && version >= 150) { if ((profile != EEsProfile && version >= 150) ||
(profile == EEsProfile && version >= 310)) {
//============================================================================ //============================================================================
// //
// Prototypes for built-in functions seen by geometry shaders only. // Prototypes for built-in functions seen by geometry shaders only.
// //
//============================================================================ //============================================================================
if (version >= 400) { if (profile != EEsProfile && version >= 400) {
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"void EmitStreamVertex(int);" "void EmitStreamVertex(int);"
"void EndStreamPrimitive(int);" "void EndStreamPrimitive(int);"
...@@ -1093,7 +1094,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1093,7 +1094,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 texture3D(sampler3D, vec3, float);" // OES_texture_3D "vec4 texture3D(sampler3D, vec3, float);" // OES_texture_3D
"vec4 texture3DProj(sampler3D, vec4, float);" // OES_texture_3D "vec4 texture3DProj(sampler3D, vec4, float);" // OES_texture_3D
"vec4 textureCube(samplerCube, vec3, float);" "vec4 textureCube(samplerCube, vec3, float);"
"\n"); "\n");
} }
if (profile != EEsProfile && version > 100) { if (profile != EEsProfile && version > 100) {
...@@ -1105,7 +1106,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1105,7 +1106,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 shadow2D(sampler2DShadow, vec3, float);" "vec4 shadow2D(sampler2DShadow, vec3, float);"
"vec4 shadow1DProj(sampler1DShadow, vec4, float);" "vec4 shadow1DProj(sampler1DShadow, vec4, float);"
"vec4 shadow2DProj(sampler2DShadow, vec4, float);" "vec4 shadow2DProj(sampler2DShadow, vec4, float);"
"\n"); "\n");
} }
if (profile == EEsProfile) { if (profile == EEsProfile) {
...@@ -1114,7 +1115,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1114,7 +1115,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod "vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod
"vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod "vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod
"vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod "vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod
"\n"); "\n");
} }
...@@ -1128,12 +1129,12 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1128,12 +1129,12 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec2 dFdy(vec2 p);" "vec2 dFdy(vec2 p);"
"vec3 dFdy(vec3 p);" "vec3 dFdy(vec3 p);"
"vec4 dFdy(vec4 p);" "vec4 dFdy(vec4 p);"
"float fwidth(float p);" "float fwidth(float p);"
"vec2 fwidth(vec2 p);" "vec2 fwidth(vec2 p);"
"vec3 fwidth(vec3 p);" "vec3 fwidth(vec3 p);"
"vec4 fwidth(vec4 p);" "vec4 fwidth(vec4 p);"
"\n"); "\n");
// GL_ARB_derivative_control // GL_ARB_derivative_control
...@@ -1143,17 +1144,17 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1143,17 +1144,17 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec2 dFdxFine(vec2 p);" "vec2 dFdxFine(vec2 p);"
"vec3 dFdxFine(vec3 p);" "vec3 dFdxFine(vec3 p);"
"vec4 dFdxFine(vec4 p);" "vec4 dFdxFine(vec4 p);"
"float dFdyFine(float p);" "float dFdyFine(float p);"
"vec2 dFdyFine(vec2 p);" "vec2 dFdyFine(vec2 p);"
"vec3 dFdyFine(vec3 p);" "vec3 dFdyFine(vec3 p);"
"vec4 dFdyFine(vec4 p);" "vec4 dFdyFine(vec4 p);"
"float fwidthFine(float p);" "float fwidthFine(float p);"
"vec2 fwidthFine(vec2 p);" "vec2 fwidthFine(vec2 p);"
"vec3 fwidthFine(vec3 p);" "vec3 fwidthFine(vec3 p);"
"vec4 fwidthFine(vec4 p);" "vec4 fwidthFine(vec4 p);"
"\n"); "\n");
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
...@@ -1161,7 +1162,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1161,7 +1162,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"vec2 dFdxCoarse(vec2 p);" "vec2 dFdxCoarse(vec2 p);"
"vec3 dFdxCoarse(vec3 p);" "vec3 dFdxCoarse(vec3 p);"
"vec4 dFdxCoarse(vec4 p);" "vec4 dFdxCoarse(vec4 p);"
"float dFdyCoarse(float p);" "float dFdyCoarse(float p);"
"vec2 dFdyCoarse(vec2 p);" "vec2 dFdyCoarse(vec2 p);"
"vec3 dFdyCoarse(vec3 p);" "vec3 dFdyCoarse(vec3 p);"
...@@ -1505,7 +1506,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1505,7 +1506,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
"float gl_PointSize;" "float gl_PointSize;"
"float gl_ClipDistance[];" "float gl_ClipDistance[];"
"\n"); "\n");
if (version >= 400 && profile == ECompatibilityProfile) if (profile == ECompatibilityProfile && version >= 400)
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"vec4 gl_ClipVertex;" "vec4 gl_ClipVertex;"
"vec4 gl_FrontColor;" "vec4 gl_FrontColor;"
...@@ -1525,23 +1526,43 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -1525,23 +1526,43 @@ void TBuiltIns::initialize(int version, EProfile profile)
"out int gl_PrimitiveID;" "out int gl_PrimitiveID;"
"out int gl_Layer;"); "out int gl_Layer;");
if (version < 400 && profile == ECompatibilityProfile) if (profile == ECompatibilityProfile && version < 400)
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"out vec4 gl_ClipVertex;" "out vec4 gl_ClipVertex;"
); );
if (version >= 400 && profile != EEsProfile) if (version >= 400)
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"in int gl_InvocationID;" "in int gl_InvocationID;"
); );
// GL_ARB_viewport_array // GL_ARB_viewport_array
if (version >= 150 && profile != EEsProfile) if (version >= 150)
stageBuiltins[EShLangGeometry].append( stageBuiltins[EShLangGeometry].append(
"out int gl_ViewportIndex;" "out int gl_ViewportIndex;"
); );
stageBuiltins[EShLangGeometry].append("\n"); stageBuiltins[EShLangGeometry].append("\n");
} else if (profile == EEsProfile && version >= 310) {
stageBuiltins[EShLangGeometry].append(
"in gl_PerVertex {"
"highp vec4 gl_Position;"
"highp float gl_PointSize;"
"} gl_in[];"
"\n"
"in highp int gl_PrimitiveIDIn;"
"in highp int gl_InvocationID;"
"\n"
"out gl_PerVertex {"
"vec4 gl_Position;"
"float gl_PointSize;"
"};"
"\n"
"out int gl_PrimitiveID;"
"out int gl_Layer;"
"\n"
);
} }
//============================================================================ //============================================================================
// //
// Define the interface to the tessellation control shader. // Define the interface to the tessellation control shader.
...@@ -2275,6 +2296,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf ...@@ -2275,6 +2296,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset); snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);
s.append(builtInConstant); s.append(builtInConstant);
} }
// geometry
if (version >= 310) {
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources.maxGeometryAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources.maxGeometryAtomicCounterBuffers);
s.append(builtInConstant);
}
} else { } else {
// non-ES profile // non-ES profile
......
...@@ -157,7 +157,8 @@ bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& inp ...@@ -157,7 +157,8 @@ bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& inp
currentScanner = &input; currentScanner = &input;
ppContext.setInput(input, versionWillBeError); ppContext.setInput(input, versionWillBeError);
yyparse(this); yyparse(this);
finalErrorCheck(); if (! parsingBuiltins)
finalErrorCheck();
return numErrors == 0; return numErrors == 0;
} }
...@@ -3105,6 +3106,30 @@ void TParseContext::finalErrorCheck() ...@@ -3105,6 +3106,30 @@ void TParseContext::finalErrorCheck()
// Check on array indexes for ES 2.0 (version 100) limitations. // Check on array indexes for ES 2.0 (version 100) limitations.
for (size_t i = 0; i < needsIndexLimitationChecking.size(); ++i) for (size_t i = 0; i < needsIndexLimitationChecking.size(); ++i)
constantIndexExpressionCheck(needsIndexLimitationChecking[i]); constantIndexExpressionCheck(needsIndexLimitationChecking[i]);
// Check for stages that are enabled by extension.
// Can't do this at the beginning, it is chicken and egg to add a stage by extension.
// Specific stage-specific features were correctly tested for already, this is just
// about the stage itself.
switch (language) {
case EShLangGeometry:
if (profile == EEsProfile && version == 310)
requireExtensions(getCurrentLoc(), 1, &GL_EXT_geometry_shader, "geometry shaders");
break;
case EShLangTessControl:
case EShLangTessEvaluation:
if (profile == EEsProfile && version == 310)
requireExtensions(getCurrentLoc(), 1, &GL_EXT_tessellation_shader, "tessellation shaders");
else if (profile != EEsProfile && version < 400)
requireExtensions(getCurrentLoc(), 1, &GL_ARB_tessellation_shader, "tessellation shaders");
break;
case EShLangCompute:
if (profile != EEsProfile && version < 430)
requireExtensions(getCurrentLoc(), 1, &GL_ARB_compute_shader, "tessellation shaders");
break;
default:
break;
}
} }
// //
......
...@@ -224,6 +224,7 @@ protected: ...@@ -224,6 +224,7 @@ protected:
TIntermNode* executeInitializer(TSourceLoc, TIntermTyped* initializer, TVariable* variable); TIntermNode* executeInitializer(TSourceLoc, TIntermTyped* initializer, TVariable* variable);
TIntermTyped* convertInitializerList(TSourceLoc, const TType&, TIntermTyped* initializer); TIntermTyped* convertInitializerList(TSourceLoc, const TType&, TIntermTyped* initializer);
TOperator mapTypeToConstructorOp(const TType&) const; TOperator mapTypeToConstructorOp(const TType&) const;
void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
void finalErrorCheck(); void finalErrorCheck();
public: public:
......
...@@ -347,28 +347,32 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo ...@@ -347,28 +347,32 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
// Correct for stage type... // Correct for stage type...
switch (stage) { switch (stage) {
case EShLangGeometry: case EShLangGeometry:
if (version < 150 || (profile != ECoreProfile && profile != ECompatibilityProfile)) { if ((profile == EEsProfile && version < 310) ||
(profile != EEsProfile && version < 150)) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: geometry shaders require non-es profile and version 150 or above"); infoSink.info.message(EPrefixError, "#version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above");
version = 150; version = (profile == EEsProfile) ? 310 : 150;
profile = ECoreProfile; if (profile == EEsProfile || profile == ENoProfile)
profile = ECoreProfile;
} }
break; break;
case EShLangTessControl: case EShLangTessControl:
case EShLangTessEvaluation: case EShLangTessEvaluation:
if (version < 150 || (profile != ECoreProfile && profile != ECompatibilityProfile)) { if ((profile == EEsProfile && version < 310) ||
(profile != EEsProfile && version < 150)) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: tessellation shaders require non-es profile and version 150 or above"); infoSink.info.message(EPrefixError, "#version: tessellation shaders require es profile with version 310 or non-es profile with version 150 or above");
version = 150; version = (profile == EEsProfile) ? 310 : 400; // 150 supports the extension, correction is to 400 which does not
profile = ECoreProfile; if (profile == EEsProfile || profile == ENoProfile)
profile = ECoreProfile;
} }
break; break;
case EShLangCompute: case EShLangCompute:
if ((profile == EEsProfile && version < 310) || if ((profile == EEsProfile && version < 310) ||
(profile != EEsProfile && version < 430)) { (profile != EEsProfile && version < 420)) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 430 or above"); infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above");
version = profile == EEsProfile ? 310 : 430; version = profile == EEsProfile ? 310 : 430; // 420 supports the extension, correction is to 430 which does not
profile = ECoreProfile; profile = ECoreProfile;
} }
break; break;
......
...@@ -161,6 +161,7 @@ void TParseContext::initializeExtensionBehavior() ...@@ -161,6 +161,7 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[GL_ARB_texture_gather] = EBhDisable; extensionBehavior[GL_ARB_texture_gather] = EBhDisable;
extensionBehavior[GL_ARB_gpu_shader5] = EBhDisablePartial; extensionBehavior[GL_ARB_gpu_shader5] = EBhDisablePartial;
extensionBehavior[GL_ARB_separate_shader_objects] = EBhDisable; extensionBehavior[GL_ARB_separate_shader_objects] = EBhDisable;
extensionBehavior[GL_ARB_compute_shader] = EBhDisablePartial;
extensionBehavior[GL_ARB_tessellation_shader] = EBhDisable; extensionBehavior[GL_ARB_tessellation_shader] = EBhDisable;
extensionBehavior[GL_ARB_enhanced_layouts] = EBhDisable; extensionBehavior[GL_ARB_enhanced_layouts] = EBhDisable;
extensionBehavior[GL_ARB_texture_cube_map_array] = EBhDisable; extensionBehavior[GL_ARB_texture_cube_map_array] = EBhDisable;
...@@ -172,6 +173,23 @@ void TParseContext::initializeExtensionBehavior() ...@@ -172,6 +173,23 @@ void TParseContext::initializeExtensionBehavior()
extensionBehavior[GL_ARB_shader_texture_image_samples] = EBhDisable; extensionBehavior[GL_ARB_shader_texture_image_samples] = EBhDisable;
extensionBehavior[GL_ARB_viewport_array] = EBhDisable; extensionBehavior[GL_ARB_viewport_array] = EBhDisable;
// extensionBehavior[GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members // extensionBehavior[GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
// AEP
extensionBehavior[GL_ANDROID_extension_pack_es31a] = EBhDisablePartial;
extensionBehavior[GL_KHR_blend_equation_advanced] = EBhDisablePartial;
extensionBehavior[GL_OES_sample_variables] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_image_atomic] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_multisample_interpolation] = EBhDisablePartial;
extensionBehavior[GL_OES_texture_storage_multisample_2d_array] = EBhDisablePartial;
extensionBehavior[GL_EXT_geometry_shader] = EBhDisablePartial;
extensionBehavior[GL_EXT_geometry_point_size] = EBhDisablePartial;
extensionBehavior[GL_EXT_gpu_shader5] = EBhDisablePartial;
extensionBehavior[GL_EXT_primitive_bounding_box] = EBhDisablePartial;
extensionBehavior[GL_EXT_shader_io_blocks] = EBhDisablePartial;
extensionBehavior[GL_EXT_tessellation_shader] = EBhDisablePartial;
extensionBehavior[GL_EXT_tessellation_point_size] = EBhDisablePartial;
extensionBehavior[GL_EXT_texture_buffer] = EBhDisablePartial;
extensionBehavior[GL_EXT_texture_cube_map_array] = EBhDisablePartial;
} }
// Get code that is not part of a shared symbol table, is specific to this shader, // Get code that is not part of a shared symbol table, is specific to this shader,
...@@ -187,6 +205,23 @@ const char* TParseContext::getPreamble() ...@@ -187,6 +205,23 @@ const char* TParseContext::getPreamble()
"#define GL_EXT_frag_depth 1\n" "#define GL_EXT_frag_depth 1\n"
"#define GL_OES_EGL_image_external 1\n" "#define GL_OES_EGL_image_external 1\n"
"#define GL_EXT_shader_texture_lod 1\n" "#define GL_EXT_shader_texture_lod 1\n"
// AEP
"#define GL_ANDROID_extension_pack_es31a 1\n"
"#define GL_KHR_blend_equation_advanced 1\n"
"#define GL_OES_sample_variables 1\n"
"#define GL_OES_shader_image_atomic 1\n"
"#define GL_OES_shader_multisample_interpolation 1\n"
"#define GL_OES_texture_storage_multisample_2d_array 1\n"
"#define GL_EXT_geometry_shader 1\n"
"#define GL_EXT_geometry_point_size 1\n"
"#define GL_EXT_gpu_shader5 1\n"
"#define GL_EXT_primitive_bounding_box 1\n"
"#define GL_EXT_shader_io_blocks 1\n"
"#define GL_EXT_tessellation_shader 1\n"
"#define GL_EXT_tessellation_point_size 1\n"
"#define GL_EXT_texture_buffer 1\n"
"#define GL_EXT_texture_cube_map_array 1\n"
; ;
} else { } else {
return return
...@@ -196,6 +231,7 @@ const char* TParseContext::getPreamble() ...@@ -196,6 +231,7 @@ const char* TParseContext::getPreamble()
"#define GL_ARB_texture_gather 1\n" "#define GL_ARB_texture_gather 1\n"
"#define GL_ARB_gpu_shader5 1\n" "#define GL_ARB_gpu_shader5 1\n"
"#define GL_ARB_separate_shader_objects 1\n" "#define GL_ARB_separate_shader_objects 1\n"
"#define GL_ARB_compute_shader 1\n"
"#define GL_ARB_tessellation_shader 1\n" "#define GL_ARB_tessellation_shader 1\n"
"#define GL_ARB_enhanced_layouts 1\n" "#define GL_ARB_enhanced_layouts 1\n"
"#define GL_ARB_texture_cube_map_array 1\n" "#define GL_ARB_texture_cube_map_array 1\n"
...@@ -434,12 +470,36 @@ void TParseContext::updateExtensionBehavior(const char* extension, const char* b ...@@ -434,12 +470,36 @@ void TParseContext::updateExtensionBehavior(const char* extension, const char* b
behavior = EBhDisable; behavior = EBhDisable;
else if (! strcmp("warn", behaviorString)) else if (! strcmp("warn", behaviorString))
behavior = EBhWarn; behavior = EBhWarn;
else else {
error(getCurrentLoc(), "behavior not supported", "#extension", behaviorString); error(getCurrentLoc(), "behavior not supported:", "#extension", behaviorString);
return;
}
// update the requested extension
updateExtensionBehavior(extension, behavior);
// see if need to propagate to everything in AEP
if (strcmp(extension, "GL_ANDROID_extension_pack_es31a") == 0) {
updateExtensionBehavior("GL_KHR_blend_equation_advanced", behaviorString);
updateExtensionBehavior("GL_OES_sample_variables", behaviorString);
updateExtensionBehavior("GL_OES_shader_image_atomic", behaviorString);
updateExtensionBehavior("GL_OES_shader_multisample_interpolation", behaviorString);
updateExtensionBehavior("GL_OES_texture_storage_multisample_2d_array", behaviorString);
updateExtensionBehavior("GL_EXT_geometry_shader", behaviorString);
updateExtensionBehavior("GL_EXT_gpu_shader5", behaviorString);
updateExtensionBehavior("GL_EXT_primitive_bounding_box", behaviorString);
updateExtensionBehavior("GL_EXT_shader_io_blocks", behaviorString);
updateExtensionBehavior("GL_EXT_tessellation_shader", behaviorString);
updateExtensionBehavior("GL_EXT_texture_buffer", behaviorString);
updateExtensionBehavior("GL_EXT_texture_cube_map_array", behaviorString);
}
}
void TParseContext::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior)
{
// Update the current behavior // Update the current behavior
TMap<TString, TExtensionBehavior>::iterator iter; TMap<TString, TExtensionBehavior>::iterator iter;
if (! strcmp(extension, "all")) { if (strcmp(extension, "all") == 0) {
// special case for the 'all' extension; apply it to every extension present // special case for the 'all' extension; apply it to every extension present
if (behavior == EBhRequire || behavior == EBhEnable) { if (behavior == EBhRequire || behavior == EBhEnable) {
error(getCurrentLoc(), "extension 'all' cannot have 'require' or 'enable' behavior", "#extension", ""); error(getCurrentLoc(), "extension 'all' cannot have 'require' or 'enable' behavior", "#extension", "");
......
...@@ -85,6 +85,7 @@ const char* const GL_ARB_shading_language_420pack = "GL_ARB_shading_language ...@@ -85,6 +85,7 @@ const char* const GL_ARB_shading_language_420pack = "GL_ARB_shading_language
const char* const GL_ARB_texture_gather = "GL_ARB_texture_gather"; const char* const GL_ARB_texture_gather = "GL_ARB_texture_gather";
const char* const GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5"; const char* const GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5";
const char* const GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects"; const char* const GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects";
const char* const GL_ARB_compute_shader = "GL_ARB_compute_shader";
const char* const GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader"; const char* const GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader";
const char* const GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts"; const char* const GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts";
const char* const GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array"; const char* const GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array";
...@@ -97,6 +98,23 @@ const char* const GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_i ...@@ -97,6 +98,23 @@ const char* const GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_i
const char* const GL_ARB_viewport_array = "GL_ARB_viewport_array"; const char* const GL_ARB_viewport_array = "GL_ARB_viewport_array";
//const char* const GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members //const char* const GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
// AEP
const char* const GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a";
const char* const GL_KHR_blend_equation_advanced = "GL_KHR_blend_equation_advanced";
const char* const GL_OES_sample_variables = "GL_OES_sample_variables";
const char* const GL_OES_shader_image_atomic = "GL_OES_shader_image_atomic";
const char* const GL_OES_shader_multisample_interpolation = "GL_OES_shader_multisample_interpolation";
const char* const GL_OES_texture_storage_multisample_2d_array = "GL_OES_texture_storage_multisample_2d_array";
const char* const GL_EXT_geometry_shader = "GL_EXT_geometry_shader";
const char* const GL_EXT_geometry_point_size = "GL_EXT_geometry_point_size";
const char* const GL_EXT_gpu_shader5 = "GL_EXT_gpu_shader5";
const char* const GL_EXT_primitive_bounding_box = "GL_EXT_primitive_bounding_box";
const char* const GL_EXT_shader_io_blocks = "GL_EXT_shader_io_blocks";
const char* const GL_EXT_tessellation_shader = "GL_EXT_tessellation_shader";
const char* const GL_EXT_tessellation_point_size = "GL_EXT_tessellation_point_size";
const char* const GL_EXT_texture_buffer = "GL_EXT_texture_buffer";
const char* const GL_EXT_texture_cube_map_array = "GL_EXT_texture_cube_map_array";
} // end namespace glslang } // end namespace glslang
#endif // _VERSIONS_INCLUDED_ #endif // _VERSIONS_INCLUDED_
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