Add GLSL_EXT_shader_tile_image

This commit is contained in:
janharaldfredriksen-arm 2023-03-30 17:50:56 +02:00 committed by arcady-lunarg
parent a3310b7cff
commit 0bbec2e8f6
33 changed files with 5712 additions and 5083 deletions

View file

@ -524,6 +524,7 @@ TBuiltIns::TBuiltIns()
dimMap[EsdRect] = 2;
dimMap[EsdBuffer] = 1;
dimMap[EsdSubpass] = 2; // potentially unused for now
dimMap[EsdAttachmentEXT] = 2; // potentially unused for now
#endif
}
@ -4440,6 +4441,24 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
// GL_EXT_shader_tile_image
if (spvVersion.vulkan > 0) {
stageBuiltins[EShLangFragment].append(
"lowp uint stencilAttachmentReadEXT();"
"lowp uint stencilAttachmentReadEXT(int);"
"highp float depthAttachmentReadEXT();"
"highp float depthAttachmentReadEXT(int);"
"\n");
stageBuiltins[EShLangFragment].append(
"vec4 colorAttachmentReadEXT(attachmentEXT);"
"vec4 colorAttachmentReadEXT(attachmentEXT, int);"
"ivec4 colorAttachmentReadEXT(iattachmentEXT);"
"ivec4 colorAttachmentReadEXT(iattachmentEXT, int);"
"uvec4 colorAttachmentReadEXT(uattachmentEXT);"
"uvec4 colorAttachmentReadEXT(uattachmentEXT, int);"
"\n");
}
// GL_ARB_derivative_control
if (profile != EEsProfile && version >= 400) {
stageBuiltins[EShLangFragment].append(derivativeControls);
@ -6201,6 +6220,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
for (int dim = Esd2D; dim <= EsdCube; ++dim) { // 2D, 3D, and Cube
#else
for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass
if (dim == EsdAttachmentEXT)
continue;
if (dim == EsdSubpass && spvVersion.vulkan == 0)
continue;
if (dim == EsdSubpass && (image || shadow || arrayed))
@ -6246,6 +6267,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
#ifndef GLSLANG_WEB
if (dim == EsdSubpass) {
sampler.setSubpass(bTypes[bType], ms ? true : false);
} else if (dim == EsdAttachmentEXT) {
sampler.setAttachmentEXT(bTypes[bType]);
} else
#endif
if (image) {
@ -8732,6 +8755,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
}
// GL_EXT_shader_tile_image
symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
#endif // !GLSLANG_WEB
break;
@ -9957,6 +9985,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock);
symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock);
symbolTable.relateToOperator("stencilAttachmentReadEXT", EOpStencilAttachmentReadEXT);
symbolTable.relateToOperator("depthAttachmentReadEXT", EOpDepthAttachmentReadEXT);
symbolTable.relateToOperator("colorAttachmentReadEXT", EOpColorAttachmentReadEXT);
break;
case EShLangCompute:

View file

@ -3812,7 +3812,10 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const
// non-uniform sampler
// not yet: okay if it has an initializer
// if (! initializer)
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
if (type.getSampler().isAttachmentEXT() && type.getQualifier().storage != EvqTileImageEXT)
error(loc, "can only be used in tileImageEXT variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
else if (type.getQualifier().storage != EvqTileImageEXT)
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
}
}
}
@ -5173,6 +5176,7 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu
case EvqIn:
case EvqOut:
case EvqInOut:
case EvqTileImageEXT:
type.getQualifier().storage = qualifier;
break;
case EvqGlobal:
@ -5780,6 +5784,22 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType.shaderQualifiers.postDepthCoverage = true;
return;
}
/* id is transformed into lower case in the beginning of this function. */
if (id == "non_coherent_color_attachment_readext") {
requireExtensions(loc, 1, &E_GL_EXT_shader_tile_image, "non_coherent_color_attachment_readEXT");
publicType.shaderQualifiers.nonCoherentColorAttachmentReadEXT = true;
return;
}
if (id == "non_coherent_depth_attachment_readext") {
requireExtensions(loc, 1, &E_GL_EXT_shader_tile_image, "non_coherent_depth_attachment_readEXT");
publicType.shaderQualifiers.nonCoherentDepthAttachmentReadEXT = true;
return;
}
if (id == "non_coherent_stencil_attachment_readext") {
requireExtensions(loc, 1, &E_GL_EXT_shader_tile_image, "non_coherent_stencil_attachment_readEXT");
publicType.shaderQualifiers.nonCoherentStencilAttachmentReadEXT = true;
return;
}
for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) {
if (id == TQualifier::getLayoutDepthString(depth)) {
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier");
@ -6474,6 +6494,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqBuffer:
if (type.getBasicType() == EbtBlock)
error(loc, "cannot apply to uniform or buffer block", "location", "");
else if (type.getBasicType() == EbtSampler && type.getSampler().isAttachmentEXT())
error(loc, "only applies to", "location", "%s with storage tileImageEXT", type.getBasicTypeString().c_str());
break;
case EvqtaskPayloadSharedEXT:
error(loc, "cannot apply to taskPayloadSharedEXT", "location", "");
@ -6487,6 +6509,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqHitObjectAttrNV:
break;
#endif
case EvqTileImageEXT:
break;
default:
error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", "");
break;
@ -6496,10 +6520,10 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision);
if (repeated >= 0 && ! typeCollision)
error(loc, "overlapping use of location", "location", "%d", repeated);
// "fragment-shader outputs ... if two variables are placed within the same
// "fragment-shader outputs/tileImageEXT ... if two variables are placed within the same
// location, they must have the same underlying type (floating-point or integer)"
if (typeCollision && language == EShLangFragment && qualifier.isPipeOutput())
error(loc, "fragment outputs sharing the same location must be the same basic type", "location", "%d", repeated);
if (typeCollision && language == EShLangFragment && (qualifier.isPipeOutput() || qualifier.storage == EvqTileImageEXT))
error(loc, "fragment outputs or tileImageEXTs sharing the same location", "location", "%d must be the same basic type", repeated);
}
#ifndef GLSLANG_WEB
@ -6583,7 +6607,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
!qualifier.hasAttachment() &&
!qualifier.hasBufferReference())
error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", "");
else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler)
else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler && !type.getSampler().isAttachmentEXT())
error(loc, "sampler/texture/image requires layout(binding=X)", "binding", "");
}
}
@ -6645,6 +6669,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
// input attachment
if (type.isSubpass()) {
if (extensionTurnedOn(E_GL_EXT_shader_tile_image))
error(loc, "can not be used with GL_EXT_shader_tile_image enabled", type.getSampler().getString().c_str(), "");
if (! qualifier.hasAttachment())
error(loc, "requires an input_attachment_index layout qualifier", "subpass", "");
} else {
@ -6812,6 +6838,14 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
error(loc, "cannot be used with shaderRecordNV", "set", "");
}
if (qualifier.storage == EvqTileImageEXT) {
if (qualifier.hasSet())
error(loc, "cannot be used with tileImageEXT", "set", "");
if (!qualifier.hasLocation())
error(loc, "can only be used with an explicit location", "tileImageEXT", "");
}
if (qualifier.storage == EvqHitAttr && qualifier.hasLayout()) {
error(loc, "cannot apply layout qualifiers to hitAttributeNV variable", "hitAttributeNV", "");
}
@ -6851,6 +6885,12 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
error(loc, message, "early_fragment_tests", "");
if (shaderQualifiers.postDepthCoverage)
error(loc, message, "post_depth_coverage", "");
if (shaderQualifiers.nonCoherentColorAttachmentReadEXT)
error(loc, message, "non_coherent_color_attachment_readEXT", "");
if (shaderQualifiers.nonCoherentDepthAttachmentReadEXT)
error(loc, message, "non_coherent_depth_attachment_readEXT", "");
if (shaderQualifiers.nonCoherentStencilAttachmentReadEXT)
error(loc, message, "non_coherent_stencil_attachment_readEXT", "");
if (shaderQualifiers.primitives != TQualifier::layoutNotSet) {
if (language == EShLangMesh)
error(loc, message, "max_primitives", "");
@ -9460,6 +9500,24 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
else
error(loc, "can only apply to 'in'", "post_coverage_coverage", "");
}
if (publicType.shaderQualifiers.nonCoherentColorAttachmentReadEXT) {
if (publicType.qualifier.storage == EvqVaryingIn)
intermediate.setNonCoherentColorAttachmentReadEXT();
else
error(loc, "can only apply to 'in'", "non_coherent_color_attachment_readEXT", "");
}
if (publicType.shaderQualifiers.nonCoherentDepthAttachmentReadEXT) {
if (publicType.qualifier.storage == EvqVaryingIn)
intermediate.setNonCoherentDepthAttachmentReadEXT();
else
error(loc, "can only apply to 'in'", "non_coherent_depth_attachment_readEXT", "");
}
if (publicType.shaderQualifiers.nonCoherentStencilAttachmentReadEXT) {
if (publicType.qualifier.storage == EvqVaryingIn)
intermediate.setNonCoherentStencilAttachmentReadEXT();
else
error(loc, "can only apply to 'in'", "non_coherent_stencil_attachment_readEXT", "");
}
if (publicType.shaderQualifiers.hasBlendEquation()) {
if (publicType.qualifier.storage != EvqVaryingOut)
error(loc, "can only apply to 'out'", "blend equation", "");

View file

@ -343,6 +343,7 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["const"] = CONST;
(*KeywordMap)["uniform"] = UNIFORM;
(*KeywordMap)["tileImageEXT"] = TILEIMAGEEXT;
(*KeywordMap)["buffer"] = BUFFER;
(*KeywordMap)["in"] = IN;
(*KeywordMap)["out"] = OUT;
@ -685,6 +686,10 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["texture2DRect"] = TEXTURE2DRECT;
(*KeywordMap)["texture1DArray"] = TEXTURE1DARRAY;
(*KeywordMap)["attachmentEXT"] = ATTACHMENTEXT;
(*KeywordMap)["iattachmentEXT"] = IATTACHMENTEXT;
(*KeywordMap)["uattachmentEXT"] = UATTACHMENTEXT;
(*KeywordMap)["subpassInput"] = SUBPASSINPUT;
(*KeywordMap)["subpassInputMS"] = SUBPASSINPUTMS;
(*KeywordMap)["isubpassInput"] = ISUBPASSINPUT;
@ -942,6 +947,7 @@ int TScanContext::tokenizeIdentifier()
switch (keyword) {
case CONST:
case UNIFORM:
case TILEIMAGEEXT:
case IN:
case OUT:
case INOUT:
@ -1658,6 +1664,9 @@ int TScanContext::tokenizeIdentifier()
case ISUBPASSINPUTMS:
case USUBPASSINPUT:
case USUBPASSINPUTMS:
case ATTACHMENTEXT:
case IATTACHMENTEXT:
case UATTACHMENTEXT:
if (parseContext.spvVersion.vulkan > 0)
return keyword;
else

View file

@ -355,6 +355,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable;
extensionBehavior[E_GL_EXT_opacity_micromap] = EBhDisable;
extensionBehavior[E_GL_EXT_ray_tracing_position_fetch] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_tile_image] = EBhDisable;
// OVR extensions
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;

View file

@ -328,6 +328,8 @@ const char* const E_GL_EXT_terminate_invocation = "GL_EXT_terminate_invocation";
const char* const E_GL_EXT_shader_atomic_float = "GL_EXT_shader_atomic_float";
const char* const E_GL_EXT_shader_atomic_float2 = "GL_EXT_shader_atomic_float2";
const char* const E_GL_EXT_shader_tile_image = "GL_EXT_shader_tile_image";
// Arrays of extensions for the above AEP duplications
const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader };

View file

@ -279,6 +279,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
%token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
%token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT
GLSLANG_WEB_EXCLUDE_OFF
@ -304,7 +305,7 @@ GLSLANG_WEB_EXCLUDE_OFF
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> TERMINATE_INVOCATION
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION
%token <lex> UNIFORM SHARED BUFFER
%token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT
%token <lex> FLAT SMOOTH LAYOUT
GLSLANG_WEB_EXCLUDE_ON
@ -1476,6 +1477,11 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqUniform;
}
| TILEIMAGEEXT {
parseContext.globalCheck($1.loc, "tileImageEXT");
$$.init($1.loc);
$$.qualifier.storage = EvqTileImageEXT;
}
| SHARED {
parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
@ -3446,6 +3452,24 @@ GLSLANG_WEB_EXCLUDE_ON
$$.sampler.set(EbtFloat, Esd2D);
$$.sampler.yuv = true;
}
| ATTACHMENTEXT {
parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setAttachmentEXT(EbtFloat);
}
| IATTACHMENTEXT {
parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setAttachmentEXT(EbtInt);
}
| UATTACHMENTEXT {
parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setAttachmentEXT(EbtUint);
}
| SUBPASSINPUT {
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());

View file

@ -279,6 +279,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
%token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
%token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT
@ -304,7 +305,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> TERMINATE_INVOCATION
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION
%token <lex> UNIFORM SHARED BUFFER
%token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT
%token <lex> FLAT SMOOTH LAYOUT
@ -1476,6 +1477,11 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqUniform;
}
| TILEIMAGEEXT {
parseContext.globalCheck($1.loc, "tileImageEXT");
$$.init($1.loc);
$$.qualifier.storage = EvqTileImageEXT;
}
| SHARED {
parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
@ -3446,6 +3452,24 @@ type_specifier_nonarray
$$.sampler.set(EbtFloat, Esd2D);
$$.sampler.yuv = true;
}
| ATTACHMENTEXT {
parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setAttachmentEXT(EbtFloat);
}
| IATTACHMENTEXT {
parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setAttachmentEXT(EbtInt);
}
| UATTACHMENTEXT {
parseContext.requireStage($1.loc, EShLangFragment, "attachmentEXT input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtSampler;
$$.sampler.setAttachmentEXT(EbtUint);
}
| SUBPASSINPUT {
parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel());

File diff suppressed because it is too large Load diff

View file

@ -380,137 +380,141 @@ extern int yydebug;
SPIRV_STORAGE_CLASS = 581, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 582, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 583, /* SPIRV_LITERAL */
LEFT_OP = 584, /* LEFT_OP */
RIGHT_OP = 585, /* RIGHT_OP */
INC_OP = 586, /* INC_OP */
DEC_OP = 587, /* DEC_OP */
LE_OP = 588, /* LE_OP */
GE_OP = 589, /* GE_OP */
EQ_OP = 590, /* EQ_OP */
NE_OP = 591, /* NE_OP */
AND_OP = 592, /* AND_OP */
OR_OP = 593, /* OR_OP */
XOR_OP = 594, /* XOR_OP */
MUL_ASSIGN = 595, /* MUL_ASSIGN */
DIV_ASSIGN = 596, /* DIV_ASSIGN */
ADD_ASSIGN = 597, /* ADD_ASSIGN */
MOD_ASSIGN = 598, /* MOD_ASSIGN */
LEFT_ASSIGN = 599, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 600, /* RIGHT_ASSIGN */
AND_ASSIGN = 601, /* AND_ASSIGN */
XOR_ASSIGN = 602, /* XOR_ASSIGN */
OR_ASSIGN = 603, /* OR_ASSIGN */
SUB_ASSIGN = 604, /* SUB_ASSIGN */
STRING_LITERAL = 605, /* STRING_LITERAL */
LEFT_PAREN = 606, /* LEFT_PAREN */
RIGHT_PAREN = 607, /* RIGHT_PAREN */
LEFT_BRACKET = 608, /* LEFT_BRACKET */
RIGHT_BRACKET = 609, /* RIGHT_BRACKET */
LEFT_BRACE = 610, /* LEFT_BRACE */
RIGHT_BRACE = 611, /* RIGHT_BRACE */
DOT = 612, /* DOT */
COMMA = 613, /* COMMA */
COLON = 614, /* COLON */
EQUAL = 615, /* EQUAL */
SEMICOLON = 616, /* SEMICOLON */
BANG = 617, /* BANG */
DASH = 618, /* DASH */
TILDE = 619, /* TILDE */
PLUS = 620, /* PLUS */
STAR = 621, /* STAR */
SLASH = 622, /* SLASH */
PERCENT = 623, /* PERCENT */
LEFT_ANGLE = 624, /* LEFT_ANGLE */
RIGHT_ANGLE = 625, /* RIGHT_ANGLE */
VERTICAL_BAR = 626, /* VERTICAL_BAR */
CARET = 627, /* CARET */
AMPERSAND = 628, /* AMPERSAND */
QUESTION = 629, /* QUESTION */
INVARIANT = 630, /* INVARIANT */
HIGH_PRECISION = 631, /* HIGH_PRECISION */
MEDIUM_PRECISION = 632, /* MEDIUM_PRECISION */
LOW_PRECISION = 633, /* LOW_PRECISION */
PRECISION = 634, /* PRECISION */
PACKED = 635, /* PACKED */
RESOURCE = 636, /* RESOURCE */
SUPERP = 637, /* SUPERP */
FLOATCONSTANT = 638, /* FLOATCONSTANT */
INTCONSTANT = 639, /* INTCONSTANT */
UINTCONSTANT = 640, /* UINTCONSTANT */
BOOLCONSTANT = 641, /* BOOLCONSTANT */
IDENTIFIER = 642, /* IDENTIFIER */
TYPE_NAME = 643, /* TYPE_NAME */
CENTROID = 644, /* CENTROID */
IN = 645, /* IN */
OUT = 646, /* OUT */
INOUT = 647, /* INOUT */
STRUCT = 648, /* STRUCT */
VOID = 649, /* VOID */
WHILE = 650, /* WHILE */
BREAK = 651, /* BREAK */
CONTINUE = 652, /* CONTINUE */
DO = 653, /* DO */
ELSE = 654, /* ELSE */
FOR = 655, /* FOR */
IF = 656, /* IF */
DISCARD = 657, /* DISCARD */
RETURN = 658, /* RETURN */
SWITCH = 659, /* SWITCH */
CASE = 660, /* CASE */
DEFAULT = 661, /* DEFAULT */
TERMINATE_INVOCATION = 662, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 663, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 664, /* IGNORE_INTERSECTION */
UNIFORM = 665, /* UNIFORM */
SHARED = 666, /* SHARED */
BUFFER = 667, /* BUFFER */
FLAT = 668, /* FLAT */
SMOOTH = 669, /* SMOOTH */
LAYOUT = 670, /* LAYOUT */
DOUBLECONSTANT = 671, /* DOUBLECONSTANT */
INT16CONSTANT = 672, /* INT16CONSTANT */
UINT16CONSTANT = 673, /* UINT16CONSTANT */
FLOAT16CONSTANT = 674, /* FLOAT16CONSTANT */
INT32CONSTANT = 675, /* INT32CONSTANT */
UINT32CONSTANT = 676, /* UINT32CONSTANT */
INT64CONSTANT = 677, /* INT64CONSTANT */
UINT64CONSTANT = 678, /* UINT64CONSTANT */
SUBROUTINE = 679, /* SUBROUTINE */
DEMOTE = 680, /* DEMOTE */
PAYLOADNV = 681, /* PAYLOADNV */
PAYLOADINNV = 682, /* PAYLOADINNV */
HITATTRNV = 683, /* HITATTRNV */
CALLDATANV = 684, /* CALLDATANV */
CALLDATAINNV = 685, /* CALLDATAINNV */
PAYLOADEXT = 686, /* PAYLOADEXT */
PAYLOADINEXT = 687, /* PAYLOADINEXT */
HITATTREXT = 688, /* HITATTREXT */
CALLDATAEXT = 689, /* CALLDATAEXT */
CALLDATAINEXT = 690, /* CALLDATAINEXT */
PATCH = 691, /* PATCH */
SAMPLE = 692, /* SAMPLE */
NONUNIFORM = 693, /* NONUNIFORM */
COHERENT = 694, /* COHERENT */
VOLATILE = 695, /* VOLATILE */
RESTRICT = 696, /* RESTRICT */
READONLY = 697, /* READONLY */
WRITEONLY = 698, /* WRITEONLY */
DEVICECOHERENT = 699, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 700, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 701, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 702, /* SUBGROUPCOHERENT */
NONPRIVATE = 703, /* NONPRIVATE */
SHADERCALLCOHERENT = 704, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 705, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 706, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 707, /* PERVERTEXEXT */
PERVERTEXNV = 708, /* PERVERTEXNV */
PERPRIMITIVENV = 709, /* PERPRIMITIVENV */
PERVIEWNV = 710, /* PERVIEWNV */
PERTASKNV = 711, /* PERTASKNV */
PERPRIMITIVEEXT = 712, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 713, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 714 /* PRECISE */
ATTACHMENTEXT = 584, /* ATTACHMENTEXT */
IATTACHMENTEXT = 585, /* IATTACHMENTEXT */
UATTACHMENTEXT = 586, /* UATTACHMENTEXT */
LEFT_OP = 587, /* LEFT_OP */
RIGHT_OP = 588, /* RIGHT_OP */
INC_OP = 589, /* INC_OP */
DEC_OP = 590, /* DEC_OP */
LE_OP = 591, /* LE_OP */
GE_OP = 592, /* GE_OP */
EQ_OP = 593, /* EQ_OP */
NE_OP = 594, /* NE_OP */
AND_OP = 595, /* AND_OP */
OR_OP = 596, /* OR_OP */
XOR_OP = 597, /* XOR_OP */
MUL_ASSIGN = 598, /* MUL_ASSIGN */
DIV_ASSIGN = 599, /* DIV_ASSIGN */
ADD_ASSIGN = 600, /* ADD_ASSIGN */
MOD_ASSIGN = 601, /* MOD_ASSIGN */
LEFT_ASSIGN = 602, /* LEFT_ASSIGN */
RIGHT_ASSIGN = 603, /* RIGHT_ASSIGN */
AND_ASSIGN = 604, /* AND_ASSIGN */
XOR_ASSIGN = 605, /* XOR_ASSIGN */
OR_ASSIGN = 606, /* OR_ASSIGN */
SUB_ASSIGN = 607, /* SUB_ASSIGN */
STRING_LITERAL = 608, /* STRING_LITERAL */
LEFT_PAREN = 609, /* LEFT_PAREN */
RIGHT_PAREN = 610, /* RIGHT_PAREN */
LEFT_BRACKET = 611, /* LEFT_BRACKET */
RIGHT_BRACKET = 612, /* RIGHT_BRACKET */
LEFT_BRACE = 613, /* LEFT_BRACE */
RIGHT_BRACE = 614, /* RIGHT_BRACE */
DOT = 615, /* DOT */
COMMA = 616, /* COMMA */
COLON = 617, /* COLON */
EQUAL = 618, /* EQUAL */
SEMICOLON = 619, /* SEMICOLON */
BANG = 620, /* BANG */
DASH = 621, /* DASH */
TILDE = 622, /* TILDE */
PLUS = 623, /* PLUS */
STAR = 624, /* STAR */
SLASH = 625, /* SLASH */
PERCENT = 626, /* PERCENT */
LEFT_ANGLE = 627, /* LEFT_ANGLE */
RIGHT_ANGLE = 628, /* RIGHT_ANGLE */
VERTICAL_BAR = 629, /* VERTICAL_BAR */
CARET = 630, /* CARET */
AMPERSAND = 631, /* AMPERSAND */
QUESTION = 632, /* QUESTION */
INVARIANT = 633, /* INVARIANT */
HIGH_PRECISION = 634, /* HIGH_PRECISION */
MEDIUM_PRECISION = 635, /* MEDIUM_PRECISION */
LOW_PRECISION = 636, /* LOW_PRECISION */
PRECISION = 637, /* PRECISION */
PACKED = 638, /* PACKED */
RESOURCE = 639, /* RESOURCE */
SUPERP = 640, /* SUPERP */
FLOATCONSTANT = 641, /* FLOATCONSTANT */
INTCONSTANT = 642, /* INTCONSTANT */
UINTCONSTANT = 643, /* UINTCONSTANT */
BOOLCONSTANT = 644, /* BOOLCONSTANT */
IDENTIFIER = 645, /* IDENTIFIER */
TYPE_NAME = 646, /* TYPE_NAME */
CENTROID = 647, /* CENTROID */
IN = 648, /* IN */
OUT = 649, /* OUT */
INOUT = 650, /* INOUT */
STRUCT = 651, /* STRUCT */
VOID = 652, /* VOID */
WHILE = 653, /* WHILE */
BREAK = 654, /* BREAK */
CONTINUE = 655, /* CONTINUE */
DO = 656, /* DO */
ELSE = 657, /* ELSE */
FOR = 658, /* FOR */
IF = 659, /* IF */
DISCARD = 660, /* DISCARD */
RETURN = 661, /* RETURN */
SWITCH = 662, /* SWITCH */
CASE = 663, /* CASE */
DEFAULT = 664, /* DEFAULT */
TERMINATE_INVOCATION = 665, /* TERMINATE_INVOCATION */
TERMINATE_RAY = 666, /* TERMINATE_RAY */
IGNORE_INTERSECTION = 667, /* IGNORE_INTERSECTION */
UNIFORM = 668, /* UNIFORM */
SHARED = 669, /* SHARED */
BUFFER = 670, /* BUFFER */
TILEIMAGEEXT = 671, /* TILEIMAGEEXT */
FLAT = 672, /* FLAT */
SMOOTH = 673, /* SMOOTH */
LAYOUT = 674, /* LAYOUT */
DOUBLECONSTANT = 675, /* DOUBLECONSTANT */
INT16CONSTANT = 676, /* INT16CONSTANT */
UINT16CONSTANT = 677, /* UINT16CONSTANT */
FLOAT16CONSTANT = 678, /* FLOAT16CONSTANT */
INT32CONSTANT = 679, /* INT32CONSTANT */
UINT32CONSTANT = 680, /* UINT32CONSTANT */
INT64CONSTANT = 681, /* INT64CONSTANT */
UINT64CONSTANT = 682, /* UINT64CONSTANT */
SUBROUTINE = 683, /* SUBROUTINE */
DEMOTE = 684, /* DEMOTE */
PAYLOADNV = 685, /* PAYLOADNV */
PAYLOADINNV = 686, /* PAYLOADINNV */
HITATTRNV = 687, /* HITATTRNV */
CALLDATANV = 688, /* CALLDATANV */
CALLDATAINNV = 689, /* CALLDATAINNV */
PAYLOADEXT = 690, /* PAYLOADEXT */
PAYLOADINEXT = 691, /* PAYLOADINEXT */
HITATTREXT = 692, /* HITATTREXT */
CALLDATAEXT = 693, /* CALLDATAEXT */
CALLDATAINEXT = 694, /* CALLDATAINEXT */
PATCH = 695, /* PATCH */
SAMPLE = 696, /* SAMPLE */
NONUNIFORM = 697, /* NONUNIFORM */
COHERENT = 698, /* COHERENT */
VOLATILE = 699, /* VOLATILE */
RESTRICT = 700, /* RESTRICT */
READONLY = 701, /* READONLY */
WRITEONLY = 702, /* WRITEONLY */
DEVICECOHERENT = 703, /* DEVICECOHERENT */
QUEUEFAMILYCOHERENT = 704, /* QUEUEFAMILYCOHERENT */
WORKGROUPCOHERENT = 705, /* WORKGROUPCOHERENT */
SUBGROUPCOHERENT = 706, /* SUBGROUPCOHERENT */
NONPRIVATE = 707, /* NONPRIVATE */
SHADERCALLCOHERENT = 708, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 709, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 710, /* EXPLICITINTERPAMD */
PERVERTEXEXT = 711, /* PERVERTEXEXT */
PERVERTEXNV = 712, /* PERVERTEXNV */
PERPRIMITIVENV = 713, /* PERPRIMITIVENV */
PERVIEWNV = 714, /* PERVIEWNV */
PERTASKNV = 715, /* PERTASKNV */
PERPRIMITIVEEXT = 716, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 717, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 718 /* PRECISE */
};
typedef enum yytokentype yytoken_kind_t;
#endif
@ -558,7 +562,7 @@ union YYSTYPE
glslang::TArraySizes* typeParameters;
} interm;
#line 562 "MachineIndependent/glslang_tab.cpp.h"
#line 566 "MachineIndependent/glslang_tab.cpp.h"
};
typedef union YYSTYPE YYSTYPE;

View file

@ -663,6 +663,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
case EOpColorAttachmentReadEXT: out.debug << "colorAttachmentReadEXT"; break;
case EOpConstructReference: out.debug << "Construct reference type"; break;
case EOpDeclare: out.debug << "Declare"; break;
@ -1060,6 +1062,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpSubpassLoad: out.debug << "subpassLoad"; break;
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
case EOpColorAttachmentReadEXT: out.debug << "colorAttachmentReadEXT"; break;
case EOpTraceNV: out.debug << "traceNV"; break;
case EOpTraceRayMotionNV: out.debug << "traceRayMotionNV"; break;
case EOpTraceKHR: out.debug << "traceRayKHR"; break;
@ -1141,6 +1145,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
#ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif
case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break;
case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break;
default: out.debug.message(EPrefixError, "Bad aggregation op");
}
@ -1545,6 +1551,12 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
infoSink.debug << "using early_fragment_tests\n";
if (postDepthCoverage)
infoSink.debug << "using post_depth_coverage\n";
if (nonCoherentColorAttachmentReadEXT)
infoSink.debug << "using non_coherent_color_attachment_readEXT\n";
if (nonCoherentDepthAttachmentReadEXT)
infoSink.debug << "using non_coherent_depth_attachment_readEXT\n";
if (nonCoherentStencilAttachmentReadEXT)
infoSink.debug << "using non_coherent_stencil_attachment_readEXT\n";
if (depthLayout != EldNone)
infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n";
if (blendEquations != 0) {

View file

@ -271,6 +271,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
MERGE_TRUE(earlyFragmentTests);
MERGE_TRUE(postDepthCoverage);
MERGE_TRUE(nonCoherentColorAttachmentReadEXT);
MERGE_TRUE(nonCoherentDepthAttachmentReadEXT);
MERGE_TRUE(nonCoherentStencilAttachmentReadEXT);
if (depthLayout == EldNone)
depthLayout = unit.depthLayout;
@ -1617,7 +1620,7 @@ bool TIntermediate::userOutputUsed() const
return found;
}
// Accumulate locations used for inputs, outputs, and uniforms, payload and callable data
// Accumulate locations used for inputs, outputs, and uniforms, payload, callable data, and tileImageEXT
// and check for collisions as the accumulation is done.
//
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
@ -1639,6 +1642,8 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
set = 2;
else if (qualifier.storage == EvqBuffer)
set = 3;
else if (qualifier.storage == EvqTileImageEXT)
set = 4;
else if (qualifier.isAnyPayload())
setRT = 0;
else if (qualifier.isAnyCallable())
@ -1731,7 +1736,10 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
}
// combine location and component ranges
TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.getIndex() : 0);
TBasicType basicTy = type.getBasicType();
if (basicTy == EbtSampler && type.getSampler().isAttachmentEXT())
basicTy = type.getSampler().type;
TIoRange range(locationRange, componentRange, basicTy, qualifier.hasIndex() ? qualifier.getIndex() : 0);
// check for collisions, except for vertex inputs on desktop targeting OpenGL
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0)
@ -1762,6 +1770,19 @@ int TIntermediate::checkLocationRange(int set, const TIoRange& range, const TTyp
}
}
// check typeCollision between tileImageEXT and out
if (set == 4 || set == 1) {
// if the set is "tileImageEXT", check against "out" and vice versa
int againstSet = (set == 4) ? 1 : 4;
for (size_t r = 0; r < usedIo[againstSet].size(); ++r) {
if (range.location.overlap(usedIo[againstSet][r].location) && type.getBasicType() != usedIo[againstSet][r].basicType) {
// aliased-type mismatch
typeCollision = true;
return std::max(range.location.start, usedIo[againstSet][r].location.start);
}
}
}
return -1; // no collision
}

