[Mesa-dev] [PATCH] gallium/radeon: fix partial layered transfers of cube (array) textures

Nicolai Hähnle nhaehnle at gmail.com
Mon May 9 16:40:11 UTC 2016


Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 09.05.2016 06:37, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> a staging cube texture with array_size % 6 != 0 doesn't work very well
>
> just use 2D_ARRAY or 2D for all staging textures
>
> Cc: 11.1 11.2 <mesa-stable at lists.freedesktop.org>
> ---
>   src/gallium/drivers/radeon/r600_texture.c | 21 ++++++---------------
>   1 file changed, 6 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
> index 67b2a34..5734a43 100644
> --- a/src/gallium/drivers/radeon/r600_texture.c
> +++ b/src/gallium/drivers/radeon/r600_texture.c
> @@ -169,8 +169,9 @@ static int r600_init_surface(struct r600_common_screen *rscreen,
>   		surface->flags |= RADEON_SURF_SET(RADEON_SURF_TYPE_1D_ARRAY, TYPE);
>   		surface->array_size = ptex->array_size;
>   		break;
> -	case PIPE_TEXTURE_2D_ARRAY:
>   	case PIPE_TEXTURE_CUBE_ARRAY: /* cube array layout like 2d array */
> +		assert(ptex->array_size % 6 == 0);
> +	case PIPE_TEXTURE_2D_ARRAY:
>   		surface->flags |= RADEON_SURF_SET(RADEON_SURF_TYPE_2D_ARRAY, TYPE);
>   		surface->array_size = ptex->array_size;
>   		break;
> @@ -1120,21 +1121,11 @@ static void r600_init_temp_resource_from_box(struct pipe_resource *res,
>   	res->flags = flags;
>
>   	/* We must set the correct texture target and dimensions for a 3D box. */
> -	if (box->depth > 1 && util_max_layer(orig, level) > 0)
> -		res->target = orig->target;
> -	else
> -		res->target = PIPE_TEXTURE_2D;
> -
> -	switch (res->target) {
> -	case PIPE_TEXTURE_1D_ARRAY:
> -	case PIPE_TEXTURE_2D_ARRAY:
> -	case PIPE_TEXTURE_CUBE_ARRAY:
> +	if (box->depth > 1 && util_max_layer(orig, level) > 0) {
> +		res->target = PIPE_TEXTURE_2D_ARRAY;
>   		res->array_size = box->depth;
> -		break;
> -	case PIPE_TEXTURE_3D:
> -		res->depth0 = box->depth;
> -		break;
> -	default:;
> +	} else {
> +		res->target = PIPE_TEXTURE_2D;
>   	}
>   }
>
>


More information about the mesa-dev mailing list