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_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_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_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"; static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
#endif // #ifndef GLSLextEXT_H #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_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_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_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 #endif // #ifndef GLSLextKHR_H

120
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::EsdRect: return spv::DimRect;
case glslang::EsdBuffer: return spv::DimBuffer; case glslang::EsdBuffer: return spv::DimBuffer;
case glslang::EsdSubpass: return spv::DimSubpassData; case glslang::EsdSubpass: return spv::DimSubpassData;
case glslang::EsdAttachmentEXT: return spv::DimTileImageDataEXT;
default: default:
assert(0); assert(0);
return spv::Dim2D; return spv::Dim2D;
@ -1010,6 +1011,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInRayTmaxKHR; return spv::BuiltInRayTmaxKHR;
case glslang::EbvCullMask: case glslang::EbvCullMask:
return spv::BuiltInCullMaskKHR; return spv::BuiltInCullMaskKHR;
case glslang::EbvPositionFetch:
return spv::BuiltInHitTriangleVertexPositionsKHR;
case glslang::EbvInstanceCustomIndex: case glslang::EbvInstanceCustomIndex:
return spv::BuiltInInstanceCustomIndexKHR; return spv::BuiltInInstanceCustomIndexKHR;
case glslang::EbvHitT: case glslang::EbvHitT:
@ -1309,6 +1312,11 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T
return spv::StorageClassInput; return spv::StorageClassInput;
if (type.getQualifier().isPipeOutput()) if (type.getQualifier().isPipeOutput())
return spv::StorageClassOutput; 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 || if (glslangIntermediate->getSource() != glslang::EShSourceHlsl ||
type.getQualifier().storage == glslang::EvqUniform) { type.getQualifier().storage == glslang::EvqUniform) {
@ -1680,6 +1688,24 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder.addExtension(spv::E_SPV_KHR_post_depth_coverage); 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()) if (glslangIntermediate->isDepthReplacing())
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDepthReplacing); builder.addExecutionMode(shaderEntry, spv::ExecutionModeDepthReplacing);
@ -1857,13 +1883,16 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
builder.addCapability(spv::CapabilityRayTracingNV); builder.addCapability(spv::CapabilityRayTracingNV);
builder.addExtension("SPV_NV_ray_tracing"); 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()) {
if (extensions.find("GL_EXT_ray_cull_mask") != extensions.end()) { builder.addCapability(spv::CapabilityRayCullMaskKHR);
builder.addCapability(spv::CapabilityRayCullMaskKHR); builder.addExtension("SPV_KHR_ray_cull_mask");
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; break;
} }
case EShLangTask: case EShLangTask:
@ -3301,6 +3330,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder); builder.addExtension(spv::E_SPV_NV_shader_invocation_reorder);
builder.addCapability(spv::CapabilityShaderInvocationReorderNV); builder.addCapability(spv::CapabilityShaderInvocationReorderNV);
break; break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
builder.addExtension(spv::E_SPV_KHR_ray_tracing_position_fetch);
builder.addCapability(spv::CapabilityRayQueryPositionFetchKHR);
noReturnValue = true;
break;
#endif #endif
case glslang::EOpDebugPrintf: case glslang::EOpDebugPrintf:
@ -3479,6 +3513,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
if (arg == 0 && glslangOperands.size() != 2) if (arg == 0 && glslangOperands.size() != 2)
lvalue = true; lvalue = true;
break; break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (arg == 0 || arg == 2)
lvalue = true;
break;
#endif #endif
default: default:
break; break;
@ -3571,7 +3609,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayDirection || glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayDirection ||
glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayOrigin || glslangOp == glslang::EOpRayQueryGetIntersectionObjectRayOrigin ||
glslangOp == glslang::EOpRayQueryGetIntersectionObjectToWorld || glslangOp == glslang::EOpRayQueryGetIntersectionObjectToWorld ||
glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject glslangOp == glslang::EOpRayQueryGetIntersectionWorldToObject ||
glslangOp == glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT
)) { )) {
bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst(); bool cond = glslangOperands[arg]->getAsConstantUnion()->getConstArray()[0].getBConst();
operands.push_back(builder.makeIntConstant(cond ? 1 : 0)); 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); builder.createNoResultOp(spv::OpCooperativeMatrixStoreNV, idImmOps);
result = 0; 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 } else
#endif #endif
if (atomic) { if (atomic) {
@ -5561,6 +5613,10 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate&
if (i == 7) if (i == 7)
lvalue = true; lvalue = true;
break; break;
case glslang::EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (i == 2)
lvalue = true;
break;
default: default:
break; break;
} }
@ -5720,6 +5776,17 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
return result; 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++) }; spv::IdImmediate coord = { true, *(opIt++) };
operands.push_back(coord); operands.push_back(coord);
if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) { if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) {
@ -7140,6 +7207,19 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDe
unaryOp = spv::OpCopyObject; unaryOp = spv::OpCopyObject;
break; 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: default:
return 0; return 0;
} }
@ -9230,6 +9310,30 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv:
return builder.createOp(spv::OpReadClockKHR, typeId, args); return builder.createOp(spv::OpReadClockKHR, typeId, args);
} }
#endif #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: default:
break; break;
} }

View File

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

View File

