From 96d124092f1bfa4a60dee142306394bae73fc7b4 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 2 Jul 2025 14:03:26 +0200 Subject: [PATCH] st/pbo: use sized nir-types for download-path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Midgard compiler only deals with sized NIR types for image loads and stores. Since we already have nir_get_nir_type_for_glsl_base_type() which can provide us with the corresponding sized type, let's just use that, and drop the extra table. This fixes the following piglits on Mali-T760: - spec/ext_texture_compression_s3tc/getteximage-targets 2d s3tc - spec/ext_texture_compression_s3tc/getteximage-targets cube s3tc Fixes: 9123ee0f185 ("st/mesa/pbo: Set src type on image_store") Reviewed-by: Marek Olšák Reviewed-by: Rob Clark Part-of: --- src/mesa/state_tracker/st_pbo.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c index 3edd6a5c182..ac3eaebdc9a 100644 --- a/src/mesa/state_tracker/st_pbo.c +++ b/src/mesa/state_tracker/st_pbo.c @@ -531,24 +531,21 @@ create_fs(struct st_context *st, bool download, result = nir_umin(&b, result, nir_imm_int(&b, (1u << 31) - 1)); if (download) { - static const enum glsl_base_type type[] = { + static const enum glsl_base_type types[] = { [ST_PBO_CONVERT_FLOAT] = GLSL_TYPE_FLOAT, [ST_PBO_CONVERT_UINT] = GLSL_TYPE_UINT, [ST_PBO_CONVERT_UINT_TO_SINT] = GLSL_TYPE_INT, [ST_PBO_CONVERT_SINT] = GLSL_TYPE_INT, [ST_PBO_CONVERT_SINT_TO_UINT] = GLSL_TYPE_UINT, }; - static const nir_alu_type nir_types[] = { - [ST_PBO_CONVERT_FLOAT] = nir_type_float, - [ST_PBO_CONVERT_UINT] = nir_type_uint, - [ST_PBO_CONVERT_UINT_TO_SINT] = nir_type_int, - [ST_PBO_CONVERT_SINT] = nir_type_int, - [ST_PBO_CONVERT_SINT_TO_UINT] = nir_type_uint, - }; + + enum glsl_base_type glsl_type = types[conversion]; + nir_alu_type nir_type = nir_get_nir_type_for_glsl_base_type(glsl_type); + nir_variable *img_var = nir_variable_create(b.shader, nir_var_image, glsl_image_type(GLSL_SAMPLER_DIM_BUF, false, - type[conversion]), "img"); + glsl_type), "img"); img_var->data.access = ACCESS_NON_READABLE; img_var->data.explicit_binding = true; img_var->data.binding = 0; @@ -560,7 +557,7 @@ create_fs(struct st_context *st, bool download, zero, result, nir_imm_int(&b, 0), - .src_type = nir_types[conversion], + .src_type = nir_type, .image_dim = GLSL_SAMPLER_DIM_BUF); } else { nir_store_output(&b, result, nir_imm_int(&b, 0),