From c79ec5ea3cd0a05abdb0e132e14ca29f55881d5d Mon Sep 17 00:00:00 2001 From: Enrico Galli Date: Fri, 1 Oct 2021 15:16:22 -0700 Subject: [PATCH] nir_to_dxil: Add tagging raw SRVs in shader flags Reviewed-by: Jesse Natalie Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index d5f666ddce9..84d3aad16df 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -873,6 +873,8 @@ emit_srv(struct ntd_context *ctx, nir_variable *var, unsigned count) util_dynarray_append(&ctx->srv_metadata_nodes, const struct dxil_mdnode *, srv_meta); add_resource(ctx, res_type, &layout); + if (res_type == DXIL_RES_SRV_RAW) + ctx->mod.raw_and_structured_buffers = true; if (!ctx->opts->vulkan_environment) { for (unsigned i = 0; i < count; ++i) { @@ -946,6 +948,8 @@ emit_uav(struct ntd_context *ctx, unsigned binding, unsigned space, unsigned cou ctx->mod.feats.use_64uavs = 1; add_resource(ctx, res_kind == DXIL_RESOURCE_KIND_RAW_BUFFER ? DXIL_RES_UAV_RAW : DXIL_RES_UAV_TYPED, &layout); + if (res_kind == DXIL_RESOURCE_KIND_RAW_BUFFER) + ctx->mod.raw_and_structured_buffers = true; if (!ctx->opts->vulkan_environment) { for (unsigned i = 0; i < count; ++i) { @@ -4592,7 +4596,6 @@ emit_module(struct ntd_context *ctx, const struct nir_to_dxil_options *opts) return false; } else { /* Handle read/write SSBOs as UAVs */ - int uav_count = 0; nir_foreach_variable_with_modes(var, ctx->shader, nir_var_mem_ssbo) { if ((var->data.access & ACCESS_NON_WRITEABLE) == 0) { unsigned count = 1; @@ -4603,11 +4606,8 @@ emit_module(struct ntd_context *ctx, const struct nir_to_dxil_options *opts) DXIL_RESOURCE_KIND_RAW_BUFFER, var->name)) return false; - ++uav_count; } } - if (uav_count > 0) - ctx->mod.raw_and_structured_buffers = true; } nir_foreach_variable_with_modes(var, ctx->shader, nir_var_uniform) {