Mesa (main): dxil: Sync dxil_spirv_shader_stage with gl_shader_stage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 12:23:41 UTC 2022


Module: Mesa
Branch: main
Commit: 0d0283f698b4fb7bceedc97a7e525956ed962589
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d0283f698b4fb7bceedc97a7e525956ed962589

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Sat Apr 30 17:29:19 2022 +0800

dxil: Sync dxil_spirv_shader_stage with gl_shader_stage

Add STATIC_ASSERT to guard `dxil_spirv_shader_stage` and `gl_shader_stage`
to be same for each enum value.

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16671>

---

 src/microsoft/spirv_to_dxil/spirv_to_dxil.c | 9 +++++++++
 src/microsoft/spirv_to_dxil/spirv_to_dxil.h | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
index 60d357c5c0e..49d12fb0864 100644
--- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
+++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
@@ -32,6 +32,15 @@
 #include "git_sha1.h"
 #include "vulkan/vulkan.h"
 
+static_assert(DXIL_SPIRV_SHADER_NONE == (int)MESA_SHADER_NONE, "must match");
+static_assert(DXIL_SPIRV_SHADER_VERTEX == (int)MESA_SHADER_VERTEX, "must match");
+static_assert(DXIL_SPIRV_SHADER_TESS_CTRL == (int)MESA_SHADER_TESS_CTRL, "must match");
+static_assert(DXIL_SPIRV_SHADER_TESS_EVAL == (int)MESA_SHADER_TESS_EVAL, "must match");
+static_assert(DXIL_SPIRV_SHADER_GEOMETRY == (int)MESA_SHADER_GEOMETRY, "must match");
+static_assert(DXIL_SPIRV_SHADER_FRAGMENT == (int)MESA_SHADER_FRAGMENT, "must match");
+static_assert(DXIL_SPIRV_SHADER_COMPUTE == (int)MESA_SHADER_COMPUTE, "must match");
+static_assert(DXIL_SPIRV_SHADER_KERNEL == (int)MESA_SHADER_KERNEL, "must match");
+
 /* Logic extracted from vk_spirv_to_nir() so we have the same preparation
  * steps for both the vulkan driver and the lib used by the WebGPU
  * implementation.
diff --git a/src/microsoft/spirv_to_dxil/spirv_to_dxil.h b/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
index 3be4936aa18..f22863c44fd 100644
--- a/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
+++ b/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
@@ -44,7 +44,7 @@ typedef enum {
    DXIL_SPIRV_SHADER_GEOMETRY = 3,
    DXIL_SPIRV_SHADER_FRAGMENT = 4,
    DXIL_SPIRV_SHADER_COMPUTE = 5,
-   DXIL_SPIRV_SHADER_KERNEL = 6,
+   DXIL_SPIRV_SHADER_KERNEL = 14,
 } dxil_spirv_shader_stage;
 
 // Copy of nir_spirv_const_value



More information about the mesa-commit mailing list