Mesa (main): nir_to_dxil: Add tagging raw SRVs in shader flags

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 5 23:44:57 UTC 2021


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

Author: Enrico Galli <enrico.galli at intel.com>
Date:   Fri Oct  1 15:16:22 2021 -0700

nir_to_dxil: Add tagging raw SRVs in shader flags

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13157>

---

 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) {



More information about the mesa-commit mailing list