[Mesa-dev] [PATCH 3/4] spirv: Add no-op support for VK_GOOGLE_hlsl_functionality1
Jason Ekstrand
jason at jlekstrand.net
Sat Oct 13 13:48:33 UTC 2018
This extension adds two new decorations which carry meaning only for
HLSL shaders. They are expected to be handled by higher level layers
and can be ignored by implementations. However, it does save the client
a bit of work if the implementation safely ignores them instead of the
client having to strip them out of the SPIR-V in order for it to be
valid.
---
src/compiler/spirv/spirv_to_nir.c | 5 +++++
src/compiler/spirv/vtn_variables.c | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 7c501f3e71d..5f777d16e01 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -769,6 +769,10 @@ struct_member_decoration_cb(struct vtn_builder *b,
spirv_decoration_to_string(dec->decoration));
break;
+ case SpvDecorationHlslSemanticGOOGLE:
+ /* HLSL semantic decorations can safely be ignored by the driver. */
+ break;
+
default:
vtn_fail("Unhandled decoration");
}
@@ -856,6 +860,7 @@ type_decoration_cb(struct vtn_builder *b,
case SpvDecorationOffset:
case SpvDecorationXfbBuffer:
case SpvDecorationXfbStride:
+ case SpvDecorationHlslSemanticGOOGLE:
vtn_warn("Decoration only allowed for struct members: %s",
spirv_decoration_to_string(dec->decoration));
break;
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 636fdb8689a..c1e3c0ba5bb 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1351,6 +1351,10 @@ apply_var_decoration(struct vtn_builder *b,
spirv_decoration_to_string(dec->decoration));
break;
+ case SpvDecorationHlslSemanticGOOGLE:
+ /* HLSL semantic decorations can safely be ignored by the driver. */
+ break;
+
default:
vtn_fail("Unhandled decoration");
}
@@ -1389,6 +1393,9 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationOffset:
vtn_var->offset = dec->literals[0];
break;
+ case SpvDecorationHlslCounterBufferGOOGLE:
+ /* HLSL semantic decorations can safely be ignored by the driver. */
+ break;
default:
break;
}
--
2.19.1
More information about the mesa-dev
mailing list