@ -43,12 +43,6 @@
namespace spv { 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 class spirvbin_base_t
{ {
public: public:
@ -74,27 +68,6 @@ public:
} // namespace SPV } // 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 <functional>
#include <cstdint> #include <cstdint>
#include <unordered_map> #include <unordered_map>
@ -308,5 +281,4 @@ private:
} // namespace SPV } // namespace SPV
#endif // defined (use_cpp11)
#endif // SPIRVREMAPPER_H #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 ExecutionModeNoGlobalOffsetINTEL: return "NoGlobalOffsetINTEL";
case ExecutionModeNumSIMDWorkitemsINTEL: return "NumSIMDWorkitemsINTEL"; case ExecutionModeNumSIMDWorkitemsINTEL: return "NumSIMDWorkitemsINTEL";
case ExecutionModeNonCoherentColorAttachmentReadEXT: return "NonCoherentColorAttachmentReadEXT";
case ExecutionModeNonCoherentDepthAttachmentReadEXT: return "NonCoherentDepthAttachmentReadEXT";
case ExecutionModeNonCoherentStencilAttachmentReadEXT: return "NonCoherentStencilAttachmentReadEXT";
case ExecutionModeCeiling: case ExecutionModeCeiling:
default: return "Bad"; default: return "Bad";
} }
@ -247,6 +251,7 @@ const char* StorageClassString(int StorageClass)
case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT"; case StorageClassPhysicalStorageBufferEXT: return "PhysicalStorageBufferEXT";
case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT"; case StorageClassTaskPayloadWorkgroupEXT: return "TaskPayloadWorkgroupEXT";
case StorageClassHitObjectAttributeNV: return "HitObjectAttributeNV"; case StorageClassHitObjectAttributeNV: return "HitObjectAttributeNV";
case StorageClassTileImageEXT: return "TileImageEXT";
default: return "Bad"; default: return "Bad";
} }
} }
@ -404,6 +409,7 @@ const char* BuiltInString(int builtIn)
case BuiltInRayTminKHR: return "RayTminKHR"; case BuiltInRayTminKHR: return "RayTminKHR";
case BuiltInRayTmaxKHR: return "RayTmaxKHR"; case BuiltInRayTmaxKHR: return "RayTmaxKHR";
case BuiltInCullMaskKHR: return "CullMaskKHR"; case BuiltInCullMaskKHR: return "CullMaskKHR";
case BuiltInHitTriangleVertexPositionsKHR: return "HitTriangleVertexPositionsKHR";
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR"; case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR"; case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR"; case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
@ -463,6 +469,7 @@ const char* DimensionString(int dim)
case 4: return "Rect"; case 4: return "Rect";
case 5: return "Buffer"; case 5: return "Buffer";
case 6: return "SubpassData"; case 6: return "SubpassData";
case DimTileImageDataEXT: return "TileImageDataEXT";
default: return "Bad"; default: return "Bad";
} }
@ -950,6 +957,8 @@ const char* CapabilityString(int info)
case CapabilityRayQueryKHR: return "RayQueryKHR"; case CapabilityRayQueryKHR: return "RayQueryKHR";
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR"; case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR"; case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
case CapabilityRayTracingPositionFetchKHR: return "RayTracingPositionFetchKHR";
case CapabilityRayQueryPositionFetchKHR: return "RayQueryPositionFetchKHR";
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV"; case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV"; case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR"; case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR";
@ -989,6 +998,10 @@ const char* CapabilityString(int info)
case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT"; case CapabilityFragmentShaderPixelInterlockEXT: return "CapabilityFragmentShaderPixelInterlockEXT";
case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT"; case CapabilityFragmentShaderShadingRateInterlockEXT: return "CapabilityFragmentShaderShadingRateInterlockEXT";
case CapabilityTileImageColorReadAccessEXT: return "TileImageColorReadAccessEXT";
case CapabilityTileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT";
case CapabilityTileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT";
case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR"; case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR";
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT"; case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";
@ -1452,6 +1465,7 @@ const char* OpcodeString(int op)
case OpRayQueryGetWorldRayOriginKHR: return "OpRayQueryGetWorldRayOriginKHR"; case OpRayQueryGetWorldRayOriginKHR: return "OpRayQueryGetWorldRayOriginKHR";
case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR"; case OpRayQueryGetIntersectionObjectToWorldKHR: return "OpRayQueryGetIntersectionObjectToWorldKHR";
case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR"; case OpRayQueryGetIntersectionWorldToObjectKHR: return "OpRayQueryGetIntersectionWorldToObjectKHR";
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR: return "OpRayQueryGetIntersectionTriangleVertexPositionsKHR";
case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV"; case OpTypeCooperativeMatrixNV: return "OpTypeCooperativeMatrixNV";
case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV"; case OpCooperativeMatrixLoadNV: return "OpCooperativeMatrixLoadNV";
@ -1498,6 +1512,10 @@ const char* OpcodeString(int op)
case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV"; case OpHitObjectGetShaderBindingTableRecordIndexNV: return "OpHitObjectGetShaderBindingTableRecordIndexNV";
case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV"; case OpHitObjectGetShaderRecordBufferHandleNV: return "OpHitObjectGetShaderRecordBufferHandleNV";
case OpColorAttachmentReadEXT: return "OpColorAttachmentReadEXT";
case OpDepthAttachmentReadEXT: return "OpDepthAttachmentReadEXT";
case OpStencilAttachmentReadEXT: return "OpStencilAttachmentReadEXT";
default: default:
return "Bad"; return "Bad";
} }
@ -3025,6 +3043,10 @@ void Parameterize()
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'"); InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].operands.push(OperandId, "'Committed'");
InstructionDesc[OpRayQueryGetIntersectionWorldToObjectKHR].setResultAndType(true, true); 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, "'Sampled Image'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'");
InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'"); InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'");
@ -3260,6 +3282,11 @@ void Parameterize()
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Time'"); InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Time'");
InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Payload'"); InstructionDesc[OpHitObjectTraceRayMotionNV].operands.push(OperandId, "'Payload'");
InstructionDesc[OpHitObjectTraceRayMotionNV].setResultAndType(false, false); 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 }; // end spv namespace

View File

@ -23,19 +23,6 @@
#include <limits> #include <limits>
#include <sstream> #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" #include "bitutils.h"
namespace spvutils { namespace spvutils {

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

@ -168,23 +168,6 @@ typedef struct glslang_resource_s {
glslang_limits_t limits; glslang_limits_t limits;
} glslang_resource_t; } 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 */ /* Inclusion result structure allocated by C include_local/include_system callbacks */
typedef struct glsl_include_result_s { typedef struct glsl_include_result_s {
/* Header file name or NULL if inclusion failed */ /* 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_free_include_result_func free_include_result;
} glsl_include_callbacks_t; } 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 */ /* SpvOptions counterpart */
typedef struct glslang_spv_options_s { typedef struct glslang_spv_options_s {
bool generate_debug_info; bool generate_debug_info;

View File

@ -827,6 +827,7 @@ enum TOperator {
EOpSubpassLoadMS, EOpSubpassLoadMS,
EOpSparseImageLoad, EOpSparseImageLoad,
EOpSparseImageLoadLod, EOpSparseImageLoadLod,
EOpColorAttachmentReadEXT, // Fragment only
EOpImageGuardEnd, EOpImageGuardEnd,
@ -1090,6 +1091,13 @@ enum TOperator {
// Shader Clock Ops // Shader Clock Ops
EOpReadClockSubgroupKHR, EOpReadClockSubgroupKHR,
EOpReadClockDeviceKHR, EOpReadClockDeviceKHR,
// GL_EXT_ray_tracing_position_fetch
EOpRayQueryGetIntersectionTriangleVertexPositionsEXT,
// Shader tile image ops
EOpStencilAttachmentReadEXT, // Fragment only
EOpDepthAttachmentReadEXT, // Fragment only
}; };
class TIntermTraverser; class TIntermTraverser;
@ -1393,6 +1401,7 @@ struct TCrackedTextureOp {
bool subpass; bool subpass;
bool lodClamp; bool lodClamp;
bool fragMask; bool fragMask;
bool attachmentEXT;
}; };
// //
@ -1449,6 +1458,7 @@ public:
cracked.gather = false; cracked.gather = false;
cracked.grad = false; cracked.grad = false;
cracked.subpass = false; cracked.subpass = false;
cracked.attachmentEXT = false;
cracked.lodClamp = false; cracked.lodClamp = false;
cracked.fragMask = false; cracked.fragMask = false;
@ -1609,6 +1619,9 @@ public:
case EOpSubpassLoadMS: case EOpSubpassLoadMS:
cracked.subpass = true; cracked.subpass = true;
break; break;
case EOpColorAttachmentReadEXT:
cracked.attachmentEXT = true;
break;
#endif #endif
default: default:
break; 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[EsdRect] = 2;
dimMap[EsdBuffer] = 1; dimMap[EsdBuffer] = 1;
dimMap[EsdSubpass] = 2; // potentially unused for now dimMap[EsdSubpass] = 2; // potentially unused for now
dimMap[EsdAttachmentEXT] = 2; // potentially unused for now
#endif #endif
} }
@ -4440,6 +4441,24 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n"); "\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 // GL_ARB_derivative_control
if (profile != EEsProfile && version >= 400) { if (profile != EEsProfile && version >= 400) {
stageBuiltins[EShLangFragment].append(derivativeControls); 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/ // 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) { if (profile != EEsProfile && version >= 460) {
commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);" commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);"
"void rayQueryTerminateEXT(rayQueryEXT);" "void rayQueryTerminateEXT(rayQueryEXT);"
@ -4576,6 +4595,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);" "vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);"
"mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);" "mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);"
"mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);" "mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);"
"void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);"
"\n"); "\n");
stageBuiltins[EShLangRayGen].append( stageBuiltins[EShLangRayGen].append(
@ -6018,6 +6038,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in uint gl_IncomingRayFlagsEXT;" "in uint gl_IncomingRayFlagsEXT;"
"in float gl_CurrentRayTimeNV;" "in float gl_CurrentRayTimeNV;"
"in uint gl_CullMaskEXT;" "in uint gl_CullMaskEXT;"
"in vec3 gl_HitTriangleVertexPositionsEXT[3];"
"\n"; "\n";
const char *missDecls = const char *missDecls =
"in uvec3 gl_LaunchIDNV;" "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 for (int dim = Esd2D; dim <= EsdCube; ++dim) { // 2D, 3D, and Cube
#else #else
for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass
if (dim == EsdAttachmentEXT)
continue;
if (dim == EsdSubpass && spvVersion.vulkan == 0) if (dim == EsdSubpass && spvVersion.vulkan == 0)
continue; continue;
if (dim == EsdSubpass && (image || shadow || arrayed)) if (dim == EsdSubpass && (image || shadow || arrayed))
@ -6244,6 +6267,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
#ifndef GLSLANG_WEB #ifndef GLSLANG_WEB
if (dim == EsdSubpass) { if (dim == EsdSubpass) {
sampler.setSubpass(bTypes[bType], ms ? true : false); sampler.setSubpass(bTypes[bType], ms ? true : false);
} else if (dim == EsdAttachmentEXT) {
sampler.setAttachmentEXT(bTypes[bType]);
} else } else
#endif #endif
if (image) { 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("rayQueryGetIntersectionWorldToObjectEXT", 1, &E_GL_EXT_ray_query);
symbolTable.setFunctionExtensions("rayQueryGetWorldRayOriginEXT", 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("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_RayFlagsSkipAABBEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);
symbolTable.setVariableExtensions("gl_RayFlagsSkipTrianglesEXT", 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); 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_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 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 #endif // !GLSLANG_WEB
break; 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_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing);
symbolTable.setVariableExtensions("gl_IncomingRayFlagsEXT", 1, &E_GL_EXT_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_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); 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_IncomingRayFlagsEXT", EbvIncomingRayFlags, symbolTable);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable); BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable);
BuiltInVariable("gl_HitTriangleVertexPositionsEXT", EbvPositionFetch, symbolTable);
// GL_ARB_shader_ballot // GL_ARB_shader_ballot
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_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("rayQueryGetWorldRayOriginEXT", EOpRayQueryGetWorldRayOrigin);
symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld); symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld);
symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject); symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject);
symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT);
} }
symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid); symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);
@ -9951,6 +9985,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock); symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock);
symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock); symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock);
symbolTable.relateToOperator("stencilAttachmentReadEXT", EOpStencilAttachmentReadEXT);
symbolTable.relateToOperator("depthAttachmentReadEXT", EOpDepthAttachmentReadEXT);
symbolTable.relateToOperator("colorAttachmentReadEXT", EOpColorAttachmentReadEXT);
break; break;
case EShLangCompute: case EShLangCompute:

View File

