Updated glslang.

This commit is contained in:
Бранимир Караџић 2023-05-14 08:48:02 -07:00
parent f611d68f72
commit 1929ca061b
29 changed files with 5762 additions and 5208 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

@ -54,5 +54,6 @@ static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_w
static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests";
static const char* const E_SPV_KHR_ray_tracing_position_fetch = "SPV_KHR_ray_tracing_position_fetch";
#endif // #ifndef GLSLextKHR_H

110
3rdparty/glslang/SPIRV/GlslangToSpv.cpp vendored Normal file → Executable file
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;
@ -1010,6 +1011,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInRayTmaxKHR;
case glslang::EbvCullMask:
return spv::BuiltInCullMaskKHR;
case glslang::EbvPositionFetch:
return spv::BuiltInHitTriangleVertexPositionsKHR;
case glslang::EbvInstanceCustomIndex:
return spv::BuiltInInstanceCustomIndexKHR;
case glslang::EbvHitT:
@ -1309,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) {
@ -1680,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);
@ -1857,12 +1883,15 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder.addCapability(spv::CapabilityRayTracingNV);
builder.addExtension("SPV_NV_ray_tracing");
}
if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable)
{
if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable) {
if (extensions.find("GL_EXT_ray_cull_mask") != extensions.end()) {
builder.addCapability(spv::CapabilityRayCullMaskKHR);
builder.addExtension("SPV_KHR_ray_cull_mask");
}
if (extensions.find("GL_EXT_ray_tracing_position_fetch") != extensions.end()) {
builder.addCapability(spv::CapabilityRayTracingPositionFetchKHR);
builder.addExtension("SPV_KHR_ray_tracing_position_fetch");
}
}
break;
}
@ -3301,6 +3330,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder);
builder.addCapability(spv::CapabilityShaderInvocationReorderNV);
break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
builder.addExtension(spv::E_SPV_KHR_ray_tracing_position_fetch);
builder.addCapability(spv::CapabilityRayQueryPositionFetchKHR);
noReturnValue = true;
break;
#endif
case glslang::EOpDebugPrintf:
@ -3479,6 +3513,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (arg == 0 && glslangOperands.size() != 2)
lvalue = true;
break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (arg == 0 || arg == 2)
lvalue = true;
break;
#endif
default:
break;
@ -3571,7 +3609,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayDirection ||
glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayOrigin ||
glslangOp == glslang::EOpRayQueryGetIntersectionObjectToWorld ||
glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject
glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject ||
glslangOp == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT
)) {
bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst();
operands.push_back(builder.makeIntConstant(cond ? 1 : 0));
@ -3637,6 +3676,19 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps);
result = 0;
} else if (node->getOp() == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT) {
std::vector<spv::IdImmediate> idImmOps;
idImmOps.push_back(spv::IdImmediate(true, operands[0])); // q
idImmOps.push_back(spv::IdImmediate(true, operands[1])); // committed
spv::Id typeId = builder.makeArrayType(builder.makeVectorType(builder.makeFloatType(32), 3),
builder.makeUintConstant(3), 0);
// do the op
spv::Id result = builder.createOp(spv::OpRayQueryGetIntersectionTriangleVertexPositionsKHR, typeId, idImmOps);
// store the result to the pointer (out param 'm')
builder.createStore(result, operands[2]);
result = 0;
} else
#endif
if (atomic) {
@ -5561,6 +5613,10 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if (i == 7)
lvalue = true;
break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (i == 2)
lvalue = true;
break;
default:
break;
}
@ -5720,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) {
@ -7140,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;
}
@ -9230,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

@ -36,10 +36,6 @@
#include "SPVRemapper.h"
#include "doc.h"
#if !defined (use_cpp11)
// ... not supported before C++11
#else // defined (use_cpp11)
#include <algorithm>
#include <cassert>
#include "../glslang/Include/Common.h"
@ -1528,5 +1524,3 @@ namespace spv {
} // namespace SPV
#endif // defined (use_cpp11)

View File

@ -43,12 +43,6 @@
namespace spv {
// MSVC defines __cplusplus as an older value, even when it supports almost all of 11.
// We handle that here by making our own symbol.
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1700)
# define use_cpp11 1
#endif
class spirvbin_base_t
{
public:
@ -74,27 +68,6 @@ public:
} // namespace SPV
#if !defined (use_cpp11)
#include <cstdio>
#include <cstdint>
namespace spv {
class spirvbin_t : public spirvbin_base_t
{
public:
spirvbin_t(int /*verbose = 0*/) { }
void remap(std::vector<std::uint32_t>& /*spv*/, unsigned int /*opts = 0*/)
{
printf("Tool not compiled for C++11, which is required for SPIR-V remapping.\n");
exit(5);
}
};
} // namespace SPV
#else // defined (use_cpp11)
#include <functional>
#include <cstdint>
#include <unordered_map>
@ -308,5 +281,4 @@ private:
} // namespace SPV
#endif // defined (use_cpp11)
#endif // SPIRVREMAPPER_H

