microsoft/compiler: Emit SRVs/UAVs as arrays

This is done regardless of size so that "dynamic" indexing with a
uniform can work even on arrays of size 1.

Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14342>
This commit is contained in:
Jesse Natalie 2021-12-28 14:52:15 -08:00 committed by Marge Bot
parent e3c14cf718
commit c9719b6d2e

View file

@ -867,6 +867,7 @@ 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);
const struct dxil_mdnode *srv_meta = emit_srv_metadata(&ctx->mod, res_type_as_type, var->name,
&layout, comp_type, res_kind);
@ -939,6 +940,7 @@ emit_uav(struct ntd_context *ctx, unsigned binding, unsigned space, unsigned cou
resource_array_layout layout = { id, binding, count, space };
const struct dxil_type *res_type = dxil_module_get_res_type(&ctx->mod, res_kind, comp_type, true /* readwrite */);
res_type = dxil_module_get_array_type(&ctx->mod, res_type, count);
const struct dxil_mdnode *uav_meta = emit_uav_metadata(&ctx->mod, res_type, name,
&layout, comp_type, res_kind);