glslang AEP: Full semantics for *_shader_io_blocks.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31490 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
f6deb6203a
commit
9e41f362a6
9 changed files with 323 additions and 24 deletions
|
|
@ -1464,10 +1464,19 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
stageBuiltins[EShLangVertex].append(
|
||||
"highp int gl_VertexID;" // needs qualifier fixed later
|
||||
"highp int gl_InstanceID;" // needs qualifier fixed later
|
||||
|
||||
"highp vec4 gl_Position;" // needs qualifier fixed later
|
||||
"highp float gl_PointSize;" // needs qualifier fixed later
|
||||
);
|
||||
if (version < 310)
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"highp vec4 gl_Position;" // needs qualifier fixed later
|
||||
"highp float gl_PointSize;" // needs qualifier fixed later
|
||||
);
|
||||
else
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"out gl_PerVertex {"
|
||||
"highp vec4 gl_Position;" // needs qualifier fixed later
|
||||
"highp float gl_PointSize;" // needs qualifier fixed later
|
||||
"};"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1653,8 +1653,13 @@ bool TParseContext::lValueErrorCheck(TSourceLoc loc, const char* op, TIntermType
|
|||
if (node->getQualifier().readonly)
|
||||
message = "can't modify a readonly buffer";
|
||||
break;
|
||||
default:
|
||||
case EvqFragDepth:
|
||||
// "In addition, it is an error to statically write to gl_FragDepth in the fragment shader."
|
||||
if (profile == EEsProfile && intermediate.getEarlyFragmentTests())
|
||||
message = "can't modify gl_FragDepth if using early_fragment_tests";
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Type that can't be written to?
|
||||
//
|
||||
|
|
@ -2632,7 +2637,12 @@ void TParseContext::nonInitConstCheck(TSourceLoc loc, TString& identifier, TType
|
|||
//
|
||||
TSymbol* TParseContext::redeclareBuiltinVariable(TSourceLoc loc, const TString& identifier, const TQualifier& qualifier, const TShaderQualifiers& publicType, bool& newDeclaration)
|
||||
{
|
||||
if (profile == EEsProfile || ! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel())
|
||||
if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel())
|
||||
return 0;
|
||||
|
||||
bool nonEsRedecls = (profile != EEsProfile && (version >= 130 || identifier == "gl_TexCoord"));
|
||||
bool esRedecls = (profile == EEsProfile && extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks));
|
||||
if (! esRedecls && ! nonEsRedecls)
|
||||
return 0;
|
||||
|
||||
// Special case when using GL_ARB_separate_shader_objects
|
||||
|
|
@ -2648,15 +2658,15 @@ TSymbol* TParseContext::redeclareBuiltinVariable(TSourceLoc loc, const TString&
|
|||
// Potentially redeclaring a built-in variable...
|
||||
|
||||
if (ssoPre150 ||
|
||||
(identifier == "gl_FragDepth" && version >= 420) ||
|
||||
(identifier == "gl_FragCoord" && version >= 150) ||
|
||||
(identifier == "gl_ClipDistance" && version >= 130) ||
|
||||
(identifier == "gl_FrontColor" && version >= 130) ||
|
||||
(identifier == "gl_BackColor" && version >= 130) ||
|
||||
(identifier == "gl_FrontSecondaryColor" && version >= 130) ||
|
||||
(identifier == "gl_BackSecondaryColor" && version >= 130) ||
|
||||
(identifier == "gl_SecondaryColor" && version >= 130) ||
|
||||
(identifier == "gl_Color" && version >= 130 && language == EShLangFragment) ||
|
||||
(identifier == "gl_FragDepth" && ((nonEsRedecls && version >= 420) || esRedecls)) ||
|
||||
(identifier == "gl_FragCoord" && ((nonEsRedecls && version >= 150) || esRedecls)) ||
|
||||
identifier == "gl_ClipDistance" ||
|
||||
identifier == "gl_FrontColor" ||
|
||||
identifier == "gl_BackColor" ||
|
||||
identifier == "gl_FrontSecondaryColor" ||
|
||||
identifier == "gl_BackSecondaryColor" ||
|
||||
identifier == "gl_SecondaryColor" ||
|
||||
(identifier == "gl_Color" && language == EShLangFragment) ||
|
||||
identifier == "gl_TexCoord") {
|
||||
|
||||
// Find the existing symbol, if any.
|
||||
|
|
@ -2715,7 +2725,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(TSourceLoc loc, const TString&
|
|||
if (qualifier.nopersp != symbolQualifier.nopersp || qualifier.flat != symbolQualifier.flat ||
|
||||
qualifier.isMemory() || qualifier.isAuxiliary())
|
||||
error(loc, "can only change layout qualification of", "redeclaration", symbol->getName().c_str());
|
||||
if (identifier == "gl_FragCoord" && qualifier.storage != EvqVaryingIn)
|
||||
if (qualifier.storage != EvqVaryingIn)
|
||||
error(loc, "cannot change input storage qualification of", "redeclaration", symbol->getName().c_str());
|
||||
if (! builtIn && (publicType.pixelCenterInteger != intermediate.getPixelCenterInteger() ||
|
||||
publicType.originUpperLeft != intermediate.getOriginUpperLeft()))
|
||||
|
|
@ -2753,7 +2763,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(TSourceLoc loc, const TString&
|
|||
void TParseContext::redeclareBuiltinBlock(TSourceLoc loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes)
|
||||
{
|
||||
const char* feature = "built-in block redeclaration";
|
||||
requireProfile(loc, ~EEsProfile, 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);
|
||||
|
||||
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") {
|
||||
|
|
@ -4603,8 +4613,9 @@ void TParseContext::declareBlock(TSourceLoc loc, TTypeList& typeList, const TStr
|
|||
switch (currentBlockQualifier.storage) {
|
||||
case EvqVaryingIn:
|
||||
case EvqVaryingOut:
|
||||
requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile, feature);
|
||||
requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, 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);
|
||||
memberWithLocation = true;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -4752,7 +4763,9 @@ void TParseContext::blockStageIoCheck(TSourceLoc loc, TStorageQualifier storageQ
|
|||
profileRequires(loc, ~EEsProfile, 150, GL_ARB_separate_shader_objects, "output block");
|
||||
switch (language) {
|
||||
case EShLangVertex:
|
||||
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block");
|
||||
// ES 310 can have a block before shader_io is turned on, so skip this test for built-ins
|
||||
if (! parsingBuiltins)
|
||||
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block");
|
||||
if (profile == EEsProfile && arraySizes)
|
||||
arraySizeRequiredCheck(loc, arraySizes->getSize());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ void TParseContext::initializeExtensionBehavior()
|
|||
extensionBehavior[GL_EXT_geometry_point_size] = EBhDisablePartial;
|
||||
extensionBehavior[GL_EXT_gpu_shader5] = EBhDisablePartial;
|
||||
extensionBehavior[GL_EXT_primitive_bounding_box] = EBhDisablePartial;
|
||||
extensionBehavior[GL_EXT_shader_io_blocks] = EBhDisablePartial;
|
||||
extensionBehavior[GL_EXT_shader_io_blocks] = EBhDisable;
|
||||
extensionBehavior[GL_EXT_tessellation_shader] = EBhDisablePartial;
|
||||
extensionBehavior[GL_EXT_tessellation_point_size] = EBhDisablePartial;
|
||||
extensionBehavior[GL_EXT_texture_buffer] = EBhDisablePartial;
|
||||
|
|
@ -195,7 +195,7 @@ void TParseContext::initializeExtensionBehavior()
|
|||
extensionBehavior[GL_OES_geometry_shader] = EBhDisablePartial;
|
||||
extensionBehavior[GL_OES_gpu_shader5] = EBhDisablePartial;
|
||||
extensionBehavior[GL_OES_primitive_bounding_box] = EBhDisablePartial;
|
||||
extensionBehavior[GL_OES_shader_io_blocks] = EBhDisablePartial;
|
||||
extensionBehavior[GL_OES_shader_io_blocks] = EBhDisable;
|
||||
extensionBehavior[GL_OES_tessellation_shader] = EBhDisablePartial;
|
||||
extensionBehavior[GL_OES_texture_buffer] = EBhDisablePartial;
|
||||
extensionBehavior[GL_OES_texture_cube_map_array] = EBhDisablePartial;
|
||||
|
|
|
|||
|
|
@ -715,7 +715,9 @@ int TIntermediate::computeTypeLocationSize(const TType& type) const
|
|||
return size;
|
||||
}
|
||||
|
||||
// "If a vertex shader input is any scalar or vector type, it will consume a single location. If a non-vertex
|
||||
// ES: "If a shader input is any scalar or vector type, it will consume a single location."
|
||||
|
||||
// Desktop: "If a vertex shader input is any scalar or vector type, it will consume a single location. If a non-vertex
|
||||
// shader input is a scalar or vector type other than dvec3 or dvec4, it will consume a single location, while
|
||||
// types dvec3 or dvec4 will consume two consecutive locations. Inputs of type double and dvec2 will
|
||||
// consume only a single location, in all stages."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue