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

@ -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", "");