@ -2467,6 +2467,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
case EOpRayQueryGetIntersectionObjectRayOrigin: case EOpRayQueryGetIntersectionObjectRayOrigin:
case EOpRayQueryGetIntersectionObjectToWorld: case EOpRayQueryGetIntersectionObjectToWorld:
case EOpRayQueryGetIntersectionWorldToObject: case EOpRayQueryGetIntersectionWorldToObject:
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT:
if (!(*argp)[1]->getAsConstantUnion()) if (!(*argp)[1]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "committed", ""); error(loc, "argument must be compile-time constant", "committed", "");
break; break;
@ -3811,7 +3812,10 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const
// non-uniform sampler // non-uniform sampler
// not yet: okay if it has an initializer // not yet: okay if it has an initializer
// if (! initializer) // if (! initializer)
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); if (type.getSampler().isAttachmentEXT() && type.getQualifier().storage != EvqTileImageEXT)
error(loc, "can only be used in tileImageEXT variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
else if (type.getQualifier().storage != EvqTileImageEXT)
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
} }
} }
} }
@ -5172,6 +5176,7 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu
case EvqIn: case EvqIn:
case EvqOut: case EvqOut:
case EvqInOut: case EvqInOut:
case EvqTileImageEXT:
type.getQualifier().storage = qualifier; type.getQualifier().storage = qualifier;
break; break;
case EvqGlobal: case EvqGlobal:
@ -5779,6 +5784,22 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType.shaderQualifiers.postDepthCoverage = true; publicType.shaderQualifiers.postDepthCoverage = true;
return; 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)) { for (TLayoutDepth depth = (TLayoutDepth)(EldNone + 1); depth < EldCount; depth = (TLayoutDepth)(depth+1)) {
if (id == TQualifier::getLayoutDepthString(depth)) { if (id == TQualifier::getLayoutDepthString(depth)) {
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier"); requireProfile(loc, ECoreProfile | ECompatibilityProfile, "depth layout qualifier");
@ -6473,6 +6494,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqBuffer: case EvqBuffer:
if (type.getBasicType() == EbtBlock) if (type.getBasicType() == EbtBlock)
error(loc, "cannot apply to uniform or buffer block", "location", ""); 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; break;
case EvqtaskPayloadSharedEXT: case EvqtaskPayloadSharedEXT:
error(loc, "cannot apply to taskPayloadSharedEXT", "location", ""); error(loc, "cannot apply to taskPayloadSharedEXT", "location", "");
@ -6486,6 +6509,8 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqHitObjectAttrNV: case EvqHitObjectAttrNV:
break; break;
#endif #endif
case EvqTileImageEXT:
break;
default: default:
error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", ""); error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", "");
break; break;
@ -6495,10 +6520,10 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision); int repeated = intermediate.addUsedLocation(qualifier, type, typeCollision);
if (repeated >= 0 && ! typeCollision) if (repeated >= 0 && ! typeCollision)
error(loc, "overlapping use of location", "location", "%d", repeated); 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)" // location, they must have the same underlying type (floating-point or integer)"
if (typeCollision && language == EShLangFragment && qualifier.isPipeOutput()) if (typeCollision && language == EShLangFragment && (qualifier.isPipeOutput() || qualifier.storage == EvqTileImageEXT))
error(loc, "fragment outputs sharing the same location must be the same basic type", "location", "%d", repeated); error(loc, "fragment outputs or tileImageEXTs sharing the same location", "location", "%d must be the same basic type", repeated);
} }
#ifndef GLSLANG_WEB #ifndef GLSLANG_WEB
@ -6582,7 +6607,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
!qualifier.hasAttachment() && !qualifier.hasAttachment() &&
!qualifier.hasBufferReference()) !qualifier.hasBufferReference())
error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", ""); 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", ""); 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 // input attachment
if (type.isSubpass()) { 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()) if (! qualifier.hasAttachment())
error(loc, "requires an input_attachment_index layout qualifier", "subpass", ""); error(loc, "requires an input_attachment_index layout qualifier", "subpass", "");
} else { } else {
@ -6811,6 +6838,14 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
error(loc, "cannot be used with shaderRecordNV", "set", ""); 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()) { if (qualifier.storage == EvqHitAttr && qualifier.hasLayout()) {
error(loc, "cannot apply layout qualifiers to hitAttributeNV variable", "hitAttributeNV", ""); 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", ""); error(loc, message, "early_fragment_tests", "");
if (shaderQualifiers.postDepthCoverage) if (shaderQualifiers.postDepthCoverage)
error(loc, message, "post_depth_coverage", ""); 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 (shaderQualifiers.primitives != TQualifier::layoutNotSet) {
if (language == EShLangMesh) if (language == EShLangMesh)
error(loc, message, "max_primitives", ""); error(loc, message, "max_primitives", "");
@ -9459,6 +9500,24 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
else else
error(loc, "can only apply to 'in'", "post_coverage_coverage", ""); 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.shaderQualifiers.hasBlendEquation()) {
if (publicType.qualifier.storage != EvqVaryingOut) if (publicType.qualifier.storage != EvqVaryingOut)
error(loc, "can only apply to 'out'", "blend equation", ""); error(loc, "can only apply to 'out'", "blend equation", "");

View File

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

View File

@ -354,6 +354,8 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable; extensionBehavior[E_GL_EXT_spirv_intrinsics] = EBhDisable;
extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable; extensionBehavior[E_GL_EXT_mesh_shader] = EBhDisable;
extensionBehavior[E_GL_EXT_opacity_micromap] = 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 // OVR extensions
extensionBehavior[E_GL_OVR_multiview] = EBhDisable; 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_query 1\n"
"#define GL_EXT_ray_flags_primitive_culling 1\n" "#define GL_EXT_ray_flags_primitive_culling 1\n"
"#define GL_EXT_ray_cull_mask 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_spirv_intrinsics 1\n"
"#define GL_EXT_mesh_shader 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_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_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_NV_mesh_shader = "GL_NV_mesh_shader";
const char* const E_GL_EXT_ray_tracing_position_fetch = "GL_EXT_ray_tracing_position_fetch";
// ARM // ARM
const char* const E_GL_ARM_shader_core_builtins = "GL_ARM_shader_core_builtins"; 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_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_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 // Arrays of extensions for the above AEP duplications
const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; 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_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
%token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING %token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL %token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
%token <lex> ATTACHMENTEXT IATTACHMENTEXT UATTACHMENTEXT
GLSLANG_WEB_EXCLUDE_OFF 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> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> TERMINATE_INVOCATION %token <lex> TERMINATE_INVOCATION
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION %token <lex> TERMINATE_RAY IGNORE_INTERSECTION
%token <lex> UNIFORM SHARED BUFFER %token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT
%token <lex> FLAT SMOOTH LAYOUT %token <lex> FLAT SMOOTH LAYOUT
GLSLANG_WEB_EXCLUDE_ON GLSLANG_WEB_EXCLUDE_ON
@ -1476,6 +1477,11 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqUniform; $$.qualifier.storage = EvqUniform;
} }
| TILEIMAGEEXT {
parseContext.globalCheck($1.loc, "tileImageEXT");
$$.init($1.loc);
$$.qualifier.storage = EvqTileImageEXT;
}
| SHARED { | SHARED {
parseContext.globalCheck($1.loc, "shared"); parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "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.set(EbtFloat, Esd2D);
$$.sampler.yuv = true; $$.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 { | SUBPASSINPUT {
parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.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_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
%token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING %token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
%token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL %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> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> TERMINATE_INVOCATION %token <lex> TERMINATE_INVOCATION
%token <lex> TERMINATE_RAY IGNORE_INTERSECTION %token <lex> TERMINATE_RAY IGNORE_INTERSECTION
%token <lex> UNIFORM SHARED BUFFER %token <lex> UNIFORM SHARED BUFFER TILEIMAGEEXT
%token <lex> FLAT SMOOTH LAYOUT %token <lex> FLAT SMOOTH LAYOUT
@ -1476,6 +1477,11 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqUniform; $$.qualifier.storage = EvqUniform;
} }
| TILEIMAGEEXT {
parseContext.globalCheck($1.loc, "tileImageEXT");
$$.init($1.loc);
$$.qualifier.storage = EvqTileImageEXT;
}
| SHARED { | SHARED {
parseContext.globalCheck($1.loc, "shared"); parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "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.set(EbtFloat, Esd2D);
$$.sampler.yuv = true; $$.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 { | SUBPASSINPUT {
parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.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_STORAGE_CLASS = 581, /* SPIRV_STORAGE_CLASS */
SPIRV_BY_REFERENCE = 582, /* SPIRV_BY_REFERENCE */ SPIRV_BY_REFERENCE = 582, /* SPIRV_BY_REFERENCE */
SPIRV_LITERAL = 583, /* SPIRV_LITERAL */ SPIRV_LITERAL = 583, /* SPIRV_LITERAL */
LEFT_OP = 584, /* LEFT_OP */ ATTACHMENTEXT = 584, /* ATTACHMENTEXT */
RIGHT_OP = 585, /* RIGHT_OP */ IATTACHMENTEXT = 585, /* IATTACHMENTEXT */
INC_OP = 586, /* INC_OP */ UATTACHMENTEXT = 586, /* UATTACHMENTEXT */
DEC_OP = 587, /* DEC_OP */ LEFT_OP = 587, /* LEFT_OP */
LE_OP = 588, /* LE_OP */ RIGHT_OP = 588, /* RIGHT_OP */
GE_OP = 589, /* GE_OP */ INC_OP = 589, /* INC_OP */
EQ_OP = 590, /* EQ_OP */ DEC_OP = 590, /* DEC_OP */
NE_OP = 591, /* NE_OP */ LE_OP = 591, /* LE_OP */
AND_OP = 592, /* AND_OP */ GE_OP = 592, /* GE_OP */
OR_OP = 593, /* OR_OP */ EQ_OP = 593, /* EQ_OP */
XOR_OP = 594, /* XOR_OP */ NE_OP = 594, /* NE_OP */
MUL_ASSIGN = 595, /* MUL_ASSIGN */ AND_OP = 595, /* AND_OP */
DIV_ASSIGN = 596, /* DIV_ASSIGN */ OR_OP = 596, /* OR_OP */
ADD_ASSIGN = 597, /* ADD_ASSIGN */ XOR_OP = 597, /* XOR_OP */
MOD_ASSIGN = 598, /* MOD_ASSIGN */ MUL_ASSIGN = 598, /* MUL_ASSIGN */
LEFT_ASSIGN = 599, /* LEFT_ASSIGN */ DIV_ASSIGN = 599, /* DIV_ASSIGN */
RIGHT_ASSIGN = 600, /* RIGHT_ASSIGN */ ADD_ASSIGN = 600, /* ADD_ASSIGN */
AND_ASSIGN = 601, /* AND_ASSIGN */ MOD_ASSIGN = 601, /* MOD_ASSIGN */
XOR_ASSIGN = 602, /* XOR_ASSIGN */ LEFT_ASSIGN = 602, /* LEFT_ASSIGN */
OR_ASSIGN = 603, /* OR_ASSIGN */ RIGHT_ASSIGN = 603, /* RIGHT_ASSIGN */
SUB_ASSIGN = 604, /* SUB_ASSIGN */ AND_ASSIGN = 604, /* AND_ASSIGN */
STRING_LITERAL = 605, /* STRING_LITERAL */ XOR_ASSIGN = 605, /* XOR_ASSIGN */
LEFT_PAREN = 606, /* LEFT_PAREN */ OR_ASSIGN = 606, /* OR_ASSIGN */
RIGHT_PAREN = 607, /* RIGHT_PAREN */ SUB_ASSIGN = 607, /* SUB_ASSIGN */
LEFT_BRACKET = 608, /* LEFT_BRACKET */ STRING_LITERAL = 608, /* STRING_LITERAL */
RIGHT_BRACKET = 609, /* RIGHT_BRACKET */ LEFT_PAREN = 609, /* LEFT_PAREN */
LEFT_BRACE = 610, /* LEFT_BRACE */ RIGHT_PAREN = 610, /* RIGHT_PAREN */
RIGHT_BRACE = 611, /* RIGHT_BRACE */ LEFT_BRACKET = 611, /* LEFT_BRACKET */
DOT = 612, /* DOT */ RIGHT_BRACKET = 612, /* RIGHT_BRACKET */
COMMA = 613, /* COMMA */ LEFT_BRACE = 613, /* LEFT_BRACE */
COLON = 614, /* COLON */ RIGHT_BRACE = 614, /* RIGHT_BRACE */
EQUAL = 615, /* EQUAL */ DOT = 615, /* DOT */
SEMICOLON = 616, /* SEMICOLON */ COMMA = 616, /* COMMA */
BANG = 617, /* BANG */ COLON = 617, /* COLON */
DASH = 618, /* DASH */ EQUAL = 618, /* EQUAL */
TILDE = 619, /* TILDE */ SEMICOLON = 619, /* SEMICOLON */
PLUS = 620, /* PLUS */ BANG = 620, /* BANG */
STAR = 621, /* STAR */ DASH = 621, /* DASH */
SLASH = 622, /* SLASH */ TILDE = 622, /* TILDE */
PERCENT = 623, /* PERCENT */ PLUS = 623, /* PLUS */
LEFT_ANGLE = 624, /* LEFT_ANGLE */ STAR = 624, /* STAR */
RIGHT_ANGLE = 625, /* RIGHT_ANGLE */ SLASH = 625, /* SLASH */
VERTICAL_BAR = 626, /* VERTICAL_BAR */ PERCENT = 626, /* PERCENT */
CARET = 627, /* CARET */ LEFT_ANGLE = 627, /* LEFT_ANGLE */
AMPERSAND = 628, /* AMPERSAND */ RIGHT_ANGLE = 628, /* RIGHT_ANGLE */
QUESTION = 629, /* QUESTION */ VERTICAL_BAR = 629, /* VERTICAL_BAR */
INVARIANT = 630, /* INVARIANT */ CARET = 630, /* CARET */
HIGH_PRECISION = 631, /* HIGH_PRECISION */ AMPERSAND = 631, /* AMPERSAND */
MEDIUM_PRECISION = 632, /* MEDIUM_PRECISION */ QUESTION = 632, /* QUESTION */
LOW_PRECISION = 633, /* LOW_PRECISION */ INVARIANT = 633, /* INVARIANT */
PRECISION = 634, /* PRECISION */ HIGH_PRECISION = 634, /* HIGH_PRECISION */
PACKED = 635, /* PACKED */ MEDIUM_PRECISION = 635, /* MEDIUM_PRECISION */
RESOURCE = 636, /* RESOURCE */ LOW_PRECISION = 636, /* LOW_PRECISION */
SUPERP = 637, /* SUPERP */ PRECISION = 637, /* PRECISION */
FLOATCONSTANT = 638, /* FLOATCONSTANT */ PACKED = 638, /* PACKED */
INTCONSTANT = 639, /* INTCONSTANT */ RESOURCE = 639, /* RESOURCE */
UINTCONSTANT = 640, /* UINTCONSTANT */ SUPERP = 640, /* SUPERP */
BOOLCONSTANT = 641, /* BOOLCONSTANT */ FLOATCONSTANT = 641, /* FLOATCONSTANT */
IDENTIFIER = 642, /* IDENTIFIER */ INTCONSTANT = 642, /* INTCONSTANT */
TYPE_NAME = 643, /* TYPE_NAME */ UINTCONSTANT = 643, /* UINTCONSTANT */
CENTROID = 644, /* CENTROID */ BOOLCONSTANT = 644, /* BOOLCONSTANT */
IN = 645, /* IN */ IDENTIFIER = 645, /* IDENTIFIER */
OUT = 646, /* OUT */ TYPE_NAME = 646, /* TYPE_NAME */
INOUT = 647, /* INOUT */ CENTROID = 647, /* CENTROID */
STRUCT = 648, /* STRUCT */ IN = 648, /* IN */
VOID = 649, /* VOID */ OUT = 649, /* OUT */
WHILE = 650, /* WHILE */ INOUT = 650, /* INOUT */
BREAK = 651, /* BREAK */ STRUCT = 651, /* STRUCT */
CONTINUE = 652, /* CONTINUE */ VOID = 652, /* VOID */
DO = 653, /* DO */ WHILE = 653, /* WHILE */
ELSE = 654, /* ELSE */ BREAK = 654, /* BREAK */
FOR = 655, /* FOR */ CONTINUE = 655, /* CONTINUE */
IF = 656, /* IF */ DO = 656, /* DO */
DISCARD = 657, /* DISCARD */ ELSE = 657, /* ELSE */
RETURN = 658, /* RETURN */ FOR = 658, /* FOR */
SWITCH = 659, /* SWITCH */ IF = 659, /* IF */
CASE = 660, /* CASE */ DISCARD = 660, /* DISCARD */
DEFAULT = 661, /* DEFAULT */ RETURN = 661, /* RETURN */
TERMINATE_INVOCATION = 662, /* TERMINATE_INVOCATION */ SWITCH = 662, /* SWITCH */
TERMINATE_RAY = 663, /* TERMINATE_RAY */ CASE = 663, /* CASE */
IGNORE_INTERSECTION = 664, /* IGNORE_INTERSECTION */ DEFAULT = 664, /* DEFAULT */
UNIFORM = 665, /* UNIFORM */ TERMINATE_INVOCATION = 665, /* TERMINATE_INVOCATION */
SHARED = 666, /* SHARED */ TERMINATE_RAY = 666, /* TERMINATE_RAY */
BUFFER = 667, /* BUFFER */ IGNORE_INTERSECTION = 667, /* IGNORE_INTERSECTION */
FLAT = 668, /* FLAT */ UNIFORM = 668, /* UNIFORM */
SMOOTH = 669, /* SMOOTH */ SHARED = 669, /* SHARED */
LAYOUT = 670, /* LAYOUT */ BUFFER = 670, /* BUFFER */
DOUBLECONSTANT = 671, /* DOUBLECONSTANT */ TILEIMAGEEXT = 671, /* TILEIMAGEEXT */
INT16CONSTANT = 672, /* INT16CONSTANT */ FLAT = 672, /* FLAT */
UINT16CONSTANT = 673, /* UINT16CONSTANT */ SMOOTH = 673, /* SMOOTH */
FLOAT16CONSTANT = 674, /* FLOAT16CONSTANT */ LAYOUT = 674, /* LAYOUT */
INT32CONSTANT = 675, /* INT32CONSTANT */ DOUBLECONSTANT = 675, /* DOUBLECONSTANT */
UINT32CONSTANT = 676, /* UINT32CONSTANT */ INT16CONSTANT = 676, /* INT16CONSTANT */
INT64CONSTANT = 677, /* INT64CONSTANT */ UINT16CONSTANT = 677, /* UINT16CONSTANT */
UINT64CONSTANT = 678, /* UINT64CONSTANT */ FLOAT16CONSTANT = 678, /* FLOAT16CONSTANT */
SUBROUTINE = 679, /* SUBROUTINE */ INT32CONSTANT = 679, /* INT32CONSTANT */
DEMOTE = 680, /* DEMOTE */ UINT32CONSTANT = 680, /* UINT32CONSTANT */
PAYLOADNV = 681, /* PAYLOADNV */ INT64CONSTANT = 681, /* INT64CONSTANT */
PAYLOADINNV = 682, /* PAYLOADINNV */ UINT64CONSTANT = 682, /* UINT64CONSTANT */
HITATTRNV = 683, /* HITATTRNV */ SUBROUTINE = 683, /* SUBROUTINE */
CALLDATANV = 684, /* CALLDATANV */ DEMOTE = 684, /* DEMOTE */
CALLDATAINNV = 685, /* CALLDATAINNV */ PAYLOADNV = 685, /* PAYLOADNV */
PAYLOADEXT = 686, /* PAYLOADEXT */ PAYLOADINNV = 686, /* PAYLOADINNV */
PAYLOADINEXT = 687, /* PAYLOADINEXT */ HITATTRNV = 687, /* HITATTRNV */
HITATTREXT = 688, /* HITATTREXT */ CALLDATANV = 688, /* CALLDATANV */
CALLDATAEXT = 689, /* CALLDATAEXT */ CALLDATAINNV = 689, /* CALLDATAINNV */
CALLDATAINEXT = 690, /* CALLDATAINEXT */ PAYLOADEXT = 690, /* PAYLOADEXT */
PATCH = 691, /* PATCH */ PAYLOADINEXT = 691, /* PAYLOADINEXT */
SAMPLE = 692, /* SAMPLE */ HITATTREXT = 692, /* HITATTREXT */
NONUNIFORM = 693, /* NONUNIFORM */ CALLDATAEXT = 693, /* CALLDATAEXT */
COHERENT = 694, /* COHERENT */ CALLDATAINEXT = 694, /* CALLDATAINEXT */
VOLATILE = 695, /* VOLATILE */ PATCH = 695, /* PATCH */
RESTRICT = 696, /* RESTRICT */ SAMPLE = 696, /* SAMPLE */
READONLY = 697, /* READONLY */ NONUNIFORM = 697, /* NONUNIFORM */
WRITEONLY = 698, /* WRITEONLY */ COHERENT = 698, /* COHERENT */
DEVICECOHERENT = 699, /* DEVICECOHERENT */ VOLATILE = 699, /* VOLATILE */
QUEUEFAMILYCOHERENT = 700, /* QUEUEFAMILYCOHERENT */ RESTRICT = 700, /* RESTRICT */
WORKGROUPCOHERENT = 701, /* WORKGROUPCOHERENT */ READONLY = 701, /* READONLY */
SUBGROUPCOHERENT = 702, /* SUBGROUPCOHERENT */ WRITEONLY = 702, /* WRITEONLY */
NONPRIVATE = 703, /* NONPRIVATE */ DEVICECOHERENT = 703, /* DEVICECOHERENT */
SHADERCALLCOHERENT = 704, /* SHADERCALLCOHERENT */ QUEUEFAMILYCOHERENT = 704, /* QUEUEFAMILYCOHERENT */
NOPERSPECTIVE = 705, /* NOPERSPECTIVE */ WORKGROUPCOHERENT = 705, /* WORKGROUPCOHERENT */
EXPLICITINTERPAMD = 706, /* EXPLICITINTERPAMD */ SUBGROUPCOHERENT = 706, /* SUBGROUPCOHERENT */
PERVERTEXEXT = 707, /* PERVERTEXEXT */ NONPRIVATE = 707, /* NONPRIVATE */
PERVERTEXNV = 708, /* PERVERTEXNV */ SHADERCALLCOHERENT = 708, /* SHADERCALLCOHERENT */
PERPRIMITIVENV = 709, /* PERPRIMITIVENV */ NOPERSPECTIVE = 709, /* NOPERSPECTIVE */
PERVIEWNV = 710, /* PERVIEWNV */ EXPLICITINTERPAMD = 710, /* EXPLICITINTERPAMD */
PERTASKNV = 711, /* PERTASKNV */ PERVERTEXEXT = 711, /* PERVERTEXEXT */
PERPRIMITIVEEXT = 712, /* PERPRIMITIVEEXT */ PERVERTEXNV = 712, /* PERVERTEXNV */
TASKPAYLOADWORKGROUPEXT = 713, /* TASKPAYLOADWORKGROUPEXT */ PERPRIMITIVENV = 713, /* PERPRIMITIVENV */
PRECISE = 714 /* PRECISE */ PERVIEWNV = 714, /* PERVIEWNV */
PERTASKNV = 715, /* PERTASKNV */
PERPRIMITIVEEXT = 716, /* PERPRIMITIVEEXT */
TASKPAYLOADWORKGROUPEXT = 717, /* TASKPAYLOADWORKGROUPEXT */
PRECISE = 718 /* PRECISE */
}; };
typedef enum yytokentype yytoken_kind_t; typedef enum yytokentype yytoken_kind_t;
#endif #endif
@ -558,7 +562,7 @@ union YYSTYPE
glslang::TArraySizes* typeParameters; glslang::TArraySizes* typeParameters;
} interm; } interm;
#line 562 "MachineIndependent/glslang_tab.cpp.h" #line 566 "MachineIndependent/glslang_tab.cpp.h"
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;

View File

@ -663,6 +663,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoad: out.debug << "subpassLoad"; break;
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
case EOpColorAttachmentReadEXT: out.debug << "colorAttachmentReadEXT"; break;
case EOpConstructReference: out.debug << "Construct reference type"; break; case EOpConstructReference: out.debug << "Construct reference type"; break;
case EOpDeclare: out.debug << "Declare"; 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 EOpSubpassLoad: out.debug << "subpassLoad"; break;
case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
case EOpColorAttachmentReadEXT: out.debug << "colorAttachmentReadEXT"; break;
case EOpTraceNV: out.debug << "traceNV"; break; case EOpTraceNV: out.debug << "traceNV"; break;
case EOpTraceRayMotionNV: out.debug << "traceRayMotionNV"; break; case EOpTraceRayMotionNV: out.debug << "traceRayMotionNV"; break;
case EOpTraceKHR: out.debug << "traceRayKHR"; 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 EOpRayQueryGetWorldRayOrigin: out.debug << "rayQueryGetWorldRayOriginEXT"; break;
case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break; case EOpRayQueryGetIntersectionObjectToWorld: out.debug << "rayQueryGetIntersectionObjectToWorldEXT"; break;
case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break; case EOpRayQueryGetIntersectionWorldToObject: out.debug << "rayQueryGetIntersectionWorldToObjectEXT"; break;
case EOpRayQueryGetIntersectionTriangleVertexPositionsEXT: out.debug << "rayQueryGetIntersectionTriangleVertexPositionsEXT"; break;
case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break; case EOpCooperativeMatrixLoad: out.debug << "Load cooperative matrix"; break;
case EOpCooperativeMatrixStore: out.debug << "Store 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 #ifndef GLSLANG_WEB
case EOpSpirvInst: out.debug << "spirv_instruction"; break; case EOpSpirvInst: out.debug << "spirv_instruction"; break;
#endif #endif
case EOpStencilAttachmentReadEXT: out.debug << "stencilAttachmentReadEXT"; break;
case EOpDepthAttachmentReadEXT: out.debug << "depthAttachmentReadEXT"; break;
default: out.debug.message(EPrefixError, "Bad aggregation op"); 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"; infoSink.debug << "using early_fragment_tests\n";
if (postDepthCoverage) if (postDepthCoverage)
infoSink.debug << "using post_depth_coverage\n"; 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) if (depthLayout != EldNone)
infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n"; infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n";
if (blendEquations != 0) { if (blendEquations != 0) {

View File

@ -271,6 +271,9 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
MERGE_TRUE(earlyFragmentTests); MERGE_TRUE(earlyFragmentTests);
MERGE_TRUE(postDepthCoverage); MERGE_TRUE(postDepthCoverage);
MERGE_TRUE(nonCoherentColorAttachmentReadEXT);
MERGE_TRUE(nonCoherentDepthAttachmentReadEXT);
MERGE_TRUE(nonCoherentStencilAttachmentReadEXT);
if (depthLayout == EldNone) if (depthLayout == EldNone)
depthLayout = unit.depthLayout; depthLayout = unit.depthLayout;
@ -1617,7 +1620,7 @@ bool TIntermediate::userOutputUsed() const
return found; 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. // 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. // 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; set = 2;
else if (qualifier.storage == EvqBuffer) else if (qualifier.storage == EvqBuffer)
set = 3; set = 3;
else if (qualifier.storage == EvqTileImageEXT)
set = 4;
else if (qualifier.isAnyPayload()) else if (qualifier.isAnyPayload())
setRT = 0; setRT = 0;
else if (qualifier.isAnyCallable()) else if (qualifier.isAnyCallable())
@ -1731,7 +1736,10 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
} }
// combine location and component ranges // 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 // check for collisions, except for vertex inputs on desktop targeting OpenGL
if (! (!isEsProfile() && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0) 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 return -1; // no collision
} }

View File

@ -321,7 +321,12 @@ public:
inputPrimitive(ElgNone), outputPrimitive(ElgNone), inputPrimitive(ElgNone), outputPrimitive(ElgNone),
pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false), pixelCenterInteger(false), originUpperLeft(false),texCoordBuiltinRedeclared(false),
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(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), hlslFunctionality1(false),
blendEquations(0), xfbMode(false), multiStream(false), blendEquations(0), xfbMode(false), multiStream(false),
layoutOverrideCoverage(false), layoutOverrideCoverage(false),
@ -638,6 +643,9 @@ public:
bool getXfbMode() const { return false; } bool getXfbMode() const { return false; }
bool isMultiStream() const { return false; } bool isMultiStream() const { return false; }
TLayoutGeometry getOutputPrimitive() const { return ElgNone; } 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 getPostDepthCoverage() const { return false; }
bool getEarlyFragmentTests() const { return false; } bool getEarlyFragmentTests() const { return false; }
TLayoutDepth getDepth() const { return EldNone; } TLayoutDepth getDepth() const { return EldNone; }
@ -894,6 +902,12 @@ public:
return true; return true;
} }
TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; } 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; } void setPostDepthCoverage() { postDepthCoverage = true; }
bool getPostDepthCoverage() const { return postDepthCoverage; } bool getPostDepthCoverage() const { return postDepthCoverage; }
void setEarlyFragmentTests() { earlyFragmentTests = true; } void setEarlyFragmentTests() { earlyFragmentTests = true; }
@ -1215,6 +1229,9 @@ protected:
bool earlyFragmentTests; bool earlyFragmentTests;
bool postDepthCoverage; bool postDepthCoverage;
bool earlyAndLateFragmentTestsAMD; bool earlyAndLateFragmentTestsAMD;
bool nonCoherentColorAttachmentReadEXT;
bool nonCoherentDepthAttachmentReadEXT;
bool nonCoherentStencilAttachmentReadEXT;
TLayoutDepth depthLayout; TLayoutDepth depthLayout;
TLayoutStencil stencilLayout; TLayoutStencil stencilLayout;
bool hlslFunctionality1; bool hlslFunctionality1;

View File

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