[Mesa-dev] [PATCH] main: Add TEXTURE_CUBE_MAP support in CopyTextureSubImage3D.

Anuj Phogat anuj.phogat at gmail.com
Wed Mar 18 15:15:02 PDT 2015


On Wed, Mar 18, 2015 at 1:06 PM, Laura Ekstrand <laura at jlekstrand.net> wrote:
> So it turns out that this doesn't actually fix any bugs or add any features,
> stictly speaking. However, it does avoid a lot of kludginess.  Previously, if
> you called
>
> glCopyTextureSubImage3D(texcube, 0, 0, 0, zoffset = 3, ...
>
> it would grab the texture image object for face = 0 in teximage.c instead of
> the desired face = 3.  But Line 274 of brw_blorp_blit.cpp would correct for
> this by updating the slice to 3.
>
> This commit does the correct thing before calling any drivers,
> which should make the functionality much more robust and uniform across all
> drivers.
Idea behind this patch looks good to me.
> ---
>  src/mesa/main/teximage.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 64e4816..8b56d5b 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -4254,9 +4254,18 @@ _mesa_CopyTextureSubImage3D(GLuint texture, GLint level,
>        return;
>     }
>
> -   _mesa_copy_texture_sub_image(ctx, 3, texObj, texObj->Target, level,
> -                                xoffset, yoffset, zoffset,
> -                                x, y, width, height, true);
> +   if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
> +      /* Act like CopyTexSubImage2D */
> +      _mesa_copy_texture_sub_image(ctx, 2, texObj,
> +                                   GL_TEXTURE_CUBE_MAP_POSITIVE_X + zoffset,
> +                                   level,
> +                                   xoffset, yoffset, 0,
> +                                   x, y, width, height, false);
Parameters in above three lines can easily fit in 2 lines.
Passing dsa=false and dims = 2 will print incorrect _mesa_debug  / _mesa_error
message in _mesa_copy_texture_sub_image() and copytexsubimage_error_check().

> +   }
> +   else
> +      _mesa_copy_texture_sub_image(ctx, 3, texObj, texObj->Target, level,
> +                                   xoffset, yoffset, zoffset,
> +                                   x, y, width, height, true);
>  }
>
>  static bool
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list