27
3rdparty/glslang/SPIRV/doc.cpp vendored Normal file → Executable file
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";
}
}
@ -404,6 +409,7 @@ const char* BuiltInString(int builtIn)
case BuiltInRayTminKHR: return "RayTminKHR";
case BuiltInRayTmaxKHR: return "RayTmaxKHR";
case BuiltInCullMaskKHR: return "CullMaskKHR";
case BuiltInHitTriangleVertexPositionsKHR: return "HitTriangleVertexPositionsKHR";
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
@ -463,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";
}
@ -950,6 +957,8 @@ const char* CapabilityString(int info)
case CapabilityRayQueryKHR: return "RayQueryKHR";
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
case CapabilityRayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR";
case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR";
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR";
@ -989,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";
@ -1452,6 +1465,7 @@ const char* OpcodeString(int op)
case OpRayQueryGetWorldRayOriginKHR: return "OpRayQueryGetWorldRayOriginKHR";
case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR";
case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR";
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR";
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
@ -1498,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";
}
@ -3025,6 +3043,10 @@ void Parameterize()
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true);
InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'RayQuery'");
InstructionDesc[OpRayQueryGetIntersectionTriangleVertexPositionsKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true);
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'");
@ -3260,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

@ -23,19 +23,6 @@
#include <limits>
#include <sstream>
#if defined(_MSC_VER) && _MSC_VER < 1800
namespace std {
bool isnan(double f)
{
return ::_isnan(f) != 0;
}
bool isinf(double f)
{
return ::_finite(f) == 0;
}
}
#endif
#include "bitutils.h"
namespace spvutils {

View File

@ -26,7 +26,7 @@
// the Binary Section of the SPIR-V specification.
// Enumeration tokens for SPIR-V, in various styles:
// C, C++, C++11, JSON, Lua, Python, C#, D
// C, C++, C++11, JSON, Lua, Python, C#, D, Beef
//
// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL
// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL
@ -36,6 +36,8 @@
// - C# will use enum classes in the Specification class located in the "Spv" namespace,
// e.g.: Spv.Specification.SourceLanguage.GLSL
// - D will have tokens under the "spv" module, e.g: spv.SourceLanguage.GLSL
// - Beef will use enum classes in the Specification class located in the "Spv" namespace,
// e.g.: Spv.Specification.SourceLanguage.GLSL
//
// Some tokens act like mask values, which can be OR'd together,
// while others are mutually exclusive. The mask-like ones have
@ -66,6 +68,7 @@ enum SourceLanguage {
SourceLanguageOpenCL_CPP = 4,
SourceLanguageHLSL = 5,
SourceLanguageCPP_for_OpenCL = 6,
SourceLanguageSYCL = 7,
SourceLanguageMax = 0x7fffffff,
};
@ -153,6 +156,9 @@ enum ExecutionMode {
ExecutionModeSubgroupsPerWorkgroupId = 37,
ExecutionModeLocalSizeId = 38,
ExecutionModeLocalSizeHintId = 39,
ExecutionModeNonCoherentColorAttachmentReadEXT = 4169,
ExecutionModeNonCoherentDepthAttachmentReadEXT = 4170,
ExecutionModeNonCoherentStencilAttachmentReadEXT = 4171,
ExecutionModeSubgroupUniformControlFlowKHR = 4421,
ExecutionModePostDepthCoverage = 4446,
ExecutionModeDenormPreserve = 4459,
@ -192,6 +198,8 @@ enum ExecutionMode {
ExecutionModeNoGlobalOffsetINTEL = 5895,
ExecutionModeNumSIMDWorkitemsINTEL = 5896,
ExecutionModeSchedulerTargetFmaxMhzINTEL = 5903,
ExecutionModeStreamingInterfaceINTEL = 6154,
ExecutionModeNamedBarrierCountINTEL = 6417,
ExecutionModeMax = 0x7fffffff,
};
@ -209,6 +217,7 @@ enum StorageClass {
StorageClassAtomicCounter = 10,
StorageClassImage = 11,
StorageClassStorageBuffer = 12,
StorageClassTileImageEXT = 4172,
StorageClassCallableDataKHR = 5328,
StorageClassCallableDataNV = 5328,
StorageClassIncomingCallableDataKHR = 5329,
@ -239,6 +248,7 @@ enum Dim {
DimRect = 4,
DimBuffer = 5,
DimSubpassData = 6,
DimTileImageDataEXT = 4173,
DimMax = 0x7fffffff,
};
@ -449,6 +459,7 @@ enum FunctionParameterAttribute {
FunctionParameterAttributeNoCapture = 5,
FunctionParameterAttributeNoWrite = 6,
FunctionParameterAttributeNoReadWrite = 7,
FunctionParameterAttributeRuntimeAlignedINTEL = 5940,
FunctionParameterAttributeMax = 0x7fffffff,
};
@ -558,12 +569,27 @@ enum Decoration {
DecorationPrefetchINTEL = 5902,
DecorationStallEnableINTEL = 5905,
DecorationFuseLoopsInFunctionINTEL = 5907,
DecorationMathOpDSPModeINTEL = 5909,
DecorationAliasScopeINTEL = 5914,
DecorationNoAliasINTEL = 5915,
DecorationInitiationIntervalINTEL = 5917,
DecorationMaxConcurrencyINTEL = 5918,
DecorationPipelineEnableINTEL = 5919,
DecorationBufferLocationINTEL = 5921,
DecorationIOPipeStorageINTEL = 5944,
DecorationFunctionFloatingPointModeINTEL = 6080,
DecorationSingleElementVectorINTEL = 6085,
DecorationVectorComputeCallableFunctionINTEL = 6087,
DecorationMediaBlockIOINTEL = 6140,
DecorationConduitKernelArgumentINTEL = 6175,
DecorationRegisterMapKernelArgumentINTEL = 6176,
DecorationMMHostInterfaceAddressWidthINTEL = 6177,
DecorationMMHostInterfaceDataWidthINTEL = 6178,
DecorationMMHostInterfaceLatencyINTEL = 6179,
DecorationMMHostInterfaceReadWriteModeINTEL = 6180,
DecorationMMHostInterfaceMaxBurstINTEL = 6181,
DecorationMMHostInterfaceWaitRequestINTEL = 6182,
DecorationStableKernelArgumentINTEL = 6183,
DecorationMax = 0x7fffffff,
};
@ -609,8 +635,8 @@ enum BuiltIn {
BuiltInSubgroupLocalInvocationId = 41,
BuiltInVertexIndex = 42,
BuiltInInstanceIndex = 43,
BuiltInCoreCountARM = 4161,
BuiltInCoreIDARM = 4160,
BuiltInCoreCountARM = 4161,
BuiltInCoreMaxIDARM = 4162,
BuiltInWarpIDARM = 4163,
BuiltInWarpMaxIDARM = 4164,
@ -691,6 +717,7 @@ enum BuiltIn {
BuiltInHitKindKHR = 5333,
BuiltInHitKindNV = 5333,
BuiltInCurrentRayTimeNV = 5334,
BuiltInHitTriangleVertexPositionsKHR = 5335,
BuiltInIncomingRayFlagsKHR = 5351,
BuiltInIncomingRayFlagsNV = 5351,
BuiltInRayGeometryIndexKHR = 5352,
@ -732,6 +759,8 @@ enum LoopControlShift {
LoopControlMaxInterleavingINTELShift = 21,
LoopControlSpeculatedIterationsINTELShift = 22,
LoopControlNoFusionINTELShift = 23,
LoopControlLoopCountINTELShift = 24,
LoopControlMaxReinvocationDelayINTELShift = 25,
LoopControlMax = 0x7fffffff,
};
@ -754,6 +783,8 @@ enum LoopControlMask {
LoopControlMaxInterleavingINTELMask = 0x00200000,
LoopControlSpeculatedIterationsINTELMask = 0x00400000,
LoopControlNoFusionINTELMask = 0x00800000,
LoopControlLoopCountINTELMask = 0x01000000,
LoopControlMaxReinvocationDelayINTELMask = 0x02000000,
};
enum FunctionControlShift {
@ -826,6 +857,8 @@ enum MemoryAccessShift {
MemoryAccessMakePointerVisibleKHRShift = 4,
MemoryAccessNonPrivatePointerShift = 5,
MemoryAccessNonPrivatePointerKHRShift = 5,
MemoryAccessAliasScopeINTELMaskShift = 16,
MemoryAccessNoAliasINTELMaskShift = 17,
MemoryAccessMax = 0x7fffffff,
};
@ -840,6 +873,8 @@ enum MemoryAccessMask {
MemoryAccessMakePointerVisibleKHRMask = 0x00000010,
MemoryAccessNonPrivatePointerMask = 0x00000020,
MemoryAccessNonPrivatePointerKHRMask = 0x00000020,
MemoryAccessAliasScopeINTELMaskMask = 0x00010000,
MemoryAccessNoAliasINTELMaskMask = 0x00020000,
};
enum Scope {
@ -954,6 +989,9 @@ enum Capability {
CapabilityShaderViewportIndex = 70,
CapabilityUniformDecoration = 71,
CapabilityCoreBuiltinsARM = 4165,
CapabilityTileImageColorReadAccessEXT = 4166,
CapabilityTileImageDepthReadAccessEXT = 4167,
CapabilityTileImageStencilReadAccessEXT = 4168,
CapabilityFragmentShadingRateKHR = 4422,
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
@ -1033,6 +1071,7 @@ enum Capability {
CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311,
CapabilityStorageTexelBufferArrayNonUniformIndexing = 5312,
CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312,
CapabilityRayTracingPositionFetchKHR = 5336,
CapabilityRayTracingNV = 5340,
CapabilityRayTracingMotionBlurNV = 5341,
CapabilityVulkanMemoryModel = 5345,
@ -1050,8 +1089,10 @@ enum Capability {
CapabilityFragmentShaderPixelInterlockEXT = 5378,
CapabilityDemoteToHelperInvocation = 5379,
CapabilityDemoteToHelperInvocationEXT = 5379,
CapabilityRayTracingOpacityMicromapEXT = 5381,
CapabilityShaderInvocationReorderNV = 5383,
CapabilityBindlessTextureNV = 5390,
CapabilityRayQueryPositionFetchKHR = 5391,
CapabilitySubgroupShuffleINTEL = 5568,
CapabilitySubgroupBufferBlockIOINTEL = 5569,
CapabilitySubgroupImageBlockIOINTEL = 5570,
@ -1084,9 +1125,13 @@ enum Capability {
CapabilityFPGAMemoryAccessesINTEL = 5898,
CapabilityFPGAClusterAttributesINTEL = 5904,
CapabilityLoopFuseINTEL = 5906,
CapabilityFPGADSPControlINTEL = 5908,
CapabilityMemoryAccessAliasingINTEL = 5910,
CapabilityFPGAInvocationPipeliningAttributesINTEL = 5916,
CapabilityFPGABufferLocationINTEL = 5920,
CapabilityArbitraryPrecisionFixedPointINTEL = 5922,
CapabilityUSMStorageClassesINTEL = 5935,
CapabilityRuntimeAlignedAttributeINTEL = 5939,
CapabilityIOPipesINTEL = 5943,
CapabilityBlockingPipesINTEL = 5945,
CapabilityFPGARegINTEL = 5948,
@ -1100,12 +1145,16 @@ enum Capability {
CapabilityDotProductKHR = 6019,
CapabilityRayCullMaskKHR = 6020,
CapabilityBitInstructions = 6025,
CapabilityGroupNonUniformRotateKHR = 6026,
CapabilityAtomicFloat32AddEXT = 6033,
CapabilityAtomicFloat64AddEXT = 6034,
CapabilityLongConstantCompositeINTEL = 6089,
CapabilityOptNoneINTEL = 6094,
CapabilityAtomicFloat16AddEXT = 6095,
CapabilityDebugInfoModuleINTEL = 6114,
CapabilitySplitBarrierINTEL = 6141,
CapabilityFPGAArgumentInterfacesINTEL = 6174,
CapabilityGroupUniformArithmeticKHR = 6400,
CapabilityMax = 0x7fffffff,
};
@ -1120,6 +1169,7 @@ enum RayFlagsShift {
RayFlagsCullNoOpaqueKHRShift = 7,
RayFlagsSkipTrianglesKHRShift = 8,
RayFlagsSkipAABBsKHRShift = 9,
RayFlagsForceOpacityMicromap2StateEXTShift = 10,
RayFlagsMax = 0x7fffffff,
};
@ -1135,6 +1185,7 @@ enum RayFlagsMask {
RayFlagsCullNoOpaqueKHRMask = 0x00000080,
RayFlagsSkipTrianglesKHRMask = 0x00000100,
RayFlagsSkipAABBsKHRMask = 0x00000200,
RayFlagsForceOpacityMicromap2StateEXTMask = 0x00000400,
};
enum RayQueryIntersection {
@ -1555,12 +1606,16 @@ enum Op {
OpPtrEqual = 401,
OpPtrNotEqual = 402,
OpPtrDiff = 403,
OpColorAttachmentReadEXT = 4160,
OpDepthAttachmentReadEXT = 4161,
OpStencilAttachmentReadEXT = 4162,
OpTerminateInvocation = 4416,
OpSubgroupBallotKHR = 4421,
OpSubgroupFirstInvocationKHR = 4422,
OpSubgroupAllKHR = 4428,
OpSubgroupAnyKHR = 4429,
OpSubgroupAllEqualKHR = 4430,
OpGroupNonUniformRotateKHR = 4431,
OpSubgroupReadInvocationKHR = 4432,
OpTraceRayKHR = 4445,
OpExecuteCallableKHR = 4446,
@ -1642,6 +1697,7 @@ enum Op {
OpTraceNV = 5337,
OpTraceMotionNV = 5338,
OpTraceRayMotionNV = 5339,
OpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340,
OpTypeAccelerationStructureKHR = 5341,
OpTypeAccelerationStructureNV = 5341,
OpExecuteCallableNV = 5344,
@ -1862,6 +1918,9 @@ enum Op {
OpArbitraryFloatPowRINTEL = 5881,
OpArbitraryFloatPowNINTEL = 5882,
OpLoopControlINTEL = 5887,
OpAliasDomainDeclINTEL = 5911,
OpAliasScopeDeclINTEL = 5912,
OpAliasScopeListDeclINTEL = 5913,
OpFixedSqrtINTEL = 5923,
OpFixedRecipINTEL = 5924,
OpFixedRsqrtINTEL = 5925,
@ -1900,10 +1959,23 @@ enum Op {
OpTypeStructContinuedINTEL = 6090,
OpConstantCompositeContinuedINTEL = 6091,
OpSpecConstantCompositeContinuedINTEL = 6092,
OpControlBarrierArriveINTEL = 6142,
OpControlBarrierWaitINTEL = 6143,
OpGroupIMulKHR = 6401,
OpGroupFMulKHR = 6402,
OpGroupBitwiseAndKHR = 6403,
OpGroupBitwiseOrKHR = 6404,
OpGroupBitwiseXorKHR = 6405,
OpGroupLogicalAndKHR = 6406,
OpGroupLogicalOrKHR = 6407,
OpGroupLogicalXorKHR = 6408,
OpMax = 0x7fffffff,
};
#ifdef SPV_ENABLE_UTILITY_CODE
#ifndef __cplusplus
#include <stdbool.h>
#endif
inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
*hasResult = *hasResultType = false;
switch (opcode) {
@ -2252,12 +2324,16 @@ 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;
case OpSubgroupAllKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAnyKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupAllEqualKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupNonUniformRotateKHR: *hasResult = true; *hasResultType = true; break;
case OpSubgroupReadInvocationKHR: *hasResult = true; *hasResultType = true; break;
case OpTraceRayKHR: *hasResult = false; *hasResultType = false; break;
case OpExecuteCallableKHR: *hasResult = false; *hasResultType = false; break;
@ -2288,10 +2364,43 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpFragmentMaskFetchAMD: *hasResult = true; *hasResultType = true; break;
case OpFragmentFetchAMD: *hasResult = true; *hasResultType = true; break;
case OpReadClockKHR: *hasResult = true; *hasResultType = true; break;
case OpHitObjectRecordHitMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordHitWithIndexMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordMissMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetWorldToObjectNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetObjectToWorldNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetObjectRayDirectionNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetObjectRayOriginNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectTraceRayMotionNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetShaderRecordBufferHandleNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetShaderBindingTableRecordIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectRecordEmptyNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectTraceRayNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordHitNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordHitWithIndexNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectRecordMissNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectExecuteShaderNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetCurrentTimeNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetAttributesNV: *hasResult = false; *hasResultType = false; break;
case OpHitObjectGetHitKindNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetPrimitiveIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetGeometryIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetInstanceIdNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetInstanceCustomIndexNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetWorldRayDirectionNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetWorldRayOriginNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetRayTMaxNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectGetRayTMinNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectIsEmptyNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectIsHitNV: *hasResult = true; *hasResultType = true; break;
case OpHitObjectIsMissNV: *hasResult = true; *hasResultType = true; break;
case OpReorderThreadWithHitObjectNV: *hasResult = false; *hasResultType = false; break;
case OpReorderThreadWithHintNV: *hasResult = false; *hasResultType = false; break;
case OpTypeHitObjectNV: *hasResult = true; *hasResultType = false; break;
case OpImageSampleFootprintNV: *hasResult = true; *hasResultType = true; break;
case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break;
case OpEmitMeshTasksEXT: *hasResult = false; *hasResultType = false; break;
case OpSetMeshOutputsEXT: *hasResult = false; *hasResultType = false; break;
case OpGroupNonUniformPartitionNV: *hasResult = true; *hasResultType = true; break;
case OpWritePackedPrimitiveIndices4x8NV: *hasResult = false; *hasResultType = false; break;
case OpReportIntersectionNV: *hasResult = true; *hasResultType = true; break;
case OpIgnoreIntersectionNV: *hasResult = false; *hasResultType = false; break;
@ -2299,6 +2408,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpTraceNV: *hasResult = false; *hasResultType = false; break;
case OpTraceMotionNV: *hasResult = false; *hasResultType = false; break;
case OpTraceRayMotionNV: *hasResult = false; *hasResultType = false; break;
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: *hasResult = true; *hasResultType = true; break;
case OpTypeAccelerationStructureNV: *hasResult = true; *hasResultType = false; break;
case OpExecuteCallableNV: *hasResult = false; *hasResultType = false; break;
case OpTypeCooperativeMatrixNV: *hasResult = true; *hasResultType = false; break;
@ -2515,6 +2625,9 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break;
case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break;
case OpAliasDomainDeclINTEL: *hasResult = true; *hasResultType = false; break;
case OpAliasScopeDeclINTEL: *hasResult = true; *hasResultType = false; break;
case OpAliasScopeListDeclINTEL: *hasResult = true; *hasResultType = false; break;
case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break;
@ -2553,23 +2666,64 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpTypeStructContinuedINTEL: *hasResult = false; *hasResultType = false; break;
case OpConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break;
case OpSpecConstantCompositeContinuedINTEL: *hasResult = false; *hasResultType = false; break;
case OpControlBarrierArriveINTEL: *hasResult = false; *hasResultType = false; break;
case OpControlBarrierWaitINTEL: *hasResult = false; *hasResultType = false; break;
case OpGroupIMulKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupFMulKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupBitwiseAndKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupBitwiseOrKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupBitwiseXorKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupLogicalAndKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupLogicalOrKHR: *hasResult = true; *hasResultType = true; break;
case OpGroupLogicalXorKHR: *hasResult = true; *hasResultType = true; break;
}
}
#endif /* SPV_ENABLE_UTILITY_CODE */
// Overload operator| for mask bit combining
// Overload bitwise operators for mask bit combining
inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); }
inline ImageOperandsMask operator&(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) & unsigned(b)); }
inline ImageOperandsMask operator^(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) ^ unsigned(b)); }
inline ImageOperandsMask operator~(ImageOperandsMask a) { return ImageOperandsMask(~unsigned(a)); }
inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); }
inline FPFastMathModeMask operator&(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) & unsigned(b)); }
inline FPFastMathModeMask operator^(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) ^ unsigned(b)); }
inline FPFastMathModeMask operator~(FPFastMathModeMask a) { return FPFastMathModeMask(~unsigned(a)); }
inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); }
inline SelectionControlMask operator&(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) & unsigned(b)); }
inline SelectionControlMask operator^(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) ^ unsigned(b)); }
inline SelectionControlMask operator~(SelectionControlMask a) { return SelectionControlMask(~unsigned(a)); }
inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); }
inline LoopControlMask operator&(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) & unsigned(b)); }
inline LoopControlMask operator^(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) ^ unsigned(b)); }
inline LoopControlMask operator~(LoopControlMask a) { return LoopControlMask(~unsigned(a)); }
inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); }
inline FunctionControlMask operator&(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) & unsigned(b)); }
inline FunctionControlMask operator^(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) ^ unsigned(b)); }
inline FunctionControlMask operator~(FunctionControlMask a) { return FunctionControlMask(~unsigned(a)); }
inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); }
inline MemorySemanticsMask operator&(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) & unsigned(b)); }
inline MemorySemanticsMask operator^(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) ^ unsigned(b)); }
inline MemorySemanticsMask operator~(MemorySemanticsMask a) { return MemorySemanticsMask(~unsigned(a)); }
inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); }
inline MemoryAccessMask operator&(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) & unsigned(b)); }
inline MemoryAccessMask operator^(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) ^ unsigned(b)); }
inline MemoryAccessMask operator~(MemoryAccessMask a) { return MemoryAccessMask(~unsigned(a)); }
inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); }
inline KernelProfilingInfoMask operator&(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) & unsigned(b)); }
inline KernelProfilingInfoMask operator^(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) ^ unsigned(b)); }
inline KernelProfilingInfoMask operator~(KernelProfilingInfoMask a) { return KernelProfilingInfoMask(~unsigned(a)); }
inline RayFlagsMask operator|(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) | unsigned(b)); }
inline RayFlagsMask operator&(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) & unsigned(b)); }
inline RayFlagsMask operator^(RayFlagsMask a, RayFlagsMask b) { return RayFlagsMask(unsigned(a) ^ unsigned(b)); }
inline RayFlagsMask operator~(RayFlagsMask a) { return RayFlagsMask(~unsigned(a)); }
inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) | unsigned(b)); }
inline FragmentShadingRateMask operator&(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) & unsigned(b)); }
inline FragmentShadingRateMask operator^(FragmentShadingRateMask a, FragmentShadingRateMask b) { return FragmentShadingRateMask(unsigned(a) ^ unsigned(b)); }
inline FragmentShadingRateMask operator~(FragmentShadingRateMask a) { return FragmentShadingRateMask(~unsigned(a)); }
} // end namespace spv
#endif // #ifndef spirv_HPP

