OSDN Git Service

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 f2b9833..b4fa6bd 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 09d5420..9d154a6 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 27141c4..028b180 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 e235421..9c694e1 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 ef5adff..c39e747 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 b24ac87..b580f98 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 64bf353..a98b3b1 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 b64948f..a382460 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 e53a897..2a711e5 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 33d3444..99d5e3e 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 d4731c7..306b27c 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 78f5f45..7abccb3 100644 (file)
@@ -71,8 +71,6 @@ struct st_texture_object
    GLboolean imageOverride;
    GLint depthOverride;
    GLuint pitchOverride;
-
-   GLboolean dirtyData;
 };