radeonsi: don't declare 3D coordinates in the compute blit if they aren't needed

This eliminates the 3rd coordinate VGPR.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28917>
This commit is contained in:
Marek Olšák 2024-03-25 14:04:00 -04:00 committed by Marge Bot
parent 07fa635f11
commit 269ab6cc62
3 changed files with 14 additions and 2 deletions

View file

@ -1116,6 +1116,16 @@ bool si_compute_blit(struct si_context *sctx, const struct pipe_blit_info *info,
info->dst.resource->target == PIPE_TEXTURE_1D_ARRAY;
options.src_is_msaa = info->src.resource->nr_samples > 1;
options.dst_is_msaa = info->dst.resource->nr_samples > 1;
options.src_has_z = info->src.resource->target == PIPE_TEXTURE_3D ||
info->src.resource->target == PIPE_TEXTURE_CUBE ||
info->src.resource->target == PIPE_TEXTURE_1D_ARRAY ||
info->src.resource->target == PIPE_TEXTURE_2D_ARRAY ||
info->src.resource->target == PIPE_TEXTURE_CUBE_ARRAY;
options.dst_has_z = info->dst.resource->target == PIPE_TEXTURE_3D ||
info->dst.resource->target == PIPE_TEXTURE_CUBE ||
info->dst.resource->target == PIPE_TEXTURE_1D_ARRAY ||
info->dst.resource->target == PIPE_TEXTURE_2D_ARRAY ||
info->dst.resource->target == PIPE_TEXTURE_CUBE_ARRAY;
/* Resolving integer formats only copies sample 0. log2_samples is then unused. */
options.sample0_only = options.src_is_msaa && !options.dst_is_msaa &&
util_format_is_pure_integer(info->src.format);

View file

@ -1645,6 +1645,8 @@ union si_compute_blit_shader_key {
bool dst_is_1d:1;
bool src_is_msaa:1;
bool dst_is_msaa:1;
bool src_has_z:1;
bool dst_has_z:1;
uint8_t log2_samples:4;
bool sample0_only:1; /* src is MSAA, dst is not MSAA, log2_samples is ignored */
/* Source coordinate modifiers. */

View file

@ -419,10 +419,10 @@ void *si_create_blit_cs(struct si_context *sctx, const union si_compute_blit_sha
const struct glsl_type *img_type[2] = {
glsl_image_type(options->src_is_1d ? GLSL_SAMPLER_DIM_1D :
options->src_is_msaa ? GLSL_SAMPLER_DIM_MS : GLSL_SAMPLER_DIM_2D,
/*is_array*/ true, GLSL_TYPE_FLOAT),
options->src_has_z, GLSL_TYPE_FLOAT),
glsl_image_type(options->dst_is_1d ? GLSL_SAMPLER_DIM_1D :
options->dst_is_msaa ? GLSL_SAMPLER_DIM_MS : GLSL_SAMPLER_DIM_2D,
/*is_array*/ true, GLSL_TYPE_FLOAT),
options->dst_has_z, GLSL_TYPE_FLOAT),
};
nir_variable *img_src = nir_variable_create(b.shader, nir_var_uniform, img_type[0], "img0");