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

@ -39,6 +39,7 @@ static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_ato
static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add";
static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max";
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image";
static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
#endif // #ifndef GLSLextEXT_H

View File

@ -351,6 +351,7 @@ spv::Dim TranslateDimensionality(const glslang::TSampler& sampler)
case glslang::EsdRect: return spv::DimRect;
case glslang::EsdBuffer: return spv::DimBuffer;
case glslang::EsdSubpass: return spv::DimSubpassData;
case glslang::EsdAttachmentEXT: return spv::DimTileImageDataEXT;
default:
assert(0);
return spv::Dim2D;
@ -1311,6 +1312,11 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
return spv::StorageClassInput;
if (type.getQualifier().isPipeOutput())
return spv::StorageClassOutput;
if (type.getQualifier().storage == glslang::EvqTileImageEXT || type.isAttachmentEXT()) {
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
builder.addCapability(spv::CapabilityTileImageColorReadAccessEXT);
return spv::StorageClassTileImageEXT;
}
if (glslangIntermediate->getSource() != glslang::EShSourceHlsl ||
type.getQualifier().storage == glslang::EvqUniform) {
@ -1682,6 +1688,24 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder.addExtension(spv::E_SPV_KHR_post_depth_coverage);
}
if (glslangIntermediate->getNonCoherentColorAttachmentReadEXT()) {
builder.addCapability(spv::CapabilityTileImageColorReadAccessEXT);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeNonCoherentColorAttachmentReadEXT);
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
}
if (glslangIntermediate->getNonCoherentDepthAttachmentReadEXT()) {
builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeNonCoherentDepthAttachmentReadEXT);
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
}
if (glslangIntermediate->getNonCoherentStencilAttachmentReadEXT()) {
builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeNonCoherentStencilAttachmentReadEXT);
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
}
if (glslangIntermediate->isDepthReplacing())
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDepthReplacing);
@ -5752,6 +5776,17 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
return result;
}
if (cracked.attachmentEXT) {
if (opIt != arguments.end()) {
spv::IdImmediate sample = { true, *opIt };
operands.push_back(sample);
}
spv::Id result = builder.createOp(spv::OpColorAttachmentReadEXT, resultType(), operands);
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
builder.setPrecision(result, precision);
return result;
}
spv::IdImmediate coord = { true, *(opIt++) };
operands.push_back(coord);
if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) {
@ -7172,6 +7207,19 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
unaryOp = spv::OpCopyObject;
break;
case glslang::EOpDepthAttachmentReadEXT:
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT);
unaryOp = spv::OpDepthAttachmentReadEXT;
decorations.precision = spv::NoPrecision;
break;
case glslang::EOpStencilAttachmentReadEXT:
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT);
unaryOp = spv::OpStencilAttachmentReadEXT;
decorations.precision = spv::DecorationRelaxedPrecision;
break;
default:
return 0;
}
@ -9262,6 +9310,30 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
return builder.createOp(spv::OpReadClockKHR, typeId, args);
}
#endif
case glslang::EOpStencilAttachmentReadEXT:
case glslang::EOpDepthAttachmentReadEXT:
{
builder.addExtension(spv::E_SPV_EXT_shader_tile_image);
spv::Decoration precision;
spv::Op spv_op;
if (op == glslang::EOpStencilAttachmentReadEXT)
{
precision = spv::DecorationRelaxedPrecision;
spv_op = spv::OpStencilAttachmentReadEXT;
builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT);
}
else
{
precision = spv::NoPrecision;
spv_op = spv::OpDepthAttachmentReadEXT;
builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT);
}
std::vector<spv::Id> args; // Dummy args
spv::Id result = builder.createOp(spv_op, typeId, args);
return builder.setPrecision(result, precision);
}
default:
break;
}

View File

@ -215,6 +215,10 @@ const char* ExecutionModeString(int mode)
case ExecutionModeNoGlobalOffsetINTEL: return "NoGlobalOffsetINTEL";
case ExecutionModeNumSIMDWorkitemsINTEL: return "NumSIMDWorkitemsINTEL";
case ExecutionModeNonCoherentColorAttachmentReadEXT: return "NonCoherentColorAttachmentReadEXT";
case ExecutionModeNonCoherentDepthAttachmentReadEXT: return "NonCoherentDepthAttachmentReadEXT";
case ExecutionModeNonCoherentStencilAttachmentReadEXT: return "NonCoherentStencilAttachmentReadEXT";
case ExecutionModeCeiling:
default: return "Bad";
}
@ -247,6 +251,7 @@ const char* StorageClassString(int StorageClass)
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT";
case StorageClassHitObjectAttributeNV: return "HitObjectAttributeNV";
case StorageClassTileImageEXT: return "TileImageEXT";
default: return "Bad";
}
}
@ -464,6 +469,7 @@ const char* DimensionString(int dim)
case 4: return "Rect";
case 5: return "Buffer";
case 6: return "SubpassData";
case DimTileImageDataEXT: return "TileImageDataEXT";
default: return "Bad";
}
@ -992,6 +998,10 @@ const char* CapabilityString(int info)
case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT";
case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT";
case CapabilityTileImageColorReadAccessEXT: return "TileImageColorReadAccessEXT";
case CapabilityTileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT";
case CapabilityTileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT";
case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR";
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";
@ -1502,6 +1512,10 @@ const char* OpcodeString(int op)
case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV";
case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV";
case OpColorAttachmentReadEXT: return "OpColorAttachmentReadEXT";
case OpDepthAttachmentReadEXT: return "OpDepthAttachmentReadEXT";
case OpStencilAttachmentReadEXT: return "OpStencilAttachmentReadEXT";
default:
return "Bad";
}
@ -3268,6 +3282,11 @@ void Parameterize()
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Time'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Payload'");
InstructionDesc[OpHitObjectTraceRayMotionNV].setResultAndType(false, false);
InstructionDesc[OpColorAttachmentReadEXT].operands.push(OperandId, "'Attachment'");
InstructionDesc[OpColorAttachmentReadEXT].operands.push(OperandId, "'Sample'", true);
InstructionDesc[OpStencilAttachmentReadEXT].operands.push(OperandId, "'Sample'", true);
InstructionDesc[OpDepthAttachmentReadEXT].operands.push(OperandId, "'Sample'", true);
}
}; // end spv namespace

View File

