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

Author: Jesse Natalie <[email protected]>
Date:   Thu Aug 11 09:38:45 2022 -0700

microsoft/compiler: Support up to shader model 6.5

We don't actually use any of the new features, but that's okay, it's
still valid DXIL at the higher shader models.

Reviewed-by: Giancarlo Devich <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18022>

---

 src/microsoft/compiler/nir_to_dxil.c | 14 ++++++++++----
 src/microsoft/compiler/nir_to_dxil.h |  3 +++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/microsoft/compiler/nir_to_dxil.c 
b/src/microsoft/compiler/nir_to_dxil.c
index 1bf294bcece..0dc79ac0ca4 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -5807,6 +5807,8 @@ type_size_vec4(const struct glsl_type *type, bool 
bindless)
 
 static const unsigned dxil_validator_min_capable_version = DXIL_VALIDATOR_1_4;
 static const unsigned dxil_validator_max_capable_version = DXIL_VALIDATOR_1_7;
+static const unsigned dxil_min_shader_model = SHADER_MODEL_6_1;
+static const unsigned dxil_max_shader_model = SHADER_MODEL_6_5;
 
 bool
 nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
@@ -5817,13 +5819,17 @@ nir_to_dxil(struct nir_shader *s, const struct 
nir_to_dxil_options *opts,
    debug_dxil = (int)debug_get_option_debug_dxil();
    blob_init(blob);
 
-   if (opts->shader_model_max < SHADER_MODEL_6_1) {
-      debug_printf("D3D12: cannot support emitting shader model 6.0 or 
lower\n");
+   if (opts->shader_model_max < dxil_min_shader_model) {
+      debug_printf("D3D12: cannot support emitting shader models lower than 
%d.%d\n",
+                   dxil_min_shader_model >> 16,
+                   dxil_min_shader_model & 0xffff);
       return false;
    }
 
-   if (opts->shader_model_max > SHADER_MODEL_6_2) {
-      debug_printf("D3D12: cannot support emitting higher than shader model 
6.2\n");
+   if (opts->shader_model_max > dxil_max_shader_model) {
+      debug_printf("D3D12: cannot support emitting higher than shader model 
%d.%d\n",
+                   dxil_max_shader_model >> 16,
+                   dxil_max_shader_model & 0xffff);
       return false;
    }
 
diff --git a/src/microsoft/compiler/nir_to_dxil.h 
b/src/microsoft/compiler/nir_to_dxil.h
index dc8228cbeed..80a593e239b 100644
--- a/src/microsoft/compiler/nir_to_dxil.h
+++ b/src/microsoft/compiler/nir_to_dxil.h
@@ -85,6 +85,9 @@ enum dxil_shader_model {
    SHADER_MODEL_6_0 = 0x60000,
    SHADER_MODEL_6_1,
    SHADER_MODEL_6_2,
+   SHADER_MODEL_6_3,
+   SHADER_MODEL_6_4,
+   SHADER_MODEL_6_5,
 };
 
 struct nir_to_dxil_options {

Reply via email to