microsoft/compiler: Support SM6.7
authorJesse Natalie <jenatali@microsoft.com>
Thu, 11 Aug 2022 20:40:49 +0000 (13:40 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 25 Aug 2022 21:22:49 +0000 (21:22 +0000)
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 611b602..53e9178 100644 (file)
@@ -1633,6 +1633,14 @@ get_module_flags(struct ntd_context *ctx)
    if (ctx->opts->disable_math_refactoring)
       flags |= (1 << 1);
 
+   /* Work around https://github.com/microsoft/DirectXShaderCompiler/issues/4616
+    * When targeting SM6.7 and with at least one UAV, if no other flags are present,
+    * set the resources-may-not-alias flag, or else the DXIL validator may end up
+    * with uninitialized memory which will fail validation, due to missing that flag.
+    */
+   if (flags == 0 && ctx->mod.minor_version >= 7 && ctx->num_uavs > 0)
+      flags |= (1ull << 33);
+
    return flags;
 }
 
@@ -5928,7 +5936,7 @@ 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_6;
+static const unsigned dxil_max_shader_model = SHADER_MODEL_6_7;
 
 bool
 nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
index 74842ab..c431906 100644 (file)
@@ -89,6 +89,7 @@ enum dxil_shader_model {
    SHADER_MODEL_6_4,
    SHADER_MODEL_6_5,
    SHADER_MODEL_6_6,
+   SHADER_MODEL_6_7,
 };
 
 struct nir_to_dxil_options {