VK_KHR_shader_non_semantic_info support
This extension adds no new API or structures, it only adds support
for SPV_KHR_non_semantic_info. As mentioned in the spirv spec:
"An extended set name which is prefixed with "NonSemantic." is
guaranteed to contain only non-semantic instructions and all
OpExtInst instructions referencing this set can be ignored."
Tests: dEQP-VK.spirv_assembly.instruction.compute.non_semantic_info.*
Bug: b/194682219
Change-Id: I26733d4b9a3a4bf056d2d3d5ecd494128ab67630
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/63249
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 3334677..446059d 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -483,6 +483,7 @@
static constexpr std::pair<const char *, Extension::Name> extensionsByName[] = {
{ "GLSL.std.450", Extension::GLSLstd450 },
{ "OpenCL.DebugInfo.100", Extension::OpenCLDebugInfo100 },
+ { "NonSemantic.", Extension::NonSemanticInfo },
};
static constexpr auto extensionCount = sizeof(extensionsByName) / sizeof(extensionsByName[0]);
@@ -491,7 +492,7 @@
auto ext = Extension{ Extension::Unknown };
for(size_t i = 0; i < extensionCount; i++)
{
- if(0 == strcmp(name, extensionsByName[i].first))
+ if(0 == strncmp(name, extensionsByName[i].first, strlen(extensionsByName[i].first)))
{
ext = Extension{ extensionsByName[i].second };
break;
@@ -748,6 +749,11 @@
case Extension::OpenCLDebugInfo100:
DefineOpenCLDebugInfo100(insn);
break;
+ case Extension::NonSemanticInfo:
+ // An extended set name which is prefixed with "NonSemantic." is
+ // guaranteed to contain only non-semantic instructions and all
+ // OpExtInst instructions referencing this set can be ignored.
+ break;
default:
UNREACHABLE("Unexpected Extension name %d", int(getExtension(insn.word(3)).name));
break;
@@ -779,6 +785,7 @@
if(!strcmp(ext, "SPV_KHR_multiview")) break;
if(!strcmp(ext, "SPV_EXT_shader_stencil_export")) break;
if(!strcmp(ext, "SPV_KHR_float_controls")) break;
+ if(!strcmp(ext, "SPV_KHR_non_semantic_info")) break;
if(!strcmp(ext, "SPV_KHR_vulkan_memory_model")) break;
if(!strcmp(ext, "SPV_GOOGLE_decorate_string")) break;
if(!strcmp(ext, "SPV_GOOGLE_hlsl_functionality1")) break;
@@ -2525,6 +2532,11 @@
return EmitExtGLSLstd450(insn, state);
case Extension::OpenCLDebugInfo100:
return EmitOpenCLDebugInfo100(insn, state);
+ case Extension::NonSemanticInfo:
+ // An extended set name which is prefixed with "NonSemantic." is
+ // guaranteed to contain only non-semantic instructions and all
+ // OpExtInst instructions referencing this set can be ignored.
+ break;
default:
UNREACHABLE("Unknown Extension::Name<%d>", int(ext.name));
}
diff --git a/src/Pipeline/SpirvShader.hpp b/src/Pipeline/SpirvShader.hpp
index c5389a1..4b125e2 100644
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -472,7 +472,8 @@
{
Unknown,
GLSLstd450,
- OpenCLDebugInfo100
+ OpenCLDebugInfo100,
+ NonSemanticInfo,
};
Name name;
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index d31184d..cbe28b5 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -425,6 +425,7 @@
{ { VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME, VK_KHR_COPY_COMMANDS_2_SPEC_VERSION } },
{ { VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION } },
{ { VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME, VK_KHR_FORMAT_FEATURE_FLAGS_2_SPEC_VERSION } },
+ { { VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME, VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION } },
{ { VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME, VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION } },
// Additional extension
{ { VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME, VK_GOOGLE_DECORATE_STRING_SPEC_VERSION } },