[Mesa-dev] [PATCH] st/mesa: align cube map arrays layers

Ilia Mirkin imirkin at alum.mit.edu
Tue Apr 7 17:43:24 PDT 2015


On Tue, Apr 7, 2015 at 8:02 PM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> We create textures internally for texsubimage, and we use
> the values from sub image to create a new texture, however
> we don't align these to valid sizes, and cube map arrays
> must have an array size aligned to 6.
>
> This fixes texsubimage cube_map_array on CAYMAN at least,
> (it was causing  GPU hang and bad values), it probably
> also fixes it on radeonsi and evergreen.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/state_tracker/st_texture.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
> index ca7c83c..5c9a09c 100644
> --- a/src/mesa/state_tracker/st_texture.c
> +++ b/src/mesa/state_tracker/st_texture.c
> @@ -177,6 +177,8 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture,
>        *widthOut = widthIn;
>        *heightOut = heightIn;
>        *depthOut = 1;
> +      if (depthIn % 6)
> +         depthIn = util_align_npot(depthIn, 6);
>        *layersOut = depthIn;

I'd just do this as

*layersOut = util_align_npot(depthIn, 6)

But I assume this is the st_TexSubImage caller? Then I bet that instead

   /* TexSubImage only sets a single cubemap face. */
   if (gl_target == GL_TEXTURE_CUBE_MAP) {
      gl_target = GL_TEXTURE_2D;
   }

Should be changed to account for cube map arrays...

  -ilia


More information about the mesa-dev mailing list