View File

@ -352,13 +352,11 @@ int main(int argc, char** argv)
int opts;
int verbosity;
#ifdef use_cpp11
// handle errors by exiting
spv::spirvbin_t::registerErrorHandler(errHandler);
// Log messages to std::cout
spv::spirvbin_t::registerLogHandler(logHandler);
#endif
if (argc < 2)
usage(argv[0]);

View File

@ -80,25 +80,6 @@ typedef struct glslang_program_s {
(CallbackIncluder::callbacks::free_include_result)
*/
class CallbackIncluder : public glslang::TShader::Includer {
public:
/* Wrapper of IncludeResult which stores a glsl_include_result object internally */
class CallbackIncludeResult : public glslang::TShader::Includer::IncludeResult {
public:
CallbackIncludeResult(const std::string& headerName, const char* const headerData, const size_t headerLength,
void* userData, glsl_include_result_t* includeResult)
: glslang::TShader::Includer::IncludeResult(headerName, headerData, headerLength, userData),
includeResult(includeResult)
{
}
virtual ~CallbackIncludeResult() {}
protected:
friend class CallbackIncluder;
glsl_include_result_t* includeResult;
};
public:
CallbackIncluder(glsl_include_callbacks_t _callbacks, void* _context) : callbacks(_callbacks), context(_context) {}
@ -110,9 +91,7 @@ public:
if (this->callbacks.include_system) {
glsl_include_result_t* result =
this->callbacks.include_system(this->context, headerName, includerName, inclusionDepth);
return new CallbackIncludeResult(std::string(headerName), result->header_data, result->header_length,
nullptr, result);
return makeIncludeResult(result);
}
return glslang::TShader::Includer::includeSystem(headerName, includerName, inclusionDepth);
@ -124,9 +103,7 @@ public:
if (this->callbacks.include_local) {
glsl_include_result_t* result =
this->callbacks.include_local(this->context, headerName, includerName, inclusionDepth);
return new CallbackIncludeResult(std::string(headerName), result->header_data, result->header_length,
nullptr, result);
return makeIncludeResult(result);
}
return glslang::TShader::Includer::includeLocal(headerName, includerName, inclusionDepth);
@ -139,22 +116,25 @@ public:
if (result == nullptr)
return;
if (this->callbacks.free_include_result && (result->userData == nullptr)) {
CallbackIncludeResult* innerResult = static_cast<CallbackIncludeResult*>(result);
/* use internal free() function */
this->callbacks.free_include_result(this->context, innerResult->includeResult);
/* ignore internal fields of TShader::Includer::IncludeResult */
delete result;
return;
if (this->callbacks.free_include_result) {
this->callbacks.free_include_result(this->context, static_cast<glsl_include_result_t*>(result->userData));
}
delete[] static_cast<char*>(result->userData);
delete result;
}
private:
CallbackIncluder() {}
IncludeResult* makeIncludeResult(glsl_include_result_t* result) {
if (!result) {
return nullptr;
}
return new glslang::TShader::Includer::IncludeResult(
std::string(result->header_name), result->header_data, result->header_length, result);
}
/* C callback pointers */
glsl_include_callbacks_t callbacks;
/* User-defined context */
@ -394,8 +374,11 @@ GLSLANG_EXPORT const char* glslang_shader_get_preprocessed_code(glslang_shader_t
GLSLANG_EXPORT int glslang_shader_preprocess(glslang_shader_t* shader, const glslang_input_t* input)
{
DirStackFileIncluder Includer;
/* TODO: use custom callbacks if they are available in 'i->callbacks' */
DirStackFileIncluder dirStackFileIncluder;
CallbackIncluder callbackIncluder(input->callbacks, input->callbacks_ctx);
glslang::TShader::Includer& Includer = (input->callbacks.include_local||input->callbacks.include_system)
? static_cast<glslang::TShader::Includer&>(callbackIncluder)
: static_cast<glslang::TShader::Includer&>(dirStackFileIncluder);
return shader->shader->preprocess(
reinterpret_cast<const TBuiltInResource*>(input->resource),
input->default_version,

View File

@ -36,6 +36,7 @@
#ifndef HLSLATTRIBUTES_H_
#define HLSLATTRIBUTES_H_
#include <cstdint>
#include <unordered_map>
#include <functional>

4
3rdparty/glslang/glslang/Include/BaseTypes.h vendored Normal file → Executable file
View File

@ -134,6 +134,8 @@ enum TStorageQualifier {
EvqFragDepth,
EvqFragStencil,
EvqTileImageEXT,
// end of list
EvqLast
};
@ -325,6 +327,8 @@ enum TBuiltInVariable {
EbvWarpIDARM,
EbvWarpMaxIDARM,
EbvPositionFetch,
EbvLast
};

View File

@ -56,6 +56,7 @@
#include <vector>
#if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700)
#include <sstream>
namespace std {
template<typename T>

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

@ -168,23 +168,6 @@ typedef struct glslang_resource_s {
glslang_limits_t limits;
} glslang_resource_t;
typedef struct glslang_input_s {
glslang_source_t language;
glslang_stage_t stage;
glslang_client_t client;
glslang_target_client_version_t client_version;
glslang_target_language_t target_language;
glslang_target_language_version_t target_language_version;
/** Shader source code */
const char* code;
int default_version;
glslang_profile_t default_profile;
int force_default_version_and_profile;
int forward_compatible;
glslang_messages_t messages;
const glslang_resource_t* resource;
} glslang_input_t;
/* Inclusion result structure allocated by C include_local/include_system callbacks */
typedef struct glsl_include_result_s {
/* Header file name or NULL if inclusion failed */
@ -214,6 +197,25 @@ typedef struct glsl_include_callbacks_s {
glsl_free_include_result_func free_include_result;
} glsl_include_callbacks_t;
typedef struct glslang_input_s {
glslang_source_t language;
glslang_stage_t stage;
glslang_client_t client;
glslang_target_client_version_t client_version;
glslang_target_language_t target_language;
glslang_target_language_version_t target_language_version;
/** Shader source code */
const char* code;
int default_version;
glslang_profile_t default_profile;
int force_default_version_and_profile;
int forward_compatible;
glslang_messages_t messages;
const glslang_resource_t* resource;
glsl_include_callbacks_t callbacks;
void* callbacks_ctx;
} glslang_input_t;
/* SpvOptions counterpart */
typedef struct glslang_spv_options_s {
bool generate_debug_info;

View File

@ -827,6 +827,7 @@ enum TOperator {
EOpSubpassLoadMS,
EOpSparseImageLoad,
EOpSparseImageLoadLod,
EOpColorAttachmentReadEXT, // Fragment only
EOpImageGuardEnd,
@ -1090,6 +1091,13 @@ enum TOperator {
// Shader Clock Ops
EOpReadClockSubgroupKHR,
EOpReadClockDeviceKHR,
// GL_EXT_ray_tracing_position_fetch
EOpRayQueryGetIntersectionTriangleVertexPositionsEXT,
// Shader tile image ops
EOpStencilAttachmentReadEXT, // Fragment only
EOpDepthAttachmentReadEXT, // Fragment only
};
class TIntermTraverser;
@ -1393,6 +1401,7 @@ struct TCrackedTextureOp {
bool subpass;
bool lodClamp;
bool fragMask;
bool attachmentEXT;
};
//
@ -1449,6 +1458,7 @@ public:
cracked.gather = false;
cracked.grad = false;
cracked.subpass = false;
cracked.attachmentEXT = false;
cracked.lodClamp = false;
cracked.fragMask = false;
@ -1609,6 +1619,9 @@ public:
case EOpSubpassLoadMS:
cracked.subpass = true;
break;
case EOpColorAttachmentReadEXT:
cracked.attachmentEXT = true;
break;
#endif
default:
break;

40
3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp vendored Normal file → Executable file
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);
@ -4551,7 +4570,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
// Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query/
// GL_NV_shader_invocation_reorder
// GL_NV_shader_invocation_reorder/GL_KHR_ray_tracing_position_Fetch
if (profile != EEsProfile && version >= 460) {
commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);"
"void rayQueryTerminateEXT(rayQueryEXT);"
@ -4576,6 +4595,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);"
"mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);"
"mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);"
"void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);"
"\n");
stageBuiltins[EShLangRayGen].append(
@ -6018,6 +6038,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in uint gl_IncomingRayFlagsEXT;"
"in float gl_CurrentRayTimeNV;"
"in uint gl_CullMaskEXT;"
"in vec3 gl_HitTriangleVertexPositionsEXT[3];"
"\n";
const char *missDecls =
"in uvec3 gl_LaunchIDNV;"
@ -6199,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))
@ -6244,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) {
@ -8235,6 +8260,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("rayQueryGetIntersectionWorldToObjectEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetWorldRayOriginEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);
symbolTable.setVariableExtensions("gl_RayFlagsSkipAABBEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);
symbolTable.setVariableExtensions("gl_RayFlagsSkipTrianglesEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);
symbolTable.setVariableExtensions("gl_RayFlagsForceOpacityMicromap2StateEXT", 1, &E_GL_EXT_opacity_micromap);
@ -8729,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;
@ -8932,6 +8963,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing);
symbolTable.setVariableExtensions("gl_IncomingRayFlagsEXT", 1, &E_GL_EXT_ray_tracing);
symbolTable.setVariableExtensions("gl_CurrentRayTimeNV", 1, &E_GL_NV_ray_tracing_motion_blur);
symbolTable.setVariableExtensions("gl_HitTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
@ -9015,6 +9047,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_IncomingRayFlagsEXT", EbvIncomingRayFlags, symbolTable);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable);
BuiltInVariable("gl_HitTriangleVertexPositionsEXT", EbvPositionFetch, symbolTable);
// GL_ARB_shader_ballot
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
@ -9939,6 +9972,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("rayQueryGetWorldRayOriginEXT", EOpRayQueryGetWorldRayOrigin);
symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld);
symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject);
symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT);
}
symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);
@ -9951,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

@ -2467,6 +2467,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
case EOpRayQueryGetIntersectionObjectRayOrigin:
case EOpRayQueryGetIntersectionObjectToWorld:
case EOpRayQueryGetIntersectionWorldToObject:
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "committed", "");
break;
@ -3811,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());
}
}
@ -5172,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:
@ -5779,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");
@ -6473,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", "");
@ -6486,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;
@ -6495,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
@ -6582,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", "");
}
}
@ -6644,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 {
@ -6811,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", "");
}
@ -6850,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", "");
@ -9459,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

