зеркало из https://github.com/stride3d/xkslang.git
Merge pull request #2 from nwnk/glext-compatibility
Fix incompatibility with <GL/glext.h>
This commit is contained in:
Коммит
fd1e048b9c
|
@ -2856,7 +2856,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
||||||
BuiltInVariable("gl_TessCoord", EbvTessCoord, symbolTable);
|
BuiltInVariable("gl_TessCoord", EbvTessCoord, symbolTable);
|
||||||
|
|
||||||
if (version < 410)
|
if (version < 410)
|
||||||
symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &GL_ARB_viewport_array);
|
symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &_GL_ARB_viewport_array);
|
||||||
|
|
||||||
// Compatibility variables
|
// Compatibility variables
|
||||||
|
|
||||||
|
@ -2932,76 +2932,76 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
||||||
// built-in functions
|
// built-in functions
|
||||||
|
|
||||||
if (version == 100) {
|
if (version == 100) {
|
||||||
symbolTable.setFunctionExtensions("dFdx", 1, &GL_OES_standard_derivatives);
|
symbolTable.setFunctionExtensions("dFdx", 1, &_GL_OES_standard_derivatives);
|
||||||
symbolTable.setFunctionExtensions("dFdy", 1, &GL_OES_standard_derivatives);
|
symbolTable.setFunctionExtensions("dFdy", 1, &_GL_OES_standard_derivatives);
|
||||||
symbolTable.setFunctionExtensions("fwidth", 1, &GL_OES_standard_derivatives);
|
symbolTable.setFunctionExtensions("fwidth", 1, &_GL_OES_standard_derivatives);
|
||||||
}
|
}
|
||||||
if (profile == EEsProfile) {
|
if (profile == EEsProfile) {
|
||||||
symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &GL_EXT_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &_GL_EXT_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &GL_EXT_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &_GL_EXT_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &GL_EXT_shader_texture_lod);
|
symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &_GL_EXT_shader_texture_lod);
|
||||||
} else if (version < 130) {
|
} else if (version < 130) {
|
||||||
symbolTable.setFunctionExtensions("texture1DLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture1DLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture3DLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture3DLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("textureCubeLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("textureCubeLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture1DProjLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture1DProjLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DProjLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DProjLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture3DProjLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture3DProjLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow1DLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow1DLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow2DLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow2DLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &_GL_ARB_shader_texture_lod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GL_ARB_shader_texture_lod functions usable only with the extension enabled
|
// _GL_ARB_shader_texture_lod functions usable only with the extension enabled
|
||||||
if (profile != EEsProfile) {
|
if (profile != EEsProfile) {
|
||||||
symbolTable.setFunctionExtensions("texture1DGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture1DGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture1DProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture1DProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture3DGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture3DGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture3DProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture3DProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("textureCubeGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("textureCubeGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow1DGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow1DGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow1DProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow1DProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow2DGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow2DGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow2DProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow2DProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DRectGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DRectGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DRectProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DRectProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow2DRectGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow2DRectGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("shadow2DRectProjGradARB", 1, &GL_ARB_shader_texture_lod);
|
symbolTable.setFunctionExtensions("shadow2DRectProjGradARB", 1, &_GL_ARB_shader_texture_lod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile == EEsProfile) {
|
if (profile == EEsProfile) {
|
||||||
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &GL_EXT_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &_GL_EXT_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &GL_EXT_shader_texture_lod);
|
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &_GL_EXT_shader_texture_lod);
|
||||||
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &GL_EXT_shader_texture_lod);
|
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &_GL_EXT_shader_texture_lod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GL_ARB_shader_image_load_store
|
// _GL_ARB_shader_image_load_store
|
||||||
if (profile != EEsProfile && version < 420)
|
if (profile != EEsProfile && version < 420)
|
||||||
symbolTable.setFunctionExtensions("memoryBarrier", 1, &GL_ARB_shader_image_load_store);
|
symbolTable.setFunctionExtensions("memoryBarrier", 1, &_GL_ARB_shader_image_load_store);
|
||||||
// All the image access functions are protected by checks on the type of the first argument.
|
// All the image access functions are protected by checks on the type of the first argument.
|
||||||
|
|
||||||
// GL_ARB_shader_atomic_counters
|
// _GL_ARB_shader_atomic_counters
|
||||||
if (profile != EEsProfile && version < 420) {
|
if (profile != EEsProfile && version < 420) {
|
||||||
symbolTable.setFunctionExtensions("atomicCounterIncrement", 1, &GL_ARB_shader_atomic_counters);
|
symbolTable.setFunctionExtensions("atomicCounterIncrement", 1, &_GL_ARB_shader_atomic_counters);
|
||||||
symbolTable.setFunctionExtensions("atomicCounterDecrement", 1, &GL_ARB_shader_atomic_counters);
|
symbolTable.setFunctionExtensions("atomicCounterDecrement", 1, &_GL_ARB_shader_atomic_counters);
|
||||||
symbolTable.setFunctionExtensions("atomicCounter" , 1, &GL_ARB_shader_atomic_counters);
|
symbolTable.setFunctionExtensions("atomicCounter" , 1, &_GL_ARB_shader_atomic_counters);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GL_ARB_derivative_control
|
// _GL_ARB_derivative_control
|
||||||
if (profile != EEsProfile && version < 450) {
|
if (profile != EEsProfile && version < 450) {
|
||||||
symbolTable.setFunctionExtensions("dFdxFine", 1, &GL_ARB_derivative_control);
|
symbolTable.setFunctionExtensions("dFdxFine", 1, &_GL_ARB_derivative_control);
|
||||||
symbolTable.setFunctionExtensions("dFdyFine", 1, &GL_ARB_derivative_control);
|
symbolTable.setFunctionExtensions("dFdyFine", 1, &_GL_ARB_derivative_control);
|
||||||
symbolTable.setFunctionExtensions("fwidthFine", 1, &GL_ARB_derivative_control);
|
symbolTable.setFunctionExtensions("fwidthFine", 1, &_GL_ARB_derivative_control);
|
||||||
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &GL_ARB_derivative_control);
|
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &_GL_ARB_derivative_control);
|
||||||
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &GL_ARB_derivative_control);
|
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &_GL_ARB_derivative_control);
|
||||||
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &GL_ARB_derivative_control);
|
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &_GL_ARB_derivative_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &GL_EXT_frag_depth);
|
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &_GL_EXT_frag_depth);
|
||||||
symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);
|
symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);
|
||||||
symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader);
|
symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader);
|
||||||
break;
|
break;
|
||||||
|
@ -3233,15 +3233,15 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
||||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
|
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
|
||||||
{
|
{
|
||||||
if (profile != EEsProfile && version >= 430 && version < 440) {
|
if (profile != EEsProfile && version >= 430 && version < 440) {
|
||||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &GL_ARB_enhanced_layouts);
|
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &_GL_ARB_enhanced_layouts);
|
||||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &GL_ARB_enhanced_layouts);
|
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &_GL_ARB_enhanced_layouts);
|
||||||
}
|
}
|
||||||
if (profile != EEsProfile && version >= 130 && version < 420) {
|
if (profile != EEsProfile && version >= 130 && version < 420) {
|
||||||
symbolTable.setVariableExtensions("gl_MinProgramTexelOffset", 1, &GL_ARB_shading_language_420pack);
|
symbolTable.setVariableExtensions("gl_MinProgramTexelOffset", 1, &_GL_ARB_shading_language_420pack);
|
||||||
symbolTable.setVariableExtensions("gl_MaxProgramTexelOffset", 1, &GL_ARB_shading_language_420pack);
|
symbolTable.setVariableExtensions("gl_MaxProgramTexelOffset", 1, &_GL_ARB_shading_language_420pack);
|
||||||
}
|
}
|
||||||
if (profile != EEsProfile && version >= 150 && version < 410)
|
if (profile != EEsProfile && version >= 150 && version < 410)
|
||||||
symbolTable.setVariableExtensions("gl_MaxViewports", 1, &GL_ARB_viewport_array);
|
symbolTable.setVariableExtensions("gl_MaxViewports", 1, &_GL_ARB_viewport_array);
|
||||||
|
|
||||||
switch(language) {
|
switch(language) {
|
||||||
case EShLangFragment:
|
case EShLangFragment:
|
||||||
|
|
|
@ -730,12 +730,12 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
|
||||||
//
|
//
|
||||||
if (field == "length") {
|
if (field == "length") {
|
||||||
if (base->isArray()) {
|
if (base->isArray()) {
|
||||||
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, ".length");
|
profileRequires(loc, ENoProfile, 120, _GL_3DL_array_objects, ".length");
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, ".length");
|
profileRequires(loc, EEsProfile, 300, nullptr, ".length");
|
||||||
} else if (base->isVector() || base->isMatrix()) {
|
} else if (base->isVector() || base->isMatrix()) {
|
||||||
const char* feature = ".length() on vectors and matrices";
|
const char* feature = ".length() on vectors and matrices";
|
||||||
requireProfile(loc, ~EEsProfile, feature);
|
requireProfile(loc, ~EEsProfile, feature);
|
||||||
profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, feature);
|
profileRequires(loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, feature);
|
||||||
} else {
|
} else {
|
||||||
error(loc, "does not operate on this type:", field.c_str(), base->getType().getCompleteString().c_str());
|
error(loc, "does not operate on this type:", field.c_str(), base->getType().getCompleteString().c_str());
|
||||||
|
|
||||||
|
@ -761,7 +761,7 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped*
|
||||||
if (base->isScalar()) {
|
if (base->isScalar()) {
|
||||||
const char* dotFeature = "scalar swizzle";
|
const char* dotFeature = "scalar swizzle";
|
||||||
requireProfile(loc, ~EEsProfile, dotFeature);
|
requireProfile(loc, ~EEsProfile, dotFeature);
|
||||||
profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, dotFeature);
|
profileRequires(loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, dotFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
TVectorFields fields;
|
TVectorFields fields;
|
||||||
|
@ -1310,13 +1310,13 @@ void TParseContext::nonOpBuiltInCheck(TSourceLoc loc, const TFunction& fnCandida
|
||||||
if (fnCandidate.getName().compare("textureGatherOffset") == 0) {
|
if (fnCandidate.getName().compare("textureGatherOffset") == 0) {
|
||||||
// GL_ARB_texture_gather is good enough for 2D non-shadow textures with no component argument
|
// GL_ARB_texture_gather is good enough for 2D non-shadow textures with no component argument
|
||||||
if (fnCandidate[0].type->getSampler().dim == Esd2D && ! fnCandidate[0].type->getSampler().shadow && fnCandidate.getParamCount() == 3)
|
if (fnCandidate[0].type->getSampler().dim == Esd2D && ! fnCandidate[0].type->getSampler().shadow && fnCandidate.getParamCount() == 3)
|
||||||
profileRequires(loc, ~EEsProfile, 400, GL_ARB_texture_gather, feature);
|
profileRequires(loc, ~EEsProfile, 400, _GL_ARB_texture_gather, feature);
|
||||||
else
|
else
|
||||||
profileRequires(loc, ~EEsProfile, 400, GL_ARB_gpu_shader5, feature);
|
profileRequires(loc, ~EEsProfile, 400, _GL_ARB_gpu_shader5, feature);
|
||||||
if (! fnCandidate[0].type->getSampler().shadow)
|
if (! fnCandidate[0].type->getSampler().shadow)
|
||||||
compArg = 3;
|
compArg = 3;
|
||||||
} else if (fnCandidate.getName().compare("textureGatherOffsets") == 0) {
|
} else if (fnCandidate.getName().compare("textureGatherOffsets") == 0) {
|
||||||
profileRequires(loc, ~EEsProfile, 400, GL_ARB_gpu_shader5, feature);
|
profileRequires(loc, ~EEsProfile, 400, _GL_ARB_gpu_shader5, feature);
|
||||||
if (! fnCandidate[0].type->getSampler().shadow)
|
if (! fnCandidate[0].type->getSampler().shadow)
|
||||||
compArg = 3;
|
compArg = 3;
|
||||||
// check for constant offsets
|
// check for constant offsets
|
||||||
|
@ -1327,11 +1327,11 @@ void TParseContext::nonOpBuiltInCheck(TSourceLoc loc, const TFunction& fnCandida
|
||||||
// More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5,
|
// More than two arguments needs gpu_shader5, and rectangular or shadow needs gpu_shader5,
|
||||||
// otherwise, need GL_ARB_texture_gather.
|
// otherwise, need GL_ARB_texture_gather.
|
||||||
if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect || fnCandidate[0].type->getSampler().shadow) {
|
if (fnCandidate.getParamCount() > 2 || fnCandidate[0].type->getSampler().dim == EsdRect || fnCandidate[0].type->getSampler().shadow) {
|
||||||
profileRequires(loc, ~EEsProfile, 400, GL_ARB_gpu_shader5, feature);
|
profileRequires(loc, ~EEsProfile, 400, _GL_ARB_gpu_shader5, feature);
|
||||||
if (! fnCandidate[0].type->getSampler().shadow)
|
if (! fnCandidate[0].type->getSampler().shadow)
|
||||||
compArg = 2;
|
compArg = 2;
|
||||||
} else
|
} else
|
||||||
profileRequires(loc, ~EEsProfile, 400, GL_ARB_texture_gather, feature);
|
profileRequires(loc, ~EEsProfile, 400, _GL_ARB_texture_gather, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compArg > 0 && compArg < fnCandidate.getParamCount()) {
|
if (compArg > 0 && compArg < fnCandidate.getParamCount()) {
|
||||||
|
@ -1381,7 +1381,7 @@ void TParseContext::nonOpBuiltInCheck(TSourceLoc loc, const TFunction& fnCandida
|
||||||
|
|
||||||
// GL_ARB_shader_texture_image_samples
|
// GL_ARB_shader_texture_image_samples
|
||||||
if (fnCandidate.getName().compare(0, 14, "textureSamples") == 0 || fnCandidate.getName().compare(0, 12, "imageSamples") == 0)
|
if (fnCandidate.getName().compare(0, 14, "textureSamples") == 0 || fnCandidate.getName().compare(0, 12, "imageSamples") == 0)
|
||||||
profileRequires(loc, ~EEsProfile, 450, GL_ARB_shader_texture_image_samples, "textureSamples and imageSamples");
|
profileRequires(loc, ~EEsProfile, 450, _GL_ARB_shader_texture_image_samples, "textureSamples and imageSamples");
|
||||||
|
|
||||||
if (fnCandidate.getName().compare(0, 11, "imageAtomic") == 0) {
|
if (fnCandidate.getName().compare(0, 11, "imageAtomic") == 0) {
|
||||||
const TType& imageType = callNode.getSequence()[0]->getAsTyped()->getType();
|
const TType& imageType = callNode.getSequence()[0]->getAsTyped()->getType();
|
||||||
|
@ -1402,7 +1402,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, const TPublicTyp
|
||||||
type.getQualifier().precision = EpqNone;
|
type.getQualifier().precision = EpqNone;
|
||||||
|
|
||||||
if (type.isArray()) {
|
if (type.isArray()) {
|
||||||
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed constructor");
|
profileRequires(loc, ENoProfile, 120, _GL_3DL_array_objects, "arrayed constructor");
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, "arrayed constructor");
|
profileRequires(loc, EEsProfile, 300, nullptr, "arrayed constructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1841,7 +1841,7 @@ bool TParseContext::lineContinuationCheck(TSourceLoc loc, bool endOfComment)
|
||||||
const char* message = "line continuation";
|
const char* message = "line continuation";
|
||||||
|
|
||||||
bool lineContinuationAllowed = (profile == EEsProfile && version >= 300) ||
|
bool lineContinuationAllowed = (profile == EEsProfile && version >= 300) ||
|
||||||
(profile != EEsProfile && (version >= 420 || extensionsTurnedOn(1, &GL_ARB_shading_language_420pack)));
|
(profile != EEsProfile && (version >= 420 || extensionsTurnedOn(1, &_GL_ARB_shading_language_420pack)));
|
||||||
|
|
||||||
if (endOfComment) {
|
if (endOfComment) {
|
||||||
if (lineContinuationAllowed)
|
if (lineContinuationAllowed)
|
||||||
|
@ -1858,7 +1858,7 @@ bool TParseContext::lineContinuationCheck(TSourceLoc loc, bool endOfComment)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, message);
|
profileRequires(loc, EEsProfile, 300, nullptr, message);
|
||||||
profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, message);
|
profileRequires(loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return lineContinuationAllowed;
|
return lineContinuationAllowed;
|
||||||
|
@ -2228,7 +2228,7 @@ void TParseContext::mergeQualifiers(TSourceLoc loc, TQualifier& dst, const TQual
|
||||||
// Ordering
|
// Ordering
|
||||||
if (! force && ((profile != EEsProfile && version < 420) ||
|
if (! force && ((profile != EEsProfile && version < 420) ||
|
||||||
(profile == EEsProfile && version < 310))
|
(profile == EEsProfile && version < 310))
|
||||||
&& ! extensionsTurnedOn(1, &GL_ARB_shading_language_420pack)) {
|
&& ! extensionsTurnedOn(1, &_GL_ARB_shading_language_420pack)) {
|
||||||
// non-function parameters
|
// non-function parameters
|
||||||
if (src.invariant && (dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone))
|
if (src.invariant && (dst.isInterpolation() || dst.isAuxiliary() || dst.storage != EvqTemporary || dst.precision != EpqNone))
|
||||||
error(loc, "invariant qualifier must appear first", "", "");
|
error(loc, "invariant qualifier must appear first", "", "");
|
||||||
|
@ -2411,7 +2411,7 @@ void TParseContext::arraySizeCheck(TSourceLoc loc, TIntermTyped* expr, int& size
|
||||||
bool TParseContext::arrayQualifierError(TSourceLoc loc, const TQualifier& qualifier)
|
bool TParseContext::arrayQualifierError(TSourceLoc loc, const TQualifier& qualifier)
|
||||||
{
|
{
|
||||||
if (qualifier.storage == EvqConst) {
|
if (qualifier.storage == EvqConst) {
|
||||||
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "const array");
|
profileRequires(loc, ENoProfile, 120, _GL_3DL_array_objects, "const array");
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, "const array");
|
profileRequires(loc, EEsProfile, 300, nullptr, "const array");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2683,7 +2683,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(TSourceLoc loc, const TString&
|
||||||
|
|
||||||
// Special case when using GL_ARB_separate_shader_objects
|
// Special case when using GL_ARB_separate_shader_objects
|
||||||
bool ssoPre150 = false; // means the only reason this variable is redeclared is due to this combination
|
bool ssoPre150 = false; // means the only reason this variable is redeclared is due to this combination
|
||||||
if (profile != EEsProfile && version <= 140 && extensionsTurnedOn(1, &GL_ARB_separate_shader_objects)) {
|
if (profile != EEsProfile && version <= 140 && extensionsTurnedOn(1, &_GL_ARB_separate_shader_objects)) {
|
||||||
if (identifier == "gl_Position" ||
|
if (identifier == "gl_Position" ||
|
||||||
identifier == "gl_PointSize" ||
|
identifier == "gl_PointSize" ||
|
||||||
identifier == "gl_ClipVertex" ||
|
identifier == "gl_ClipVertex" ||
|
||||||
|
@ -2800,7 +2800,7 @@ void TParseContext::redeclareBuiltinBlock(TSourceLoc loc, TTypeList& newTypeList
|
||||||
{
|
{
|
||||||
const char* feature = "built-in block redeclaration";
|
const char* feature = "built-in block redeclaration";
|
||||||
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
|
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
|
||||||
profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
|
profileRequires(loc, ~EEsProfile, 410, _GL_ARB_separate_shader_objects, feature);
|
||||||
|
|
||||||
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") {
|
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") {
|
||||||
error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str());
|
error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str());
|
||||||
|
@ -2998,7 +2998,7 @@ void TParseContext::arrayObjectCheck(TSourceLoc loc, const TType& type, const ch
|
||||||
{
|
{
|
||||||
// Some versions don't allow comparing arrays or structures containing arrays
|
// Some versions don't allow comparing arrays or structures containing arrays
|
||||||
if (type.containsArray()) {
|
if (type.containsArray()) {
|
||||||
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, op);
|
profileRequires(loc, ENoProfile, 120, _GL_3DL_array_objects, op);
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, op);
|
profileRequires(loc, EEsProfile, 300, nullptr, op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3194,11 +3194,11 @@ void TParseContext::finalErrorCheck()
|
||||||
if (profile == EEsProfile && version == 310)
|
if (profile == EEsProfile && version == 310)
|
||||||
requireExtensions(getCurrentLoc(), Num_AEP_tessellation_shader, AEP_tessellation_shader, "tessellation shaders");
|
requireExtensions(getCurrentLoc(), Num_AEP_tessellation_shader, AEP_tessellation_shader, "tessellation shaders");
|
||||||
else if (profile != EEsProfile && version < 400)
|
else if (profile != EEsProfile && version < 400)
|
||||||
requireExtensions(getCurrentLoc(), 1, &GL_ARB_tessellation_shader, "tessellation shaders");
|
requireExtensions(getCurrentLoc(), 1, &_GL_ARB_tessellation_shader, "tessellation shaders");
|
||||||
break;
|
break;
|
||||||
case EShLangCompute:
|
case EShLangCompute:
|
||||||
if (profile != EEsProfile && version < 430)
|
if (profile != EEsProfile && version < 430)
|
||||||
requireExtensions(getCurrentLoc(), 1, &GL_ARB_compute_shader, "tessellation shaders");
|
requireExtensions(getCurrentLoc(), 1, &_GL_ARB_compute_shader, "tessellation shaders");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -3248,8 +3248,8 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
(format > ElfEsIntGuard && format < ElfIntGuard) ||
|
(format > ElfEsIntGuard && format < ElfIntGuard) ||
|
||||||
(format > ElfEsUintGuard && format < ElfCount))
|
(format > ElfEsUintGuard && format < ElfCount))
|
||||||
requireProfile(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, "image load-store format");
|
requireProfile(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, "image load-store format");
|
||||||
profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, GL_ARB_shader_image_load_store, "image load store");
|
profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, _GL_ARB_shader_image_load_store, "image load store");
|
||||||
profileRequires(loc, EEsProfile, 310, GL_ARB_shader_image_load_store, "image load store");
|
profileRequires(loc, EEsProfile, 310, _GL_ARB_shader_image_load_store, "image load store");
|
||||||
publicType.qualifier.layoutFormat = format;
|
publicType.qualifier.layoutFormat = format;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3344,7 +3344,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (id == "early_fragment_tests") {
|
if (id == "early_fragment_tests") {
|
||||||
profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, GL_ARB_shader_image_load_store, "early_fragment_tests");
|
profileRequires(loc, ENoProfile | ECoreProfile | ECompatibilityProfile, 420, _GL_ARB_shader_image_load_store, "early_fragment_tests");
|
||||||
profileRequires(loc, EEsProfile, 310, nullptr, "early_fragment_tests");
|
profileRequires(loc, EEsProfile, 310, nullptr, "early_fragment_tests");
|
||||||
publicType.shaderQualifiers.earlyFragmentTests = true;
|
publicType.shaderQualifiers.earlyFragmentTests = true;
|
||||||
return;
|
return;
|
||||||
|
@ -3375,7 +3375,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
value = constUnion->getConstArray()[0].getIConst();
|
value = constUnion->getConstArray()[0].getIConst();
|
||||||
if (! constUnion->isLiteral()) {
|
if (! constUnion->isLiteral()) {
|
||||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, nonLiteralFeature);
|
requireProfile(loc, ECoreProfile | ECompatibilityProfile, nonLiteralFeature);
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, nonLiteralFeature);
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, _GL_ARB_enhanced_layouts, nonLiteralFeature);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// grammar should have give out the error message
|
// grammar should have give out the error message
|
||||||
|
@ -3392,7 +3392,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
if (id == "offset") {
|
if (id == "offset") {
|
||||||
const char* feature = "uniform offset";
|
const char* feature = "uniform offset";
|
||||||
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
|
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature);
|
||||||
const char* exts[2] = { GL_ARB_enhanced_layouts, GL_ARB_shader_atomic_counters };
|
const char* exts[2] = { _GL_ARB_enhanced_layouts, _GL_ARB_shader_atomic_counters };
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature);
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature);
|
||||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||||
publicType.qualifier.layoutOffset = value;
|
publicType.qualifier.layoutOffset = value;
|
||||||
|
@ -3400,7 +3400,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
} else if (id == "align") {
|
} else if (id == "align") {
|
||||||
const char* feature = "uniform buffer-member align";
|
const char* feature = "uniform buffer-member align";
|
||||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature);
|
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature);
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, feature);
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, _GL_ARB_enhanced_layouts, feature);
|
||||||
// "The specified alignment must be a power of 2, or a compile-time error results."
|
// "The specified alignment must be a power of 2, or a compile-time error results."
|
||||||
if (! IsPow2(value))
|
if (! IsPow2(value))
|
||||||
error(loc, "must be a power of 2", "align", "");
|
error(loc, "must be a power of 2", "align", "");
|
||||||
|
@ -3409,7 +3409,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
return;
|
return;
|
||||||
} else if (id == "location") {
|
} else if (id == "location") {
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, "location");
|
profileRequires(loc, EEsProfile, 300, nullptr, "location");
|
||||||
const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
|
const char* exts[2] = { _GL_ARB_separate_shader_objects, _GL_ARB_explicit_attrib_location };
|
||||||
profileRequires(loc, ~EEsProfile, 330, 2, exts, "location");
|
profileRequires(loc, ~EEsProfile, 330, 2, exts, "location");
|
||||||
if ((unsigned int)value >= TQualifier::layoutLocationEnd)
|
if ((unsigned int)value >= TQualifier::layoutLocationEnd)
|
||||||
error(loc, "location is too large", id.c_str(), "");
|
error(loc, "location is too large", id.c_str(), "");
|
||||||
|
@ -3423,7 +3423,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
publicType.qualifier.layoutSet = value;
|
publicType.qualifier.layoutSet = value;
|
||||||
return;
|
return;
|
||||||
} else if (id == "binding") {
|
} else if (id == "binding") {
|
||||||
profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, "binding");
|
profileRequires(loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, "binding");
|
||||||
profileRequires(loc, EEsProfile, 310, nullptr, "binding");
|
profileRequires(loc, EEsProfile, 310, nullptr, "binding");
|
||||||
if ((unsigned int)value >= TQualifier::layoutBindingEnd)
|
if ((unsigned int)value >= TQualifier::layoutBindingEnd)
|
||||||
error(loc, "binding is too large", id.c_str(), "");
|
error(loc, "binding is too large", id.c_str(), "");
|
||||||
|
@ -3432,7 +3432,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
return;
|
return;
|
||||||
} else if (id == "component") {
|
} else if (id == "component") {
|
||||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "component");
|
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "component");
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, "component");
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, _GL_ARB_enhanced_layouts, "component");
|
||||||
if ((unsigned)value >= TQualifier::layoutComponentEnd)
|
if ((unsigned)value >= TQualifier::layoutComponentEnd)
|
||||||
error(loc, "component is too large", id.c_str(), "");
|
error(loc, "component is too large", id.c_str(), "");
|
||||||
else
|
else
|
||||||
|
@ -3447,7 +3447,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
const char* feature = "transform feedback qualifier";
|
const char* feature = "transform feedback qualifier";
|
||||||
requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), feature);
|
requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), feature);
|
||||||
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature);
|
requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature);
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, feature);
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, _GL_ARB_enhanced_layouts, feature);
|
||||||
if (id == "xfb_buffer") {
|
if (id == "xfb_buffer") {
|
||||||
// "It is a compile-time error to specify an *xfb_buffer* that is greater than
|
// "It is a compile-time error to specify an *xfb_buffer* that is greater than
|
||||||
// the implementation-dependent constant gl_MaxTransformFeedbackBuffers."
|
// the implementation-dependent constant gl_MaxTransformFeedbackBuffers."
|
||||||
|
@ -3513,7 +3513,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||||
case EShLangFragment:
|
case EShLangFragment:
|
||||||
if (id == "index") {
|
if (id == "index") {
|
||||||
requireProfile(loc, ECompatibilityProfile | ECoreProfile, "index layout qualifier on fragment output");
|
requireProfile(loc, ECompatibilityProfile | ECoreProfile, "index layout qualifier on fragment output");
|
||||||
const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
|
const char* exts[2] = { _GL_ARB_separate_shader_objects, _GL_ARB_explicit_attrib_location };
|
||||||
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 330, 2, exts, "index layout qualifier on fragment output");
|
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 330, 2, exts, "index layout qualifier on fragment output");
|
||||||
publicType.qualifier.layoutIndex = value;
|
publicType.qualifier.layoutIndex = value;
|
||||||
return;
|
return;
|
||||||
|
@ -3678,7 +3678,7 @@ void TParseContext::layoutTypeCheck(TSourceLoc loc, const TType& type)
|
||||||
case EvqVaryingIn:
|
case EvqVaryingIn:
|
||||||
case EvqVaryingOut:
|
case EvqVaryingOut:
|
||||||
if (type.getBasicType() == EbtBlock)
|
if (type.getBasicType() == EbtBlock)
|
||||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, "location qualifier on in/out block");
|
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, _GL_ARB_enhanced_layouts, "location qualifier on in/out block");
|
||||||
break;
|
break;
|
||||||
case EvqUniform:
|
case EvqUniform:
|
||||||
case EvqBuffer:
|
case EvqBuffer:
|
||||||
|
@ -3806,11 +3806,11 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
|
||||||
else
|
else
|
||||||
requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature);
|
requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature);
|
||||||
if (language == EShLangVertex) {
|
if (language == EShLangVertex) {
|
||||||
const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
|
const char* exts[2] = { _GL_ARB_separate_shader_objects, _GL_ARB_explicit_attrib_location };
|
||||||
profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
|
profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
||||||
} else {
|
} else {
|
||||||
profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
|
profileRequires(loc, ~EEsProfile, 410, _GL_ARB_separate_shader_objects, feature);
|
||||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3823,11 +3823,11 @@ void TParseContext::layoutQualifierCheck(TSourceLoc loc, const TQualifier& quali
|
||||||
else
|
else
|
||||||
requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature);
|
requireStage(loc, (EShLanguageMask)~EShLangComputeMask, feature);
|
||||||
if (language == EShLangFragment) {
|
if (language == EShLangFragment) {
|
||||||
const char* exts[2] = { GL_ARB_separate_shader_objects, GL_ARB_explicit_attrib_location };
|
const char* exts[2] = { _GL_ARB_separate_shader_objects, _GL_ARB_explicit_attrib_location };
|
||||||
profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
|
profileRequires(loc, ~EEsProfile, 330, 2, exts, feature);
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
||||||
} else {
|
} else {
|
||||||
profileRequires(loc, ~EEsProfile, 410, GL_ARB_separate_shader_objects, feature);
|
profileRequires(loc, ~EEsProfile, 410, _GL_ARB_separate_shader_objects, feature);
|
||||||
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
profileRequires(loc, EEsProfile, 310, nullptr, feature);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4107,7 +4107,7 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
|
||||||
declareArray(loc, identifier, type, symbol, newDeclaration);
|
declareArray(loc, identifier, type, symbol, newDeclaration);
|
||||||
|
|
||||||
if (initializer) {
|
if (initializer) {
|
||||||
profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "initializer");
|
profileRequires(loc, ENoProfile, 120, _GL_3DL_array_objects, "initializer");
|
||||||
profileRequires(loc, EEsProfile, 300, nullptr, "initializer");
|
profileRequires(loc, EEsProfile, 300, nullptr, "initializer");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -4246,7 +4246,7 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TIntermTyped* ini
|
||||||
if (initializer->getType().getQualifier().storage != EvqConst) {
|
if (initializer->getType().getQualifier().storage != EvqConst) {
|
||||||
const char* initFeature = "non-constant initializer";
|
const char* initFeature = "non-constant initializer";
|
||||||
requireProfile(loc, ~EEsProfile, initFeature);
|
requireProfile(loc, ~EEsProfile, initFeature);
|
||||||
profileRequires(loc, ~EEsProfile, 420, GL_ARB_shading_language_420pack, initFeature);
|
profileRequires(loc, ~EEsProfile, 420, _GL_ARB_shading_language_420pack, initFeature);
|
||||||
variable->getWritableType().getQualifier().storage = EvqConstReadOnly;
|
variable->getWritableType().getQualifier().storage = EvqConstReadOnly;
|
||||||
qualifier = EvqConstReadOnly;
|
qualifier = EvqConstReadOnly;
|
||||||
}
|
}
|
||||||
|
@ -4580,7 +4580,7 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
|
||||||
requireProfile(memberLoc, ~EEsProfile, "implicitly-sized array in a block");
|
requireProfile(memberLoc, ~EEsProfile, "implicitly-sized array in a block");
|
||||||
if (memberQualifier.hasOffset()) {
|
if (memberQualifier.hasOffset()) {
|
||||||
requireProfile(memberLoc, ~EEsProfile, "offset on block member");
|
requireProfile(memberLoc, ~EEsProfile, "offset on block member");
|
||||||
profileRequires(memberLoc, ~EEsProfile, 440, GL_ARB_enhanced_layouts, "offset on block member");
|
profileRequires(memberLoc, ~EEsProfile, 440, _GL_ARB_enhanced_layouts, "offset on block member");
|
||||||
}
|
}
|
||||||
|
|
||||||
TBasicType basicType = memberType.getBasicType();
|
TBasicType basicType = memberType.getBasicType();
|
||||||
|
@ -4653,7 +4653,7 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
|
||||||
case EvqVaryingIn:
|
case EvqVaryingIn:
|
||||||
case EvqVaryingOut:
|
case EvqVaryingOut:
|
||||||
requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature);
|
requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature);
|
||||||
profileRequires(memberLoc, ECoreProfile | ECompatibilityProfile, 440, GL_ARB_enhanced_layouts, feature);
|
profileRequires(memberLoc, ECoreProfile | ECompatibilityProfile, 440, _GL_ARB_enhanced_layouts, feature);
|
||||||
profileRequires(memberLoc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
|
profileRequires(memberLoc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
|
||||||
memberWithLocation = true;
|
memberWithLocation = true;
|
||||||
break;
|
break;
|
||||||
|
@ -4767,7 +4767,7 @@ void TParseContext::blockStageIoCheck(TSourceLoc loc, const TQualifier& qualifie
|
||||||
profileRequires(loc, EEsProfile, 310, nullptr, "buffer block");
|
profileRequires(loc, EEsProfile, 310, nullptr, "buffer block");
|
||||||
break;
|
break;
|
||||||
case EvqVaryingIn:
|
case EvqVaryingIn:
|
||||||
profileRequires(loc, ~EEsProfile, 150, GL_ARB_separate_shader_objects, "input block");
|
profileRequires(loc, ~EEsProfile, 150, _GL_ARB_separate_shader_objects, "input block");
|
||||||
// It is a compile-time error to have an input block in a vertex shader or an output block in a fragment shader
|
// It is a compile-time error to have an input block in a vertex shader or an output block in a fragment shader
|
||||||
// "Compute shaders do not permit user-defined input variables..."
|
// "Compute shaders do not permit user-defined input variables..."
|
||||||
requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block");
|
requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block");
|
||||||
|
@ -4775,7 +4775,7 @@ void TParseContext::blockStageIoCheck(TSourceLoc loc, const TQualifier& qualifie
|
||||||
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block");
|
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block");
|
||||||
break;
|
break;
|
||||||
case EvqVaryingOut:
|
case EvqVaryingOut:
|
||||||
profileRequires(loc, ~EEsProfile, 150, GL_ARB_separate_shader_objects, "output block");
|
profileRequires(loc, ~EEsProfile, 150, _GL_ARB_separate_shader_objects, "output block");
|
||||||
requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block");
|
requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block");
|
||||||
// ES 310 can have a block before shader_io is turned on, so skip this test for built-ins
|
// ES 310 can have a block before shader_io is turned on, so skip this test for built-ins
|
||||||
if (language == EShLangVertex && ! parsingBuiltins)
|
if (language == EShLangVertex && ! parsingBuiltins)
|
||||||
|
|
|
@ -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()
|
||||||
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()
|
||||||
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()
|
||||||
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()
|
||||||
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()
|
||||||
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()
|
||||||
|
|
||||||
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)
|
||||||
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()
|
||||||
|
|
||||||
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 {
|
||||||
//
|
//
|
||||||
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,
|
||||||
|
|
|
@ -87,86 +87,86 @@ typedef enum {
|
||||||
// Symbolic names for extensions. Strings may be directly used when calling the
|
// Symbolic names for extensions. Strings may be directly used when calling the
|
||||||
// functions, but better to have the compiler do spelling checks.
|
// functions, but better to have the compiler do spelling checks.
|
||||||
//
|
//
|
||||||
const char* const GL_OES_texture_3D = "GL_OES_texture_3D";
|
const char* const _GL_OES_texture_3D = "GL_OES_texture_3D";
|
||||||
const char* const GL_OES_standard_derivatives = "GL_OES_standard_derivatives";
|
const char* const _GL_OES_standard_derivatives = "GL_OES_standard_derivatives";
|
||||||
const char* const GL_EXT_frag_depth = "GL_EXT_frag_depth";
|
const char* const _GL_EXT_frag_depth = "GL_EXT_frag_depth";
|
||||||
const char* const GL_OES_EGL_image_external = "GL_OES_EGL_image_external";
|
const char* const _GL_OES_EGL_image_external = "GL_OES_EGL_image_external";
|
||||||
const char* const GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod";
|
const char* const _GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod";
|
||||||
|
|
||||||
const char* const GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
|
const char* const _GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
|
||||||
const char* const GL_3DL_array_objects = "GL_3DL_array_objects";
|
const char* const _GL_3DL_array_objects = "GL_3DL_array_objects";
|
||||||
const char* const GL_ARB_shading_language_420pack = "GL_ARB_shading_language_420pack";
|
const char* const _GL_ARB_shading_language_420pack = "GL_ARB_shading_language_420pack";
|
||||||
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_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";
|
||||||
const char* const GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
|
const char* const _GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
|
||||||
const char* const GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
|
const char* const _GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
|
||||||
const char* const GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store";
|
const char* const _GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store";
|
||||||
const char* const GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters";
|
const char* const _GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters";
|
||||||
const char* const GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
const char* const _GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
||||||
const char* const GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples";
|
const char* const _GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples";
|
||||||
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
|
// AEP
|
||||||
const char* const GL_ANDROID_extension_pack_es31a = "GL_ANDROID_extension_pack_es31a";
|
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_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_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_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_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_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_shader = "GL_EXT_geometry_shader";
|
||||||
const char* const GL_EXT_geometry_point_size = "GL_EXT_geometry_point_size";
|
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_gpu_shader5 = "GL_EXT_gpu_shader5";
|
||||||
const char* const GL_EXT_primitive_bounding_box = "GL_EXT_primitive_bounding_box";
|
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_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_shader = "GL_EXT_tessellation_shader";
|
||||||
const char* const GL_EXT_tessellation_point_size = "GL_EXT_tessellation_point_size";
|
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_buffer = "GL_EXT_texture_buffer";
|
||||||
const char* const GL_EXT_texture_cube_map_array = "GL_EXT_texture_cube_map_array";
|
const char* const _GL_EXT_texture_cube_map_array = "GL_EXT_texture_cube_map_array";
|
||||||
|
|
||||||
// OES matching AEP
|
// OES matching AEP
|
||||||
const char* const GL_OES_geometry_shader = "GL_OES_geometry_shader";
|
const char* const _GL_OES_geometry_shader = "GL_OES_geometry_shader";
|
||||||
const char* const GL_OES_geometry_point_size = "GL_OES_geometry_point_size";
|
const char* const _GL_OES_geometry_point_size = "GL_OES_geometry_point_size";
|
||||||
const char* const GL_OES_gpu_shader5 = "GL_OES_gpu_shader5";
|
const char* const _GL_OES_gpu_shader5 = "GL_OES_gpu_shader5";
|
||||||
const char* const GL_OES_primitive_bounding_box = "GL_OES_primitive_bounding_box";
|
const char* const _GL_OES_primitive_bounding_box = "GL_OES_primitive_bounding_box";
|
||||||
const char* const GL_OES_shader_io_blocks = "GL_OES_shader_io_blocks";
|
const char* const _GL_OES_shader_io_blocks = "GL_OES_shader_io_blocks";
|
||||||
const char* const GL_OES_tessellation_shader = "GL_OES_tessellation_shader";
|
const char* const _GL_OES_tessellation_shader = "GL_OES_tessellation_shader";
|
||||||
const char* const GL_OES_tessellation_point_size = "GL_OES_tessellation_point_size";
|
const char* const _GL_OES_tessellation_point_size = "GL_OES_tessellation_point_size";
|
||||||
const char* const GL_OES_texture_buffer = "GL_OES_texture_buffer";
|
const char* const _GL_OES_texture_buffer = "GL_OES_texture_buffer";
|
||||||
const char* const GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array";
|
const char* const _GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array";
|
||||||
|
|
||||||
// Arrays of extensions for the above AEP duplications
|
// Arrays of extensions for the above AEP duplications
|
||||||
|
|
||||||
const char* const AEP_geometry_shader[] = { GL_EXT_geometry_shader, GL_OES_geometry_shader };
|
const char* const AEP_geometry_shader[] = { _GL_EXT_geometry_shader, _GL_OES_geometry_shader };
|
||||||
const int Num_AEP_geometry_shader = sizeof(AEP_geometry_shader)/sizeof(AEP_geometry_shader[0]);
|
const int Num_AEP_geometry_shader = sizeof(AEP_geometry_shader)/sizeof(AEP_geometry_shader[0]);
|
||||||
|
|
||||||
const char* const AEP_geometry_point_size[] = { GL_EXT_geometry_point_size, GL_OES_geometry_point_size };
|
const char* const AEP_geometry_point_size[] = { _GL_EXT_geometry_point_size, _GL_OES_geometry_point_size };
|
||||||
const int Num_AEP_geometry_point_size = sizeof(AEP_geometry_point_size)/sizeof(AEP_geometry_point_size[0]);
|
const int Num_AEP_geometry_point_size = sizeof(AEP_geometry_point_size)/sizeof(AEP_geometry_point_size[0]);
|
||||||
|
|
||||||
const char* const AEP_gpu_shader5[] = { GL_EXT_gpu_shader5, GL_OES_gpu_shader5 };
|
const char* const AEP_gpu_shader5[] = { _GL_EXT_gpu_shader5, _GL_OES_gpu_shader5 };
|
||||||
const int Num_AEP_gpu_shader5 = sizeof(AEP_gpu_shader5)/sizeof(AEP_gpu_shader5[0]);
|
const int Num_AEP_gpu_shader5 = sizeof(AEP_gpu_shader5)/sizeof(AEP_gpu_shader5[0]);
|
||||||
|
|
||||||
const char* const AEP_primitive_bounding_box[] = { GL_EXT_primitive_bounding_box, GL_OES_primitive_bounding_box };
|
const char* const AEP_primitive_bounding_box[] = { _GL_EXT_primitive_bounding_box, _GL_OES_primitive_bounding_box };
|
||||||
const int Num_AEP_primitive_bounding_box = sizeof(AEP_primitive_bounding_box)/sizeof(AEP_primitive_bounding_box[0]);
|
const int Num_AEP_primitive_bounding_box = sizeof(AEP_primitive_bounding_box)/sizeof(AEP_primitive_bounding_box[0]);
|
||||||
|
|
||||||
const char* const AEP_shader_io_blocks[] = { GL_EXT_shader_io_blocks, GL_OES_shader_io_blocks };
|
const char* const AEP_shader_io_blocks[] = { _GL_EXT_shader_io_blocks, _GL_OES_shader_io_blocks };
|
||||||
const int Num_AEP_shader_io_blocks = sizeof(AEP_shader_io_blocks)/sizeof(AEP_shader_io_blocks[0]);
|
const int Num_AEP_shader_io_blocks = sizeof(AEP_shader_io_blocks)/sizeof(AEP_shader_io_blocks[0]);
|
||||||
|
|
||||||
const char* const AEP_tessellation_shader[] = { GL_EXT_tessellation_shader, GL_OES_tessellation_shader };
|
const char* const AEP_tessellation_shader[] = { _GL_EXT_tessellation_shader, _GL_OES_tessellation_shader };
|
||||||
const int Num_AEP_tessellation_shader = sizeof(AEP_tessellation_shader)/sizeof(AEP_tessellation_shader[0]);
|
const int Num_AEP_tessellation_shader = sizeof(AEP_tessellation_shader)/sizeof(AEP_tessellation_shader[0]);
|
||||||
|
|
||||||
const char* const AEP_tessellation_point_size[] = { GL_EXT_tessellation_point_size, GL_OES_tessellation_point_size };
|
const char* const AEP_tessellation_point_size[] = { _GL_EXT_tessellation_point_size, _GL_OES_tessellation_point_size };
|
||||||
const int Num_AEP_tessellation_point_size = sizeof(AEP_tessellation_point_size)/sizeof(AEP_tessellation_point_size[0]);
|
const int Num_AEP_tessellation_point_size = sizeof(AEP_tessellation_point_size)/sizeof(AEP_tessellation_point_size[0]);
|
||||||
|
|
||||||
const char* const AEP_texture_buffer[] = { GL_EXT_texture_buffer, GL_OES_texture_buffer };
|
const char* const AEP_texture_buffer[] = { _GL_EXT_texture_buffer, _GL_OES_texture_buffer };
|
||||||
const int Num_AEP_texture_buffer = sizeof(AEP_texture_buffer)/sizeof(AEP_texture_buffer[0]);
|
const int Num_AEP_texture_buffer = sizeof(AEP_texture_buffer)/sizeof(AEP_texture_buffer[0]);
|
||||||
|
|
||||||
const char* const AEP_texture_cube_map_array[] = { GL_EXT_texture_cube_map_array, GL_OES_texture_cube_map_array };
|
const char* const AEP_texture_cube_map_array[] = { _GL_EXT_texture_cube_map_array, _GL_OES_texture_cube_map_array };
|
||||||
const int Num_AEP_texture_cube_map_array = sizeof(AEP_texture_cube_map_array)/sizeof(AEP_texture_cube_map_array[0]);
|
const int Num_AEP_texture_cube_map_array = sizeof(AEP_texture_cube_map_array)/sizeof(AEP_texture_cube_map_array[0]);
|
||||||
|
|
||||||
} // end namespace glslang
|
} // end namespace glslang
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
| 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
|
||||||
|
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
| 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
|
||||||
| 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;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче