Mesa (main): microsoft/compiler: Fix sampler/texture array emission
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 31 16:51:19 UTC 2022
Module: Mesa
Branch: main
Commit: 678b94c2d851dd21061308fb34fb1bc483bf4ad2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=678b94c2d851dd21061308fb34fb1bc483bf4ad2
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Wed Dec 1 09:13:26 2021 +0100
microsoft/compiler: Fix sampler/texture array emission
Those need to be declared as sampler/SRV arrays, as we do for UAVs and
CBVs.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13993>
---
src/microsoft/compiler/nir_to_dxil.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index c77f4dbb98c..9c1990e6930 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -934,7 +934,10 @@ emit_srv(struct ntd_context *ctx, nir_variable *var, unsigned count)
res_type = DXIL_RES_SRV_TYPED;
}
const struct dxil_type *res_type_as_type = dxil_module_get_res_type(&ctx->mod, res_kind, comp_type, false /* readwrite */);
- res_type_as_type = dxil_module_get_array_type(&ctx->mod, res_type_as_type, count);
+
+ if (count > 1)
+ res_type_as_type = dxil_module_get_array_type(&ctx->mod, res_type_as_type, count);
+
const struct dxil_mdnode *srv_meta = emit_srv_metadata(&ctx->mod, res_type_as_type, var->name,
&layout, comp_type, res_kind);
@@ -1201,7 +1204,10 @@ emit_sampler(struct ntd_context *ctx, nir_variable *var, unsigned count)
resource_array_layout layout = {id, binding, count, var->data.descriptor_set};
const struct dxil_type *int32_type = dxil_module_get_int_type(&ctx->mod, 32);
const struct dxil_type *sampler_type = dxil_module_get_struct_type(&ctx->mod, "struct.SamplerState", &int32_type, 1);
- sampler_type = dxil_module_get_array_type(&ctx->mod, sampler_type, count);
+
+ if (count > 1)
+ sampler_type = dxil_module_get_array_type(&ctx->mod, sampler_type, count);
+
const struct dxil_mdnode *sampler_meta = emit_sampler_metadata(&ctx->mod, sampler_type, var, &layout);
if (!sampler_meta)
More information about the mesa-commit
mailing list