Mesa (master): main: Add TEXTURE_CUBE_MAP support in CopyTextureSubImage3D.

Laura Ekstrand ldeks at kemper.freedesktop.org
Thu Mar 19 23:08:30 UTC 2015


Module: Mesa
Branch: master
Commit: 09bfa326a90a0ec1ddce0dc971d7d4b429884266
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=09bfa326a90a0ec1ddce0dc971d7d4b429884266

Author: Laura Ekstrand <laura at jlekstrand.net>
Date:   Tue Mar 17 12:55:41 2015 -0700

main: Add TEXTURE_CUBE_MAP support in CopyTextureSubImage3D.

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.

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>

---

 src/mesa/main/teximage.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 5516005..8d9d7cf 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -4242,9 +4242,17 @@ _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, self);
+   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, self);
+   }
+   else
+      _mesa_copy_texture_sub_image(ctx, 3, texObj, texObj->Target, level,
+                                   xoffset, yoffset, zoffset,
+                                   x, y, width, height, self);
 }
 
 static bool




More information about the mesa-commit mailing list