Expose VK_GOOGLE_decorate_string
SPV_GOOGLE_decorate_string was incorporated into SPIR-V 1.4, which we
already supported. The string decorations are ignored since they're
assumed not to have semantic value for the driver.
OpDecorateStringGOOGLE is numerically equal to OpDecorateString and
OpMemberDecorateStringGOOGLE is equal to OpMemberDecorateString. The
only supported string literal decoration is UserSemantic, so an assert
was added.
Bug: b/214576937
Change-Id: I0fe8d4da60473341c80cc7e8be2f302a79135613
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/61370
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Sean Risser <srisser@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index 264a471..3760358 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -165,8 +165,21 @@
break;
case spv::OpDecorateString:
+ {
+ auto decoration = static_cast<spv::Decoration>(insn.word(2));
+
+ // We assume these are for HLSL semantics, ignore them (b/214576937).
+ ASSERT(decoration == spv::DecorationUserSemantic);
+ }
+ break;
+
case spv::OpMemberDecorateString:
- // We assume these are for HLSL semantics, ignore them.
+ {
+ auto decoration = static_cast<spv::Decoration>(insn.word(3));
+
+ // We assume these are for HLSL semantics, ignore them (b/214576937).
+ ASSERT(decoration == spv::DecorationUserSemantic);
+ }
break;
case spv::OpDecorationGroup:
@@ -763,6 +776,7 @@
if(!strcmp(ext, "SPV_EXT_shader_stencil_export")) break;
if(!strcmp(ext, "SPV_KHR_float_controls")) break;
if(!strcmp(ext, "SPV_KHR_vulkan_memory_model")) break;
+ if(!strcmp(ext, "SPV_GOOGLE_decorate_string")) break;
UNSUPPORTED("SPIR-V Extension: %s", ext);
}
break;
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index 90089ed..ef9a701 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -424,6 +424,7 @@
{ { VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME, VK_KHR_FORMAT_FEATURE_FLAGS_2_SPEC_VERSION } },
{ { VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME, VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION } },
{ { VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME, VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION } },
+ { { VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME, VK_GOOGLE_DECORATE_STRING_SPEC_VERSION } },
};
static uint32_t numSupportedExtensions(const ExtensionProperties *extensionProperties, uint32_t extensionPropertiesCount)