Implement VK_GOOGLE_user_type

"This extension provides one new decoration, UserTypeGOOGLE, that
allows HLL shader compilers to optionally embed unambiguous type
information.

The decoration UserTypeGOOGLE is used with OpDecorateStringGOOGLE and
OpMemberDecorateStringGOOGLE to store a string name for the type of the
decorated object in the user’s source. It can decorate only a variable,
a type, or a member of a structure type. This has no semantic impact."

Bug: b/214576937
Change-Id: I063f10774072c172d627f400f3300e230c5f92b9
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/61372
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 e2daae9..860408f 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -169,7 +169,7 @@
 				auto decoration = static_cast<spv::Decoration>(insn.word(2));
 
 				// We assume these are for HLSL semantics, ignore them (b/214576937).
-				ASSERT(decoration == spv::DecorationUserSemantic);
+				ASSERT(decoration == spv::DecorationUserSemantic || decoration == spv::DecorationUserTypeGOOGLE);
 			}
 			break;
 
@@ -178,7 +178,7 @@
 				auto decoration = static_cast<spv::Decoration>(insn.word(3));
 
 				// We assume these are for HLSL semantics, ignore them (b/214576937).
-				ASSERT(decoration == spv::DecorationUserSemantic);
+				ASSERT(decoration == spv::DecorationUserSemantic || decoration == spv::DecorationUserTypeGOOGLE);
 			}
 			break;
 
@@ -778,6 +778,7 @@
 				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;
+				if(!strcmp(ext, "SPV_GOOGLE_user_type")) break;
 				UNSUPPORTED("SPIR-V Extension: %s", ext);
 			}
 			break;
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index dd8905e..d19f990 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -426,6 +426,7 @@
 	{ { 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 } },
 	{ { VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME, VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION } },
+	{ { VK_GOOGLE_USER_TYPE_EXTENSION_NAME, VK_GOOGLE_USER_TYPE_SPEC_VERSION } },
 };
 
 static uint32_t numSupportedExtensions(const ExtensionProperties *extensionProperties, uint32_t extensionPropertiesCount)