Module: Mesa Branch: main Commit: 32e3c77a11d4ac49d6822b5a03da48046f7ae493 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=32e3c77a11d4ac49d6822b5a03da48046f7ae493
Author: Pedro J. Estébanez <[email protected]> Date: Tue Apr 4 20:27:09 2023 +0200 Revert "microsoft/compiler: Use SRVs for read-only images" This reverts commit 54c32aeba6300f5cafc2bae18020398645925969. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22289> --- src/microsoft/compiler/nir_to_dxil.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 5ddc4a71502..245c5140f98 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -5180,17 +5180,12 @@ emit_deref(struct ntd_context* ctx, nir_deref_instr* instr) assert(glsl_type_is_sampler(type) || glsl_type_is_image(type) || glsl_type_is_texture(type)); enum dxil_resource_class res_class; - if (glsl_type_is_image(type)) { - if (ctx->opts->environment == DXIL_ENVIRONMENT_VULKAN && - (var->data.access & ACCESS_NON_WRITEABLE)) - res_class = DXIL_RESOURCE_CLASS_SRV; - else - res_class = DXIL_RESOURCE_CLASS_UAV; - } else if (glsl_type_is_sampler(type)) { + if (glsl_type_is_image(type)) + res_class = DXIL_RESOURCE_CLASS_UAV; + else if (glsl_type_is_sampler(type)) res_class = DXIL_RESOURCE_CLASS_SAMPLER; - } else { + else res_class = DXIL_RESOURCE_CLASS_SRV; - } unsigned descriptor_set = ctx->opts->environment == DXIL_ENVIRONMENT_VULKAN ? var->data.descriptor_set : (glsl_type_is_image(type) ? 1 : 0); @@ -6167,19 +6162,12 @@ emit_module(struct ntd_context *ctx, const struct nir_to_dxil_options *opts) /* SRVs */ nir_foreach_variable_with_modes(var, ctx->shader, nir_var_uniform) { - if (glsl_type_is_texture(glsl_without_array(var->type)) && - !emit_srv(ctx, var, glsl_type_get_texture_count(var->type))) + unsigned count = glsl_type_get_texture_count(var->type); + assert(count == 0 || glsl_type_is_texture(glsl_without_array(var->type))); + if (count > 0 && !emit_srv(ctx, var, count)) return false; } - if (ctx->opts->environment == DXIL_ENVIRONMENT_VULKAN) { - nir_foreach_image_variable(var, ctx->shader) { - if ((var->data.access & ACCESS_NON_WRITEABLE) && - !emit_srv(ctx, var, glsl_type_get_image_count(var->type))) - return false; - } - } - /* Handle read-only SSBOs as SRVs */ if (ctx->opts->environment == DXIL_ENVIRONMENT_VULKAN) { nir_foreach_variable_with_modes(var, ctx->shader, nir_var_mem_ssbo) { @@ -6261,10 +6249,6 @@ emit_module(struct ntd_context *ctx, const struct nir_to_dxil_options *opts) } nir_foreach_image_variable(var, ctx->shader) { - if (ctx->opts->environment == DXIL_ENVIRONMENT_VULKAN && - var && (var->data.access & ACCESS_NON_WRITEABLE)) - continue; // already handled in SRV - if (!emit_uav_var(ctx, var, glsl_type_get_image_count(var->type))) return false; }
