From cb21534a7c1270adace37a0d9703f72cd0c14c4a Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 11 Aug 2022 13:40:49 -0700 Subject: [PATCH] microsoft/compiler: Support SM6.7 Reviewed-by: Giancarlo Devich Reviewed-by: Boris Brezillon Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 10 +++++++++- src/microsoft/compiler/nir_to_dxil.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 611b602a3c7..53e917841d5 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -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, diff --git a/src/microsoft/compiler/nir_to_dxil.h b/src/microsoft/compiler/nir_to_dxil.h index 74842ab47c8..c431906138a 100644 --- a/src/microsoft/compiler/nir_to_dxil.h +++ b/src/microsoft/compiler/nir_to_dxil.h @@ -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 {