Mesa (master): r300g: Slightly saner initialization of some texture / transfer fields.

Michel Dänzer daenzer at kemper.freedesktop.org
Tue Aug 4 08:59:17 UTC 2009


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

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Tue Aug  4 10:57:47 2009 +0200

r300g: Slightly saner initialization of some texture / transfer fields.

---

 src/gallium/drivers/r300/r300_screen.c  |    5 +++--
 src/gallium/drivers/r300/r300_texture.c |    6 ++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 258e4ac..96a7304 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -322,13 +322,14 @@ r300_get_tex_transfer(struct pipe_screen *screen,
     trans = CALLOC_STRUCT(r300_transfer);
     if (trans) {
         pipe_texture_reference(&trans->transfer.texture, texture);
-        trans->transfer.format = trans->transfer.format;
+        trans->transfer.format = texture->format;
         trans->transfer.width = w;
         trans->transfer.height = h;
         trans->transfer.block = texture->block;
         trans->transfer.nblocksx = texture->nblocksx[level];
         trans->transfer.nblocksy = texture->nblocksy[level];
-        trans->transfer.stride = tex->stride;
+        trans->transfer.stride = align(pf_get_stride(&trans->transfer.block,
+                                                     texture->width[level]), 32);
         trans->transfer.usage = usage;
         trans->offset = offset;
     }
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index daf1647..0164f05 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -81,13 +81,11 @@ static void r300_setup_miptree(struct r300_texture* tex)
          * XXX
          * POT, uncompressed, unmippmapped textures can be aligned to 32,
          * instead of 64. */
-        stride = align(
-                (base->nblocksx[i] * base->block.size) / base->block.width,
-                32);
+        stride = align(pf_get_stride(&base->block, base->width[i]), 32);
         size = stride * base->nblocksy[i] * base->depth[i];
 
         tex->offset[i] = align(tex->size, 32);
-        tex->size += tex->offset[i] + size;
+        tex->size = tex->offset[i] + size;
 
         debug_printf("r300: Texture miptree: Level %d "
                 "(%dx%dx%d px, pitch %d bytes)\n",




More information about the mesa-commit mailing list