st/pbo: use sized nir-types for download-path

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: 9123ee0f18 ("st/mesa/pbo: Set src type on image_store")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35882>
This commit is contained in:
Erik Faye-Lund
2025-07-02 14:03:26 +02:00
committed by Marge Bot
parent 2af3ef9305
commit 96d124092f
+7 -10
View File
@@ -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),