summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe/sp_tile_cache.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-12-07 12:30:35 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2007-12-07 12:30:35 +0100
commitb859cdf6f191b4d8b56537c8dc30082a7e2d94b3 (patch)
tree4bd3149cc81a2fb6434282a70b34361f94710cfd /src/mesa/pipe/softpipe/sp_tile_cache.c
parent987d59bb83e9e08192563e5f1b52949c5511053c (diff)
Eliminate struct pipe_region.
Directly use struct pipe_buffer_handle for storage and struct pipe_surface for (un)mapping.
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_tile_cache.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/mesa/pipe/softpipe/sp_tile_cache.c
index 62ee6a27c9..08cd39cc55 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.c
+++ b/src/mesa/pipe/softpipe/sp_tile_cache.c
@@ -123,16 +123,24 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
void
-sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
+sp_tile_cache_set_surface(struct softpipe_context *sp,
+ struct softpipe_tile_cache *tc,
struct pipe_surface *ps)
{
+ if (tc->surface && tc->surface->map)
+ pipe_surface_unmap(tc->surface);
+
pipe_surface_reference(&tc->surface, ps);
}
struct pipe_surface *
-sp_tile_cache_get_surface(struct softpipe_tile_cache *tc)
+sp_tile_cache_get_surface(struct softpipe_context *sp,
+ struct softpipe_tile_cache *tc)
{
+ if (tc->surface && !tc->surface->map)
+ pipe_surface_map(tc->surface);
+
return tc->surface;
}
@@ -162,7 +170,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
boolean is_depth_stencil;
int inuse = 0, pos;
- if (!ps || !ps->region || !ps->region->map)
+ if (!ps || !ps->buffer)
return;
is_depth_stencil = (ps->format == PIPE_FORMAT_S8_Z24 ||
@@ -367,6 +375,16 @@ sp_get_cached_tile_tex(struct pipe_context *pipe,
struct pipe_surface *ps
= pipe->get_tex_surface(pipe, tc->texture, face, level, z);
+ if (ps != tc->surface) {
+ if (tc->surface && tc->surface->map)
+ pipe_surface_unmap(tc->surface);
+
+ pipe_surface_reference(&tc->surface, ps);
+
+ if (!tc->surface->map)
+ pipe_surface_map(tc->surface);
+ }
+
pipe->get_tile_rgba(pipe, ps,
tile_x, tile_y, TILE_SIZE, TILE_SIZE,
(float *) tile->data.color);