@ -156,6 +156,9 @@ enum ExecutionMode {
ExecutionModeSubgroupsPerWorkgroupId = 37,
ExecutionModeLocalSizeId = 38,
ExecutionModeLocalSizeHintId = 39,
ExecutionModeNonCoherentColorAttachmentReadEXT = 4169,
ExecutionModeNonCoherentDepthAttachmentReadEXT = 4170,
ExecutionModeNonCoherentStencilAttachmentReadEXT = 4171,
ExecutionModeSubgroupUniformControlFlowKHR = 4421,
ExecutionModePostDepthCoverage = 4446,
ExecutionModeDenormPreserve = 4459,
@ -214,6 +217,7 @@ enum StorageClass {
StorageClassAtomicCounter = 10,
StorageClassImage = 11,
StorageClassStorageBuffer = 12,
StorageClassTileImageEXT = 4172,
StorageClassCallableDataKHR = 5328,
StorageClassCallableDataNV = 5328,
StorageClassIncomingCallableDataKHR = 5329,
@ -244,6 +248,7 @@ enum Dim {
DimRect = 4,
DimBuffer = 5,
DimSubpassData = 6,
DimTileImageDataEXT = 4173,
DimMax = 0x7fffffff,
};
@ -984,6 +989,9 @@ enum Capability {
CapabilityShaderViewportIndex = 70,
CapabilityUniformDecoration = 71,
CapabilityCoreBuiltinsARM = 4165,
CapabilityTileImageColorReadAccessEXT = 4166,
CapabilityTileImageDepthReadAccessEXT = 4167,
CapabilityTileImageStencilReadAccessEXT = 4168,
CapabilityFragmentShadingRateKHR = 4422,
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
@ -1598,6 +1606,9 @@ enum Op {
OpPtrEqual = 401,
OpPtrNotEqual = 402,
OpPtrDiff = 403,
OpColorAttachmentReadEXT = 4160,
OpDepthAttachmentReadEXT = 4161,
OpStencilAttachmentReadEXT = 4162,
OpTerminateInvocation = 4416,
OpSubgroupBallotKHR = 4421,
OpSubgroupFirstInvocationKHR = 4422,
@ -2313,6 +2324,9 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpPtrEqual: *hasResult = true; *hasResultType = true; break;
case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break;
case OpPtrDiff: *hasResult = true; *hasResultType = true; break;
case OpColorAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
case OpDepthAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
case OpStencilAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
case OpTerminateInvocation: *hasResult = false; *hasResultType = false; break;
case OpSubgroupBallotKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupFirstInvocationKHR: *hasResult = true; *hasResultType = true; break;

View File

@ -1,7 +1,7 @@
440.frag
ERROR: 0:11: 'location' : overlapping use of location 4
ERROR: 0:13: 'component' : type overflows the available 4 components
ERROR: 0:22: 'location' : fragment outputs sharing the same location must be the same basic type 30
ERROR: 0:22: 'location' : fragment outputs or tileImageEXTs sharing the same location 30 must be the same basic type
ERROR: 0:24: 'qualifier' : cannot use auxiliary, memory, interpolation, or precision qualifier in a default qualifier declaration (declaration with no type)
ERROR: 0:25: 'qualifier' : cannot use auxiliary, memory, interpolation, or precision qualifier in a default qualifier declaration (declaration with no type)
ERROR: 0:26: 'qualifier' : cannot use auxiliary, memory, interpolation, or precision qualifier in a default qualifier declaration (declaration with no type)

View File

@ -0,0 +1,38 @@
spv.ext.ShaderTileImage.color.frag
WARNING: 0:6: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 15
Capability Shader
Capability TileImageColorReadAccessEXT
Extension "SPV_EXT_shader_tile_image"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
ExecutionMode 4 OriginUpperLeft
Source GLSL 460
SourceExtension "GL_EXT_shader_tile_image"
Name 4 "main"
Name 9 "out_color"
Name 12 "in_color"
Decorate 9(out_color) Location 0
Decorate 12(in_color) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Output 7(fvec4)
9(out_color): 8(ptr) Variable Output
10: TypeImage 6(float) TileImageDataEXT nonsampled format:Unknown
11: TypePointer TileImageEXT 10
12(in_color): 11(ptr) Variable TileImageEXT
4(main): 2 Function None 3
5: Label
13: 10 Load 12(in_color)
14: 7(fvec4) ColorAttachmentReadEXT 13
Store 9(out_color) 14
Return
FunctionEnd

View File

@ -0,0 +1,56 @@
spv.ext.ShaderTileImage.depth_stencil.frag
WARNING: 0:6: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 26
Capability Shader
Capability TileImageDepthReadAccessEXT
Capability TileImageStencilReadAccessEXT
Extension "SPV_EXT_shader_tile_image"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 16 22
ExecutionMode 4 OriginUpperLeft
Source GLSL 460
SourceExtension "GL_EXT_shader_tile_image"
Name 4 "main"
Name 8 "depth"
Name 12 "stencil_value"
Name 16 "stencil_out"
Name 22 "depth_out"
Decorate 13 RelaxedPrecision
Decorate 16(stencil_out) Location 0
Decorate 22(depth_out) Location 1
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
10: TypeInt 32 0
11: TypePointer Function 10(int)
14: TypeVector 10(int) 4
15: TypePointer Output 14(ivec4)
16(stencil_out): 15(ptr) Variable Output
18: 10(int) Constant 0
20: TypeVector 6(float) 4
21: TypePointer Output 20(fvec4)
22(depth_out): 21(ptr) Variable Output
24: 6(float) Constant 0
4(main): 2 Function None 3
5: Label
8(depth): 7(ptr) Variable Function
12(stencil_value): 11(ptr) Variable Function
9: 6(float) DepthAttachmentReadEXT
Store 8(depth) 9
13: 10(int) StencilAttachmentReadEXT
Store 12(stencil_value) 13
17: 10(int) Load 12(stencil_value)
19: 14(ivec4) CompositeConstruct 17 18 18 18
Store 16(stencil_out) 19
23: 6(float) Load 8(depth)
25: 20(fvec4) CompositeConstruct 23 24 24 24
Store 22(depth_out) 25
Return
FunctionEnd

View File

@ -0,0 +1,6 @@
spv.ext.ShaderTileImage.overlap.frag
ERROR: 0:8: 'location' : overlapping use of location 1
ERROR: 1 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View File

@ -0,0 +1,6 @@
spv.ext.ShaderTileImage.subpassinput.frag
ERROR: 0:6: 'subpassInput' : can not be used with GL_EXT_shader_tile_image enabled
ERROR: 1 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View File

@ -0,0 +1,6 @@
spv.ext.ShaderTileImage.typemismatch.frag
ERROR: 0:7: 'location' : fragment outputs or tileImageEXTs sharing the same location 0 must be the same basic type
ERROR: 1 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View File

@ -0,0 +1,9 @@
spv.ext.ShaderTileImage.wronglayout.frag
ERROR: 0:7: 'binding' : requires uniform or buffer storage qualifier
ERROR: 0:7: 'set' : cannot be used with tileImageEXT
ERROR: 0:7: 'tileImageEXT' : can only be used with an explicit location
ERROR: 0:7: 'input_attachment_index' : can only be used with a subpass
ERROR: 4 compilation errors. No code generated.
SPIR-V is not generated for failed compile or link

View File

@ -0,0 +1,12 @@
#version 460
#extension GL_EXT_shader_tile_image : require
precision highp float;
layout(location=1) tileImageEXT highp attachmentEXT in_color;
layout(location=0) out highp vec4 out_color;
void main(void)
{
out_color = colorAttachmentReadEXT(in_color);
}

View File

@ -0,0 +1,16 @@
#version 460
#extension GL_EXT_shader_tile_image : require
precision highp float;
layout(location=0) out highp uvec4 stencil_out;
layout(location=1) out highp vec4 depth_out;
void main(void)
{
float depth = depthAttachmentReadEXT();
uint stencil_value = stencilAttachmentReadEXT();
stencil_out = uvec4(stencil_value,0,0,0);
depth_out = vec4(depth,0.0,0.0,0.0);
}

View File

@ -0,0 +1,15 @@
#version 460
#extension GL_EXT_shader_tile_image : require
precision mediump int;
precision highp float;
layout(location=0) tileImageEXT highp attachmentEXT in_color[2];
layout(location=1) tileImageEXT highp attachmentEXT in_color_1;
layout(location=1) out highp vec4 out_color;
void main(void)
{
out_color = colorAttachmentReadEXT(in_color[0]);
out_color += colorAttachmentReadEXT(in_color_1);
}

View File

@ -0,0 +1,13 @@
#version 450
#extension GL_EXT_shader_tile_image : require
precision highp float;
layout(set = 0, binding = 0, input_attachment_index = 0) uniform subpassInput i;
layout(location = 0) out vec4 fragColor;
void main()
{
fragColor = subpassLoad(i);
}

View File

@ -0,0 +1,13 @@
#version 320 es
#extension GL_EXT_shader_tile_image : require
layout(non_coherent_color_attachment_readEXT) in;
layout(location=0) tileImageEXT highp iattachmentEXT in_color_i;
layout(location=0) out highp vec4 out_color_f;
void main(void)
{
highp ivec4 read = colorAttachmentReadEXT(in_color_i);
out_color_f = vec4(read);
}

View File

@ -0,0 +1,13 @@
#version 460
#extension GL_EXT_shader_tile_image : require
precision highp float;
precision mediump int;
layout(binding=0, set=0, input_attachment_index=0) tileImageEXT highp attachmentEXT in_color;
layout(location=0) out highp vec4 out_color;
void main(void)
{
out_color = colorAttachmentReadEXT(in_color);
}

View File

@ -134,6 +134,8 @@ enum TStorageQualifier {
EvqFragDepth,
EvqFragStencil,
EvqTileImageEXT,
// end of list
EvqLast
};

View File

@ -72,6 +72,7 @@ enum TSamplerDim {
EsdRect,
EsdBuffer,
EsdSubpass, // goes only with non-sampled image (image is true)
EsdAttachmentEXT,
EsdNumDims
};
@ -90,6 +91,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isBuffer() const { return false; }
bool isRect() const { return false; }
bool isSubpass() const { return false; }
bool isAttachmentEXT() const { return false; }
bool isCombined() const { return true; }
bool isImage() const { return false; }
bool isImageClass() const { return false; }
@ -122,8 +124,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
bool isBuffer() const { return dim == EsdBuffer; }
bool isRect() const { return dim == EsdRect; }
bool isSubpass() const { return dim == EsdSubpass; }
bool isAttachmentEXT() const { return dim == EsdAttachmentEXT; }
bool isCombined() const { return combined; }
bool isImage() const { return image && !isSubpass(); }
bool isImage() const { return image && !isSubpass() && !isAttachmentEXT();}
bool isImageClass() const { return image; }
bool isMultiSample() const { return ms; }
bool isExternal() const { return external; }
@ -214,6 +217,15 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
dim = EsdSubpass;
ms = m;
}
// make an AttachmentEXT
void setAttachmentEXT(TBasicType t)
{
clear();
type = t;
image = true;
dim = EsdAttachmentEXT;
}
#endif
bool operator==(const TSampler& right) const
@ -264,7 +276,9 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
default: break;
}
if (isImageClass()) {
if (isSubpass())
if (isAttachmentEXT())
s.append("attachmentEXT");
else if (isSubpass())
s.append("subpass");
else
s.append("image");
@ -289,6 +303,7 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
case EsdRect: s.append("2DRect"); break;
case EsdBuffer: s.append("Buffer"); break;
case EsdSubpass: s.append("Input"); break;
case EsdAttachmentEXT: s.append(""); break;
#endif
default: break; // some compilers want this
}
@ -1394,6 +1409,9 @@ struct TShaderQualifiers {
bool earlyFragmentTests; // fragment input
bool postDepthCoverage; // fragment input
bool earlyAndLateFragmentTestsAMD; //fragment input
bool nonCoherentColorAttachmentReadEXT; // fragment input
bool nonCoherentDepthAttachmentReadEXT; // fragment input
bool nonCoherentStencilAttachmentReadEXT; // fragment input
TLayoutDepth layoutDepth;
TLayoutStencil layoutStencil;
bool blendEquation; // true if any blend equation was specified
@ -1433,6 +1451,9 @@ struct TShaderQualifiers {
earlyFragmentTests = false;
earlyAndLateFragmentTestsAMD = false;
postDepthCoverage = false;
nonCoherentColorAttachmentReadEXT = false;
nonCoherentDepthAttachmentReadEXT = false;
nonCoherentStencilAttachmentReadEXT = false;
layoutDepth = EldNone;
layoutStencil = ElsNone;
blendEquation = false;
@ -1490,6 +1511,12 @@ struct TShaderQualifiers {
earlyAndLateFragmentTestsAMD = true;
if (src.postDepthCoverage)
postDepthCoverage = true;
if (src.nonCoherentColorAttachmentReadEXT)
nonCoherentColorAttachmentReadEXT = true;
if (src.nonCoherentDepthAttachmentReadEXT)
nonCoherentDepthAttachmentReadEXT = true;
if (src.nonCoherentStencilAttachmentReadEXT)
nonCoherentStencilAttachmentReadEXT = true;
if (src.layoutDepth)
layoutDepth = src.layoutDepth;
if (src.layoutStencil)
@ -1605,6 +1632,7 @@ public:
// "Image" is a superset of "Subpass"
bool isImage() const { return basicType == EbtSampler && sampler.isImage(); }
bool isSubpass() const { return basicType == EbtSampler && sampler.isSubpass(); }
bool isAttachmentEXT() const { return basicType == EbtSampler && sampler.isAttachmentEXT(); }
};
//
@ -1927,7 +1955,7 @@ public:
; }
virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; }
// "Image" is a superset of "Subpass"
virtual bool isAttachmentEXT() const { return basicType == EbtSampler && getSampler().isAttachmentEXT(); }
virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); }
virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); }
virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); }

