Revert "microsoft/compiler: Use SRVs for read-only images"

This reverts commit 54c32aeba6.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22289>
This commit is contained in:
Pedro J. Estébanez
2023-04-04 20:27:09 +02:00
committed by Marge Bot
parent 88acbcadbb
commit 32e3c77a11
+7 -23
View File
@@ -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;
}