Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2022-11-08 15:25:17 +0300
committerGitHub <noreply@github.com>2022-11-08 15:25:17 +0300
commitedd66a2fc9e932ad0d3dce78f2627eeae91c2660 (patch)
tree69f0a7417484e67c91abd5a22beb926e2d518f59
parentabc31207bffbc1bef4192746af44b3be1abcff17 (diff)
parente8a22a7cf655c1d259973de350e872bfc7aa606b (diff)
Merge pull request #2055 from KhronosGroup/fix-2053HEADmaster
Handle ShaderDebugInfo non-semantic extension.
-rw-r--r--spirv_common.hpp3
-rw-r--r--spirv_cross.cpp2
-rw-r--r--spirv_glsl.cpp3
-rw-r--r--spirv_parser.cpp22
4 files changed, 18 insertions, 12 deletions
diff --git a/spirv_common.hpp b/spirv_common.hpp
index 32f91c72..71b1eada 100644
--- a/spirv_common.hpp
+++ b/spirv_common.hpp
@@ -643,7 +643,8 @@ struct SPIRExtension : IVariant
SPV_AMD_shader_explicit_vertex_parameter,
SPV_AMD_shader_trinary_minmax,
SPV_AMD_gcn_shader,
- NonSemanticDebugPrintf
+ NonSemanticDebugPrintf,
+ NonSemanticShaderDebugInfo
};
explicit SPIRExtension(Extension ext_)
diff --git a/spirv_cross.cpp b/spirv_cross.cpp
index 3b8bc87b..77bb0819 100644
--- a/spirv_cross.cpp
+++ b/spirv_cross.cpp
@@ -725,7 +725,7 @@ bool Compiler::InterfaceVariableAccessHandler::handle(Op opcode, const uint32_t
case OpExtInst:
{
- if (length < 5)
+ if (length < 3)
return false;
auto &extension_set = compiler.get<SPIRExtension>(args[2]);
switch (extension_set.ext)
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp
index 31af3b2d..4d2254f9 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -13283,7 +13283,8 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
{
emit_spv_amd_gcn_shader_op(ops[0], ops[1], ops[3], &ops[4], length - 4);
}
- else if (ext == SPIRExtension::SPV_debug_info)
+ else if (ext == SPIRExtension::SPV_debug_info ||
+ ext == SPIRExtension::NonSemanticShaderDebugInfo)
{
break; // Ignore SPIR-V debug information extended instructions.
}
diff --git a/spirv_parser.cpp b/spirv_parser.cpp
index 49eb1933..39bd1adf 100644
--- a/spirv_parser.cpp
+++ b/spirv_parser.cpp
@@ -275,24 +275,28 @@ void Parser::parse(const Instruction &instruction)
case OpExtInstImport:
{
uint32_t id = ops[0];
+
+ SPIRExtension::Extension spirv_ext = SPIRExtension::Unsupported;
+
auto ext = extract_string(ir.spirv, instruction.offset + 1);
if (ext == "GLSL.std.450")
- set<SPIRExtension>(id, SPIRExtension::GLSL);
+ spirv_ext = SPIRExtension::GLSL;
else if (ext == "DebugInfo")
- set<SPIRExtension>(id, SPIRExtension::SPV_debug_info);
+ spirv_ext = SPIRExtension::SPV_debug_info;
else if (ext == "SPV_AMD_shader_ballot")
- set<SPIRExtension>(id, SPIRExtension::SPV_AMD_shader_ballot);
+ spirv_ext = SPIRExtension::SPV_AMD_shader_ballot;
else if (ext == "SPV_AMD_shader_explicit_vertex_parameter")
- set<SPIRExtension>(id, SPIRExtension::SPV_AMD_shader_explicit_vertex_parameter);
+ spirv_ext = SPIRExtension::SPV_AMD_shader_explicit_vertex_parameter;
else if (ext == "SPV_AMD_shader_trinary_minmax")
- set<SPIRExtension>(id, SPIRExtension::SPV_AMD_shader_trinary_minmax);
+ spirv_ext = SPIRExtension::SPV_AMD_shader_trinary_minmax;
else if (ext == "SPV_AMD_gcn_shader")
- set<SPIRExtension>(id, SPIRExtension::SPV_AMD_gcn_shader);
+ spirv_ext = SPIRExtension::SPV_AMD_gcn_shader;
else if (ext == "NonSemantic.DebugPrintf")
- set<SPIRExtension>(id, SPIRExtension::NonSemanticDebugPrintf);
- else
- set<SPIRExtension>(id, SPIRExtension::Unsupported);
+ spirv_ext = SPIRExtension::NonSemanticDebugPrintf;
+ else if (ext == "NonSemantic.Shader.DebugInfo.100")
+ spirv_ext = SPIRExtension::NonSemanticShaderDebugInfo;
+ set<SPIRExtension>(id, spirv_ext);
// Other SPIR-V extensions which have ExtInstrs are currently not supported.
break;