View File

@ -827,6 +827,7 @@ enum TOperator {
EOpSubpassLoadMS,
EOpSparseImageLoad,
EOpSparseImageLoadLod,
EOpColorAttachmentReadEXT, // Fragment only
EOpImageGuardEnd,
@ -1093,6 +1094,10 @@ enum TOperator {
// GL_EXT_ray_tracing_position_fetch
EOpRayQueryGetIntersectionTriangleVertexPositionsEXT,
// Shader tile image ops
EOpStencilAttachmentReadEXT, // Fragment only
EOpDepthAttachmentReadEXT, // Fragment only
};
class TIntermTraverser;
@ -1396,6 +1401,7 @@ struct TCrackedTextureOp {
bool subpass;
bool lodClamp;
bool fragMask;
bool attachmentEXT;
};
//
@ -1452,6 +1458,7 @@ public:
cracked.gather = false;
cracked.grad = false;
cracked.subpass = false;
cracked.attachmentEXT = false;
cracked.lodClamp = false;
cracked.fragMask = false;
@ -1612,6 +1619,9 @@ public:
case EOpSubpassLoadMS:
cracked.subpass = true;
break;
case EOpColorAttachmentReadEXT:
cracked.attachmentEXT = true;
break;
#endif
default:
break;

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,6 +3812,9 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const
// non-uniform sampler
// not yet: okay if it has an initializer
// if (! initializer)
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;

View File

@ -357,6 +357,12 @@ INSTANTIATE_TEST_SUITE_P(
"spv.discard-dce.frag",
"spv.doWhileLoop.frag",
"spv.earlyReturnDiscard.frag",
"spv.ext.ShaderTileImage.color.frag",
"spv.ext.ShaderTileImage.depth_stencil.frag",
"spv.ext.ShaderTileImage.subpassinput.frag",
"spv.ext.ShaderTileImage.typemismatch.frag",
"spv.ext.ShaderTileImage.overlap.frag",
"spv.ext.ShaderTileImage.wronglayout.frag",
"spv.extPostDepthCoverage.frag",
"spv.extPostDepthCoverage_Error.frag",
"spv.float16convertonlyarith.comp",