@ -354,6 +354,8 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable;
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;
@ -522,6 +524,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_ray_query 1\n"
"#define GL_EXT_ray_flags_primitive_culling 1\n"
"#define GL_EXT_ray_cull_mask 1\n"
"#define GL_EXT_ray_tracing_position_fetch 1\n"
"#define GL_EXT_spirv_intrinsics 1\n"
"#define GL_EXT_mesh_shader 1\n"

3
3rdparty/glslang/glslang/MachineIndependent/Versions.h vendored Normal file → Executable file
View File

@ -265,6 +265,7 @@ const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragmen
const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives";
const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint";
const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader";
const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch";
// ARM
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins";
@ -327,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;
@ -1097,6 +1101,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpRayQueryGetWorldRayOrigin: out.debug << "rayQueryGetWorldRayOriginEXT"; break;
case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break;
case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break;
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: out.debug << "rayQueryGetIntersectionTriangleVertexPositionsEXT"; break;
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
case EOpCooperativeMatrixStore: out.debug << "Store cooperative matrix"; break;
@ -1140,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");
}
@ -1544,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

@ -321,7 +321,12 @@ public:
inputPrimitive(ElgNone), outputPrimitive(ElgNone),
pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false),
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false), depthLayout(EldNone), stencilLayout(ElsNone),
postDepthCoverage(false), earlyAndLateFragmentTestsAMD(false),
nonCoherentColorAttachmentReadEXT(false),
nonCoherentDepthAttachmentReadEXT(false),
nonCoherentStencilAttachmentReadEXT(false),
depthLayout(EldNone),
stencilLayout(ElsNone),
hlslFunctionality1(false),
blendEquations(0), xfbMode(false), multiStream(false),
layoutOverrideCoverage(false),
@ -638,6 +643,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 +902,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 +1229,9 @@ protected:
bool earlyFragmentTests;
bool postDepthCoverage;
bool earlyAndLateFragmentTestsAMD;
bool nonCoherentColorAttachmentReadEXT;
bool nonCoherentDepthAttachmentReadEXT;
bool nonCoherentStencilAttachmentReadEXT;
TLayoutDepth depthLayout;
TLayoutStencil stencilLayout;
bool hlslFunctionality1;

View File

@ -85,9 +85,6 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
#define snprintf sprintf_s
#endif
#include <cassert>
#include <cstdlib>