gallium: add face, dirtyLevels params to pipe->texture_update()
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 19 Mar 2008 23:08:16 +0000 (17:08 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 19 Mar 2008 23:15:14 +0000 (17:15 -0600)
This provides better information about which images in texture object have changed.
Also, call texture_update() from more places previously missed.

12 files changed:
src/gallium/auxiliary/draw/draw_aaline.c
src/gallium/auxiliary/draw/draw_pstipple.c
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/drivers/cell/ppu/cell_texture.c
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i965simple/brw_tex_layout.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/include/pipe/p_context.h
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_texture.h

index f2b983374e64be5d8d65fb63de6febba3e9badfb..b4fa6bd9670cfc8d1f0ded6df8b5c5f7b7c2a93e 100644 (file)
@@ -410,6 +410,7 @@ aaline_create_texture(struct aaline_stage *aaline)
       /* unmap */
       pipe_surface_unmap(surface);
       pipe_surface_reference(&surface, NULL);
+      pipe->texture_update(pipe, aaline->texture, 0, (1 << level));
    }
 }
 
index 09d542002f0341f9f78dca5042e7b3c1c5903c65..9d154a6838168f59d09a3d3529292868f766a18f 100644 (file)
@@ -374,7 +374,7 @@ pstip_update_texture(struct pstip_stage *pstip)
    /* unmap */
    pipe_surface_unmap(surface);
    pipe_surface_reference(&surface, NULL);
-   pipe->texture_update(pipe, pstip->texture);
+   pipe->texture_update(pipe, pstip->texture, 0, 0x1);
 }
 
 
index 27141c4d13f63d92e4c5cbb670a3daa9169e6860..028b180a77776b6d5d94d6491521204b8c43a306 100644 (file)
@@ -872,7 +872,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
 
       pipe->flush(pipe, PIPE_FLUSH_WAIT);
 
-      /*pipe->texture_update(pipe, pt);  not really needed */
+      /* need to signal that the texture has changed _after_ rendering to it */
+      pipe->texture_update(pipe, pt, face, (1 << dstLevel));
    }
 
    /* restore state we changed */
