From 0d0283f698b4fb7bceedc97a7e525956ed962589 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Sat, 30 Apr 2022 17:29:19 +0800 Subject: [PATCH] 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 Reviewed-by: Jesse Natalie Reviewed-by: Erik Faye-Lund Part-of: --- 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