Commit 93deac52 by Adam Jackson

Fix incompatibility with <GL/glext.h>

New extensions in glext.h follow the pattern: #ifndef GL_ARB_texture_rectangle #define GL_ARB_texture_rectangle 1 #define GL_TEXTURE_RECTANGLE_ARB 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 #endif /* GL_ARB_texture_rectangle */ Versions.h tries to declare: const char* const GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle"; Which means, if you've included glext.h before Versions.h, that the compiler will see "const char* const 1 = ...", and rightly refuse to continue. The ham-fisted approach taken here is to rename the variables in Versions.h with a leading underscore. This does sort of undermine the comment about "better to have the compiler do spelling checks", but. Signed-off-by: 's avatarAdam Jackson <ajax@redhat.com>
parent 1189a7bc
...@@ -686,7 +686,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -686,7 +686,7 @@ int TScanContext::tokenizeIdentifier()
case ATOMIC_UINT: case ATOMIC_UINT:
if (parseContext.profile == EEsProfile && parseContext.version >= 310 || if (parseContext.profile == EEsProfile && parseContext.version >= 310 ||
parseContext.extensionsTurnedOn(1, &GL_ARB_shader_atomic_counters)) parseContext.extensionsTurnedOn(1, &_GL_ARB_shader_atomic_counters))
return keyword; return keyword;
return es30ReservedFromGLSL(420); return es30ReservedFromGLSL(420);
...@@ -696,20 +696,20 @@ int TScanContext::tokenizeIdentifier() ...@@ -696,20 +696,20 @@ int TScanContext::tokenizeIdentifier()
case WRITEONLY: case WRITEONLY:
if (parseContext.profile == EEsProfile && parseContext.version >= 310) if (parseContext.profile == EEsProfile && parseContext.version >= 310)
return keyword; return keyword;
return es30ReservedFromGLSL(parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store) ? 130 : 420); return es30ReservedFromGLSL(parseContext.extensionsTurnedOn(1, &_GL_ARB_shader_image_load_store) ? 130 : 420);
case VOLATILE: case VOLATILE:
if (parseContext.profile == EEsProfile && parseContext.version >= 310) if (parseContext.profile == EEsProfile && parseContext.version >= 310)
return keyword; return keyword;
if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store)))) if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionsTurnedOn(1, &_GL_ARB_shader_image_load_store))))
reservedWord(); reservedWord();
return keyword; return keyword;
case LAYOUT: case LAYOUT:
{ {
const int numLayoutExts = 2; const int numLayoutExts = 2;
const char* layoutExts[numLayoutExts] = { GL_ARB_shading_language_420pack, const char* layoutExts[numLayoutExts] = { _GL_ARB_shading_language_420pack,
GL_ARB_explicit_attrib_location }; _GL_ARB_explicit_attrib_location };
if ((parseContext.profile == EEsProfile && parseContext.version < 300) || if ((parseContext.profile == EEsProfile && parseContext.version < 300) ||
(parseContext.profile != EEsProfile && parseContext.version < 140 && (parseContext.profile != EEsProfile && parseContext.version < 140 &&
! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts))) ! parseContext.extensionsTurnedOn(numLayoutExts, layoutExts)))
...@@ -725,7 +725,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -725,7 +725,7 @@ int TScanContext::tokenizeIdentifier()
case PATCH: case PATCH:
if (parseContext.symbolTable.atBuiltInLevel() || if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) || (parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) ||
(parseContext.profile != EEsProfile && parseContext.extensionsTurnedOn(1, &GL_ARB_tessellation_shader))) (parseContext.profile != EEsProfile && parseContext.extensionsTurnedOn(1, &_GL_ARB_tessellation_shader)))
return keyword; return keyword;
return es30ReservedFromGLSL(400); return es30ReservedFromGLSL(400);
...@@ -818,7 +818,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -818,7 +818,7 @@ int TScanContext::tokenizeIdentifier()
case ISAMPLERCUBEARRAY: case ISAMPLERCUBEARRAY:
case USAMPLERCUBEARRAY: case USAMPLERCUBEARRAY:
afterType = true; afterType = true;
if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionsTurnedOn(1, &GL_ARB_texture_cube_map_array))) if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionsTurnedOn(1, &_GL_ARB_texture_cube_map_array)))
reservedWord(); reservedWord();
return keyword; return keyword;
...@@ -880,7 +880,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -880,7 +880,7 @@ int TScanContext::tokenizeIdentifier()
case SAMPLER3D: case SAMPLER3D:
afterType = true; afterType = true;
if (parseContext.profile == EEsProfile && parseContext.version < 300) { if (parseContext.profile == EEsProfile && parseContext.version < 300) {
if (! parseContext.extensionsTurnedOn(1, &GL_OES_texture_3D)) if (! parseContext.extensionsTurnedOn(1, &_GL_OES_texture_3D))
reservedWord(); reservedWord();
} }
return keyword; return keyword;
...@@ -896,9 +896,9 @@ int TScanContext::tokenizeIdentifier() ...@@ -896,9 +896,9 @@ int TScanContext::tokenizeIdentifier()
afterType = true; afterType = true;
if (parseContext.profile == EEsProfile) if (parseContext.profile == EEsProfile)
reservedWord(); reservedWord();
else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionsTurnedOn(1, &GL_ARB_texture_rectangle)) { else if (parseContext.version < 140 && ! parseContext.symbolTable.atBuiltInLevel() && ! parseContext.extensionsTurnedOn(1, &_GL_ARB_texture_rectangle)) {
if (parseContext.messages & EShMsgRelaxedErrors) if (parseContext.messages & EShMsgRelaxedErrors)
parseContext.requireExtensions(loc, 1, &GL_ARB_texture_rectangle, "texture-rectangle sampler keyword"); parseContext.requireExtensions(loc, 1, &_GL_ARB_texture_rectangle, "texture-rectangle sampler keyword");
else else
reservedWord(); reservedWord();
} }
...@@ -915,7 +915,7 @@ int TScanContext::tokenizeIdentifier() ...@@ -915,7 +915,7 @@ int TScanContext::tokenizeIdentifier()
case SAMPLEREXTERNALOES: case SAMPLEREXTERNALOES:
afterType = true; afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionsTurnedOn(1, &GL_OES_EGL_image_external)) if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionsTurnedOn(1, &_GL_OES_EGL_image_external))
return keyword; return keyword;
return identifierOrType(); return identifierOrType();
...@@ -1107,7 +1107,7 @@ int TScanContext::firstGenerationImage(bool inEs310) ...@@ -1107,7 +1107,7 @@ int TScanContext::firstGenerationImage(bool inEs310)
afterType = true; afterType = true;
if (parseContext.symbolTable.atBuiltInLevel() || if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store))) || (parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &_GL_ARB_shader_image_load_store))) ||
(inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310)) (inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310))
return keyword; return keyword;
...@@ -1135,7 +1135,7 @@ int TScanContext::secondGenerationImage() ...@@ -1135,7 +1135,7 @@ int TScanContext::secondGenerationImage()
if (parseContext.symbolTable.atBuiltInLevel() || if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile != EEsProfile && (parseContext.profile != EEsProfile &&
(parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store)))) (parseContext.version >= 420 || parseContext.extensionsTurnedOn(1, &_GL_ARB_shader_image_load_store))))
return keyword; return keyword;
if (parseContext.forwardCompatible) if (parseContext.forwardCompatible)
......
...@@ -149,58 +149,58 @@ namespace glslang { ...@@ -149,58 +149,58 @@ namespace glslang {
// //
void TParseContext::initializeExtensionBehavior() void TParseContext::initializeExtensionBehavior()
{ {
extensionBehavior[GL_OES_texture_3D] = EBhDisable; extensionBehavior[_GL_OES_texture_3D] = EBhDisable;
extensionBehavior[GL_OES_standard_derivatives] = EBhDisable; extensionBehavior[_GL_OES_standard_derivatives] = EBhDisable;
extensionBehavior[GL_EXT_frag_depth] = EBhDisable; extensionBehavior[_GL_EXT_frag_depth] = EBhDisable;
extensionBehavior[GL_OES_EGL_image_external] = EBhDisable; extensionBehavior[_GL_OES_EGL_image_external] = EBhDisable;
extensionBehavior[GL_EXT_shader_texture_lod] = EBhDisable; extensionBehavior[_GL_EXT_shader_texture_lod] = EBhDisable;
extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable; extensionBehavior[_GL_ARB_texture_rectangle] = EBhDisable;
extensionBehavior[GL_3DL_array_objects] = EBhDisable; extensionBehavior[_GL_3DL_array_objects] = EBhDisable;
extensionBehavior[GL_ARB_shading_language_420pack] = EBhDisable; extensionBehavior[_GL_ARB_shading_language_420pack] = EBhDisable;
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_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;
extensionBehavior[GL_ARB_shader_texture_lod] = EBhDisable; extensionBehavior[_GL_ARB_shader_texture_lod] = EBhDisable;
extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisable; extensionBehavior[_GL_ARB_explicit_attrib_location] = EBhDisable;
extensionBehavior[GL_ARB_shader_image_load_store] = EBhDisable; extensionBehavior[_GL_ARB_shader_image_load_store] = EBhDisable;
extensionBehavior[GL_ARB_shader_atomic_counters] = EBhDisable; extensionBehavior[_GL_ARB_shader_atomic_counters] = EBhDisable;
extensionBehavior[GL_ARB_derivative_control] = EBhDisable; extensionBehavior[_GL_ARB_derivative_control] = EBhDisable;
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 // AEP
extensionBehavior[GL_ANDROID_extension_pack_es31a] = EBhDisablePartial; extensionBehavior[_GL_ANDROID_extension_pack_es31a] = EBhDisablePartial;
extensionBehavior[GL_KHR_blend_equation_advanced] = EBhDisablePartial; extensionBehavior[_GL_KHR_blend_equation_advanced] = EBhDisablePartial;
extensionBehavior[GL_OES_sample_variables] = EBhDisablePartial; extensionBehavior[_GL_OES_sample_variables] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_image_atomic] = EBhDisablePartial; extensionBehavior[_GL_OES_shader_image_atomic] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_multisample_interpolation] = EBhDisablePartial; extensionBehavior[_GL_OES_shader_multisample_interpolation] = EBhDisablePartial;
extensionBehavior[GL_OES_texture_storage_multisample_2d_array] = EBhDisablePartial; extensionBehavior[_GL_OES_texture_storage_multisample_2d_array] = EBhDisablePartial;
extensionBehavior[GL_EXT_geometry_shader] = EBhDisable; extensionBehavior[_GL_EXT_geometry_shader] = EBhDisable;
extensionBehavior[GL_EXT_geometry_point_size] = EBhDisable; extensionBehavior[_GL_EXT_geometry_point_size] = EBhDisable;
extensionBehavior[GL_EXT_gpu_shader5] = EBhDisablePartial; extensionBehavior[_GL_EXT_gpu_shader5] = EBhDisablePartial;
extensionBehavior[GL_EXT_primitive_bounding_box] = EBhDisablePartial; extensionBehavior[_GL_EXT_primitive_bounding_box] = EBhDisablePartial;
extensionBehavior[GL_EXT_shader_io_blocks] = EBhDisable; extensionBehavior[_GL_EXT_shader_io_blocks] = EBhDisable;
extensionBehavior[GL_EXT_tessellation_shader] = EBhDisable; extensionBehavior[_GL_EXT_tessellation_shader] = EBhDisable;
extensionBehavior[GL_EXT_tessellation_point_size] = EBhDisable; extensionBehavior[_GL_EXT_tessellation_point_size] = EBhDisable;
extensionBehavior[GL_EXT_texture_buffer] = EBhDisablePartial; extensionBehavior[_GL_EXT_texture_buffer] = EBhDisablePartial;
extensionBehavior[GL_EXT_texture_cube_map_array] = EBhDisablePartial; extensionBehavior[_GL_EXT_texture_cube_map_array] = EBhDisablePartial;
// OES matching AEP // OES matching AEP
extensionBehavior[GL_OES_geometry_shader] = EBhDisable; extensionBehavior[_GL_OES_geometry_shader] = EBhDisable;
extensionBehavior[GL_OES_geometry_point_size] = EBhDisable; extensionBehavior[_GL_OES_geometry_point_size] = EBhDisable;
extensionBehavior[GL_OES_gpu_shader5] = EBhDisablePartial; extensionBehavior[_GL_OES_gpu_shader5] = EBhDisablePartial;
extensionBehavior[GL_OES_primitive_bounding_box] = EBhDisablePartial; extensionBehavior[_GL_OES_primitive_bounding_box] = EBhDisablePartial;
extensionBehavior[GL_OES_shader_io_blocks] = EBhDisable; extensionBehavior[_GL_OES_shader_io_blocks] = EBhDisable;
extensionBehavior[GL_OES_tessellation_shader] = EBhDisable; extensionBehavior[_GL_OES_tessellation_shader] = EBhDisable;
extensionBehavior[GL_OES_tessellation_point_size] = EBhDisable; extensionBehavior[_GL_OES_tessellation_point_size] = EBhDisable;
extensionBehavior[GL_OES_texture_buffer] = EBhDisablePartial; extensionBehavior[_GL_OES_texture_buffer] = EBhDisablePartial;
extensionBehavior[GL_OES_texture_cube_map_array] = EBhDisablePartial; extensionBehavior[_GL_OES_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,
......
...@@ -809,7 +809,7 @@ parameter_declarator ...@@ -809,7 +809,7 @@ parameter_declarator
// Type + name // Type + name
: type_specifier IDENTIFIER { : type_specifier IDENTIFIER {
if ($1.arraySizes) { if ($1.arraySizes) {
parseContext.profileRequires($1.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize()); parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
} }
...@@ -824,7 +824,7 @@ parameter_declarator ...@@ -824,7 +824,7 @@ parameter_declarator
} }
| type_specifier IDENTIFIER array_specifier { | type_specifier IDENTIFIER array_specifier {
if ($1.arraySizes) { if ($1.arraySizes) {
parseContext.profileRequires($1.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize()); parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
} }
...@@ -953,7 +953,7 @@ fully_specified_type ...@@ -953,7 +953,7 @@ fully_specified_type
parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$); parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$);
if ($1.arraySizes) { if ($1.arraySizes) {
parseContext.profileRequires($1.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
} }
...@@ -964,7 +964,7 @@ fully_specified_type ...@@ -964,7 +964,7 @@ fully_specified_type
parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2); parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
if ($2.arraySizes) { if ($2.arraySizes) {
parseContext.profileRequires($2.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($2.loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
} }
...@@ -1956,7 +1956,7 @@ struct_declaration_list ...@@ -1956,7 +1956,7 @@ struct_declaration_list
struct_declaration struct_declaration
: type_specifier struct_declarator_list SEMICOLON { : type_specifier struct_declarator_list SEMICOLON {
if ($1.arraySizes) { if ($1.arraySizes) {
parseContext.profileRequires($1.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($1.loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
if (parseContext.profile == EEsProfile) if (parseContext.profile == EEsProfile)
parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize()); parseContext.arraySizeRequiredCheck($1.loc, $1.arraySizes->getSize());
...@@ -1975,7 +1975,7 @@ struct_declaration ...@@ -1975,7 +1975,7 @@ struct_declaration
| type_qualifier type_specifier struct_declarator_list SEMICOLON { | type_qualifier type_specifier struct_declarator_list SEMICOLON {
parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
if ($2.arraySizes) { if ($2.arraySizes) {
parseContext.profileRequires($2.loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($2.loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
if (parseContext.profile == EEsProfile) if (parseContext.profile == EEsProfile)
parseContext.arraySizeRequiredCheck($2.loc, $2.arraySizes->getSize()); parseContext.arraySizeRequiredCheck($2.loc, $2.arraySizes->getSize());
...@@ -2028,13 +2028,13 @@ initializer ...@@ -2028,13 +2028,13 @@ initializer
| LEFT_BRACE initializer_list RIGHT_BRACE { | LEFT_BRACE initializer_list RIGHT_BRACE {
const char* initFeature = "{ } style initializers"; const char* initFeature = "{ } style initializers";
parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
parseContext.profileRequires($1.loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, initFeature); parseContext.profileRequires($1.loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, initFeature);
$$ = $2; $$ = $2;
} }
| LEFT_BRACE initializer_list COMMA RIGHT_BRACE { | LEFT_BRACE initializer_list COMMA RIGHT_BRACE {
const char* initFeature = "{ } style initializers"; const char* initFeature = "{ } style initializers";
parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
parseContext.profileRequires($1.loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, initFeature); parseContext.profileRequires($1.loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, initFeature);
$$ = $2; $$ = $2;
} }
; ;
......
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