index e235421107e022c955904e7fc335166177f5f19a..9c694e136d8cfd23993c6d9534144e78b291f871 100644 (file)
@@ -134,7 +134,8 @@ cell_texture_release_screen(struct pipe_screen *screen,
 
 
 static void
-cell_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
+cell_texture_update(struct pipe_context *pipe, struct pipe_texture *texture,
+                    uint face, uint levelsMask)
 {
    /* XXX TO DO:  re-tile the texture data ... */
 
index ef5adff550e29519a301c090df8428a08828ca33..c39e747705b040243608b4017a0e76b0b7df217d 100644 (file)
@@ -542,7 +542,8 @@ i915_texture_release_screen(struct pipe_screen *screen,
 
 
 static void
-i915_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
+i915_texture_update(struct pipe_context *pipe, struct pipe_texture *texture,
+                    uint face, uint levelsMask)
 {
    /* no-op? */
 }
index b24ac87c378e26643b71ea14d01ecf945a255e88..b580f98204c745c19fd6e729f43aec4590c4bcc8 100644 (file)
@@ -358,7 +358,8 @@ brw_texture_release_screen(struct pipe_screen *screen,
 
 
 static void
-brw_texture_update(struct pipe_context *pipe, struct pipe_texture *texture)
+brw_texture_update(struct pipe_context *pipe, struct pipe_texture *texture,
+                   uint face, uint levelsMask)
 {
    /* no-op? */
 }
index 64bf353aa4a69f5b6be22ea6867eff647727197b..a98b3b1a4a88930e97e07233a75ac50792dc803d 100644 (file)
@@ -174,7 +174,8 @@ softpipe_get_tex_surface_screen(struct pipe_screen *screen,
 
 static void
 softpipe_texture_update(struct pipe_context *pipe,
-                        struct pipe_texture *texture)
+                        struct pipe_texture *texture,
+                        uint face, uint levelsMask)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
    uint unit;
index b64948f0f3bcdad8190e07b9543a1a4328504d58..a3824601be997c23430a78f7adf3dc30290dcb6c 100644 (file)
@@ -192,12 +192,10 @@ struct pipe_context {
 
    /**
     * Called when texture data is changed.
-    * Note: we could pass some hints about which mip levels or cube faces
-    * have changed...
-    * XXX this may go away - could pass a 'write' flag to get_tex_surface()
     */
    void (*texture_update)(struct pipe_context *pipe,
-                          struct pipe_texture *texture);
+                          struct pipe_texture *texture,
+                          uint face, uint dirtyLevelsMask);
 
 
 
index e53a897637c06450c183f7c71c331041c99d1b91..2a711e513df34a3002453ab3dc0ac29739ac399a 100644 (file)
@@ -76,11 +76,6 @@ update_textures(struct st_context *st)
 
       pt = st_get_stobj_texture(stObj);
       pipe_texture_reference(&st->state.sampler_texture[unit], pt);
-
-      if (stObj && stObj->dirtyData) {
-         st->pipe->texture_update(st->pipe, pt);
-         stObj->dirtyData = GL_FALSE;
-      }
    }
 
    st->pipe->set_sampler_textures(st->pipe, st->state.num_textures,
index 33d34445ee0f975c9caa2e1fd85200d0b5cf64e0..99d5e3e848f918a32164885b90c67695a577ff68 100644 (file)
@@ -513,6 +513,8 @@ make_texture(struct st_context *st,
       /* unmap */
       pipe_surface_unmap(surface);
       pipe_surface_reference(&surface, NULL);
+      pipe->texture_update(pipe, pt, 0, 0x1);
+
       assert(success);
 
       /* restore */
@@ -1100,6 +1102,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
    /* Release surface */
    pipe_surface_unmap(surface);
    pipe_surface_reference(&surface, NULL);
+   pipe->texture_update(pipe, pt, 0, 0x1);
 
    pt->format = format;
 
index d4731c77373df53cca50c1a99495a2273295bd1d..306b27c423562fb79cded7d9124b43e35e25e92f 100644 (file)
@@ -476,6 +476,7 @@ st_TexImage(GLcontext * ctx,
             struct gl_texture_image *texImage,
             GLsizei imageSize, int compressed)
 {
+   struct pipe_context *pipe = ctx->st->pipe;
    struct st_texture_object *stObj = st_texture_object(texObj);
    struct st_texture_image *stImage = st_texture_image(texImage);
    GLint postConvWidth, postConvHeight;
@@ -690,8 +691,8 @@ st_TexImage(GLcontext * ctx,
       texImage->Data = NULL;
    }
 
-   /* flag data as dirty */
-   stObj->dirtyData = GL_TRUE;
+   if (stObj->pt)
+      pipe->texture_update(pipe, stObj->pt, stImage->face, (1 << level));
 
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
       ctx->Driver.GenerateMipmap(ctx, target, texObj);
@@ -866,6 +867,7 @@ st_TexSubimage(GLcontext * ctx,
                  struct gl_texture_object *texObj,
                  struct gl_texture_image *texImage)
 {
+   struct pipe_context *pipe = ctx->st->pipe;
    struct st_texture_object *stObj = st_texture_object(texObj);
    struct st_texture_image *stImage = st_texture_image(texImage);
    GLuint dstRowStride;
@@ -924,8 +926,7 @@ st_TexSubimage(GLcontext * ctx,
       texImage->Data = NULL;
    }
 
-   /* flag data as dirty */
-   stObj->dirtyData = GL_TRUE;
+   pipe->texture_update(pipe, stObj->pt, stImage->face, (1 << level));
 }
 
 
@@ -1179,8 +1180,7 @@ do_copy_texsubimage(GLcontext *ctx,
 
    pipe_surface_reference(&dest_surface, NULL);
 
-   /* flag data as dirty */
-   stObj->dirtyData = GL_TRUE;
+   pipe->texture_update(pipe, stObj->pt, stImage->face, (1 << level));
 
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
       ctx->Driver.GenerateMipmap(ctx, target, texObj);
@@ -1481,6 +1481,7 @@ st_finalize_texture(GLcontext *ctx,
          if (stImage && stObj->pt != stImage->pt) {
             copy_image_data_to_texture(ctx->st, stObj, level, stImage);
            *needFlush = GL_TRUE;
+            pipe->texture_update(pipe, stObj->pt, face, (1 << level));
          }
       }
    }
index 78f5f451ed62b1978a4687e1032a8a5153304e07..7abccb3a69faa1bd9db34616d0f58afad354fd97 100644 (file)
@@ -71,8 +71,6 @@ struct st_texture_object
    GLboolean imageOverride;
    GLint depthOverride;
    GLuint pitchOverride;
-
-   GLboolean dirtyData;
 };