View file

@ -322,6 +322,9 @@ public:
pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false),
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false), depthLayout(EldNone), stencilLayout(ElsNone),
nonCoherentColorAttachmentReadEXT(false),
nonCoherentDepthAttachmentReadEXT(false),
nonCoherentStencilAttachmentReadEXT(false),
hlslFunctionality1(false),
blendEquations(0), xfbMode(false), multiStream(false),
layoutOverrideCoverage(false),
@ -638,6 +641,9 @@ public:
bool getXfbMode() const { return false; }
bool isMultiStream() const { return false; }
TLayoutGeometry getOutputPrimitive() const { return ElgNone; }
bool getNonCoherentColorAttachmentReadEXT() const { return false; }
bool getNonCoherentDepthAttachmentReadEXT() const { return false; }
bool getNonCoherentStencilAttachmentReadEXT() const { return false; }
bool getPostDepthCoverage() const { return false; }
bool getEarlyFragmentTests() const { return false; }
TLayoutDepth getDepth() const { return EldNone; }
@ -894,6 +900,12 @@ public:
return true;
}
TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; }
void setNonCoherentColorAttachmentReadEXT() { nonCoherentColorAttachmentReadEXT = true; }
bool getNonCoherentColorAttachmentReadEXT() const { return nonCoherentColorAttachmentReadEXT; }
void setNonCoherentDepthAttachmentReadEXT() { nonCoherentDepthAttachmentReadEXT = true; }
bool getNonCoherentDepthAttachmentReadEXT() const { return nonCoherentDepthAttachmentReadEXT; }
void setNonCoherentStencilAttachmentReadEXT() { nonCoherentStencilAttachmentReadEXT = true; }
bool getNonCoherentStencilAttachmentReadEXT() const { return nonCoherentStencilAttachmentReadEXT; }
void setPostDepthCoverage() { postDepthCoverage = true; }
bool getPostDepthCoverage() const { return postDepthCoverage; }
void setEarlyFragmentTests() { earlyFragmentTests = true; }
@ -1215,6 +1227,9 @@ protected:
bool earlyFragmentTests;
bool postDepthCoverage;
bool earlyAndLateFragmentTestsAMD;
bool nonCoherentColorAttachmentReadEXT;
bool nonCoherentDepthAttachmentReadEXT;
bool nonCoherentStencilAttachmentReadEXT;
TLayoutDepth depthLayout;
TLayoutStencil stencilLayout;
bool hlslFunctionality1;