From ce7a23b611a4b9b091a1a45cedcada8f11dedc14 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 26 Apr 2024 13:55:01 +0100 Subject: [PATCH] Prefer KHR to NV for opcode aliases when making SPIR-V helpers --- .../driver/shaders/spirv/gen_spirv_code.py | 13 ++++++++++ renderdoc/driver/shaders/spirv/spirv_gen.cpp | 24 +++++++++---------- renderdoc/driver/shaders/spirv/spirv_gen.h | 2 -- .../driver/shaders/spirv/spirv_op_helpers.h | 20 ++++++++-------- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/gen_spirv_code.py b/renderdoc/driver/shaders/spirv/gen_spirv_code.py index 8b5b07f94..abf3d1211 100644 --- a/renderdoc/driver/shaders/spirv/gen_spirv_code.py +++ b/renderdoc/driver/shaders/spirv/gen_spirv_code.py @@ -895,6 +895,19 @@ disassemble = '' for inst in spirv['instructions']: if inst['class'] == '@exclude': continue + + wait_for_official = False + for off in official_suffixes: + for vend in vendor_suffixes: + if inst['opname'][-len(vend):] == vend: + off_name = inst['opname'][:-len(vend)] + off + + for search in spirv['instructions']: + if search['opname'] == off_name and inst['opcode'] == search['opcode']: + wait_for_official = True + + if wait_for_official: + continue decl += ' {} = {},\n'.format(inst['opname'][2:], inst['opcode']) diff --git a/renderdoc/driver/shaders/spirv/spirv_gen.cpp b/renderdoc/driver/shaders/spirv/spirv_gen.cpp index 5f9ba07a5..36b408573 100644 --- a/renderdoc/driver/shaders/spirv/spirv_gen.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_gen.cpp @@ -1869,14 +1869,14 @@ rdcstr DoStringise(const rdcspv::Op &el) STRINGISE_ENUM_CLASS(WritePackedPrimitiveIndices4x8NV); STRINGISE_ENUM_CLASS(FetchMicroTriangleVertexPositionNV); STRINGISE_ENUM_CLASS(FetchMicroTriangleVertexBarycentricNV); - STRINGISE_ENUM_CLASS(ReportIntersectionNV); + STRINGISE_ENUM_CLASS(ReportIntersectionKHR); STRINGISE_ENUM_CLASS(IgnoreIntersectionNV); STRINGISE_ENUM_CLASS(TerminateRayNV); STRINGISE_ENUM_CLASS(TraceNV); STRINGISE_ENUM_CLASS(TraceMotionNV); STRINGISE_ENUM_CLASS(TraceRayMotionNV); STRINGISE_ENUM_CLASS(RayQueryGetIntersectionTriangleVertexPositionsKHR); - STRINGISE_ENUM_CLASS(TypeAccelerationStructureNV); + STRINGISE_ENUM_CLASS(TypeAccelerationStructureKHR); STRINGISE_ENUM_CLASS(ExecuteCallableNV); STRINGISE_ENUM_CLASS(TypeCooperativeMatrixNV); STRINGISE_ENUM_CLASS(CooperativeMatrixLoadNV); @@ -4867,7 +4867,7 @@ void OpDecoder::ForEachID(const ConstIter &it, const std::functionresultType = resultType; @@ -16092,7 +16092,7 @@ struct OpReportIntersectionNV this->hitKind = hitKind; } - static constexpr Op OpCode = Op::ReportIntersectionNV; + static constexpr Op OpCode = Op::ReportIntersectionKHR; static constexpr uint16_t FixedWordSize = 5U; Op op; uint16_t wordCount; @@ -16292,20 +16292,20 @@ struct OpRayQueryGetIntersectionTriangleVertexPositionsKHR Id intersection; }; -struct OpTypeAccelerationStructureNV +struct OpTypeAccelerationStructureKHR { - OpTypeAccelerationStructureNV(const ConstIter &it) + OpTypeAccelerationStructureKHR(const ConstIter &it) { memcpy(this, it.words(), sizeof(*this)); } - OpTypeAccelerationStructureNV(IdResult result) - : op(Op::TypeAccelerationStructureNV) + OpTypeAccelerationStructureKHR(IdResult result) + : op(Op::TypeAccelerationStructureKHR) , wordCount(FixedWordSize) { this->result = result; } - static constexpr Op OpCode = Op::TypeAccelerationStructureNV; + static constexpr Op OpCode = Op::TypeAccelerationStructureKHR; static constexpr uint16_t FixedWordSize = 2U; Op op; uint16_t wordCount;