OSDN Git Service

softpipe: Mark texture dirty when unmapped.
authorChia-I Wu <olvaffe@gmail.com>
Thu, 30 Jul 2009 16:42:41 +0000 (10:42 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 30 Jul 2009 16:42:46 +0000 (10:42 -0600)
When a texutre transfer is mapped for writing, mark the texture dirty
when unmapped.  This was done in surface creation, and this commit moves
it to happen in texture unmapping.

This fixes subtex test in progs/tests/.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/softpipe/sp_texture.c

index 7a533da..0c773e4 100644 (file)
@@ -224,12 +224,6 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
       if (ps->usage & PIPE_BUFFER_USAGE_GPU_READ)
          ps->usage |= PIPE_BUFFER_USAGE_CPU_READ;
 
-      if (ps->usage & (PIPE_BUFFER_USAGE_CPU_WRITE |
-                       PIPE_BUFFER_USAGE_GPU_WRITE)) {
-         /* Mark the surface as dirty.  The tile cache will look for this. */
-         spt->modified = TRUE;
-      }
-
       ps->face = face;
       ps->level = level;
       ps->zslice = zslice;
@@ -376,6 +370,11 @@ softpipe_transfer_unmap(struct pipe_screen *screen,
    spt = softpipe_texture(transfer->texture);
 
    pipe_buffer_unmap( screen, spt->buffer );
+
+   if (transfer->usage != PIPE_TRANSFER_READ) {
+      /* Mark the texture as dirty to expire the tile caches. */
+      spt->modified = TRUE;
+   }
 }