microsoft/compiler: Support up to shader model 6.5
authorJesse Natalie <jenatali@microsoft.com>
Thu, 11 Aug 2022 16:38:45 +0000 (09:38 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 25 Aug 2022 21:22:48 +0000 (21:22 +0000)
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 <gdevich@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18022>

src/microsoft/compiler/nir_to_dxil.c
src/microsoft/compiler/nir_to_dxil.h

index 1bf294b..0dc79ac 100644 (file)
@@ -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;
    }
 
index dc8228c..80a593e 100644 (file)
@@ -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 {