Mesa (master): mesa: fix texture view use of _mesa_get_tex_image()

Chris Forbes chrisf at kemper.freedesktop.org
Sat Dec 14 03:32:35 UTC 2013


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

Author: Chris Forbes <chrisf at ijw.co.nz>
Date:   Sun Dec  8 19:04:40 2013 +1300

mesa: fix texture view use of _mesa_get_tex_image()

The target parameter to _mesa_get_tex_image() is a target enum, not an index.
When we're setting up faces for a cubemap, it should be
CUBE_MAP_POSITIVE_X .. CUBE_MAP_NEGATIVE_Z; for all other targets it
should be the same as the texobj's target.

Fixes broken cubemaps [had only +X face but claimed to have all] produced by
glTextureView, which then caused various crashes in the driver when we
tried to use them.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/textureview.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index ab1bcfe..5f88a41 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -208,8 +208,13 @@ initialize_texture_fields(struct gl_context *ctx,
    /* Set up all the texture object's gl_texture_images */
    for (level = 0; level < levels; level++) {
       for (face = 0; face < numFaces; face++) {
-         struct gl_texture_image *texImage =
-                 _mesa_get_tex_image(ctx, texObj, face, level);
+         struct gl_texture_image *texImage;
+         GLenum faceTarget = target;
+
+         if (target == GL_TEXTURE_CUBE_MAP)
+            faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+
+         texImage = _mesa_get_tex_image(ctx, texObj, faceTarget, level);
 
          if (!texImage) {
             _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexStorage");




More information about the mesa-commit mailing list