Mesa (master): spirv: Add no-op support for VK_GOOGLE_hlsl_functionality1

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 22 16:27:51 UTC 2018


Module: Mesa
Branch: master
Commit: 891886da2f963dc3fb7133e5e8957df1f65e0b42
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=891886da2f963dc3fb7133e5e8957df1f65e0b42

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Sat Oct 13 08:41:36 2018 -0500

spirv: Add no-op support for VK_GOOGLE_hlsl_functionality1

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.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 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 01810be6da..5bac3dc0e1 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -787,6 +787,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");
    }
@@ -874,6 +878,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 cc3438bff2..c5cf345d02 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1375,6 +1375,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");
    }
@@ -1425,6 +1429,9 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
    case SpvDecorationCoherent:
       vtn_var->access |= ACCESS_COHERENT;
       break;
+   case SpvDecorationHlslCounterBufferGOOGLE:
+      /* HLSL semantic decorations can safely be ignored by the driver. */
+      break;
    default:
       break;
    }




More information about the mesa-commit mailing list