diff options
author | Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 2009-04-17 11:47:30 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 2009-04-17 13:18:05 +0200 |
commit | e50dd26ca6d0eb0d0f97c2780020ea16e3d4a687 (patch) | |
tree | 9f5e533b888576b93fa3d0873d568c81baeed4d8 /src/mesa/state_tracker/st_cb_texture.c | |
parent | ee2a5f307a026c1c258d3f7616d46cc7230d77ce (diff) |
gallium: Create OGL state tracker wrappers for various CPU access operations.
There are two usage types of buffer CPU accesses:
One where we try to use the buffer contents for multiple draw commands in
a batch. (batch := sequence of commands that are flushed together),
like incrementally adding bitmaps to a bitmap texture that is reallocated
on flush.
And one where we assume we can safely overwrite the old buffer contexts, like
glTexSubImage. In this case we need to make sure all old drawing commands
referencing the buffer are flushed before we map the buffer.
This is easily forgotten.
Add wrappers for the most common of these operations. The first type is
prefixed with "st_no_flush" and the second type is prefixed with
"st_cond_flush", where "cond" indicates that we attmpt to only flush
if there is indeed unflushed draw commands referencing the buffer.
Prefixed functions are
screen::get_tex_transfer
pipe_buffer_write
pipe_buffer_read
pipe_buffer_map
Please use the wrappers whenever possible.
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 98dc6ec74d..94e340b7e9 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -50,6 +50,7 @@ #include "state_tracker/st_public.h" #include "state_tracker/st_texture.h" #include "state_tracker/st_gen_mipmap.h" +#include "state_tracker/st_inlines.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" @@ -465,10 +466,10 @@ compress_with_blit(GLcontext * ctx, /* Put user's tex data into the temporary texture */ - tex_xfer = screen->get_tex_transfer(screen, src_tex, - face, level, 0, - PIPE_TRANSFER_WRITE, - 0, 0, width, height); /* x, y, w, h */ + tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), src_tex, + face, level, 0, + PIPE_TRANSFER_WRITE, + 0, 0, width, height); /* x, y, w, h */ map = screen->transfer_map(screen, tex_xfer); mesa_format->StoreImage(ctx, 2, GL_RGBA, mesa_format, @@ -858,9 +859,10 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, PIPE_TEX_MIPFILTER_NEAREST); /* map the dst_surface so we can read from it */ - tex_xfer = screen->get_tex_transfer(screen, dst_texture, 0, 0, 0, - PIPE_TRANSFER_READ, - 0, 0, width, height); + tex_xfer = st_cond_flush_get_tex_transfer(st_context(ctx), + dst_texture, 0, 0, 0, + PIPE_TRANSFER_READ, + 0, 0, width, height); pixels = _mesa_map_readpix_pbo(ctx, &ctx->Pack, pixels); @@ -1192,15 +1194,12 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcY = strb->Base.Height - srcY - height; } - st_teximage_flush_before_map(ctx->st, strb->texture, 0, 0, - PIPE_TRANSFER_READ); - - src_trans = screen->get_tex_transfer( screen, - strb->texture, - 0, 0, 0, - PIPE_TRANSFER_READ, - srcX, srcY, - width, height); + src_trans = st_cond_flush_get_tex_transfer( st_context(ctx), + strb->texture, + 0, 0, 0, + PIPE_TRANSFER_READ, + srcX, srcY, + width, height); st_teximage_flush_before_map(ctx->st, stImage->pt, 0, 0, PIPE_TRANSFER_WRITE); @@ -1589,7 +1588,7 @@ copy_image_data_to_texture(struct st_context *st, PIPE_TRANSFER_WRITE); - st_texture_image_data(st->pipe, + st_texture_image_data(st, stObj->pt, stImage->face, dstLevel, |