summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_texture.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom-at-vmware-dot-com>2009-04-17 11:47:30 +0200
committerThomas Hellstrom <thellstrom-at-vmware-dot-com>2009-04-17 13:18:05 +0200
commite50dd26ca6d0eb0d0f97c2780020ea16e3d4a687 (patch)
tree9f5e533b888576b93fa3d0873d568c81baeed4d8 /src/mesa/state_tracker/st_texture.c
parentee2a5f307a026c1c258d3f7616d46cc7230d77ce (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_texture.c')
-rw-r--r--src/mesa/state_tracker/st_texture.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index fcbaeb69894..10faa633ea8 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -30,6 +30,7 @@
#include "st_public.h"
#include "st_texture.h"
#include "st_cb_fbo.h"
+#include "st_inlines.h"
#include "main/enums.h"
#include "main/teximage.h"
#include "main/texstore.h"
@@ -194,9 +195,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
DBG("%s \n", __FUNCTION__);
- stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face,
- stImage->level, zoffset,
- usage, x, y, w, h);
+ stImage->transfer = st_no_flush_get_tex_transfer(st, pt, stImage->face,
+ stImage->level, zoffset,
+ usage, x, y, w, h);
if (stImage->transfer)
return screen->transfer_map(screen, stImage->transfer);
@@ -253,13 +254,14 @@ st_surface_data(struct pipe_context *pipe,
/* Upload data for a particular image.
*/
void
-st_texture_image_data(struct pipe_context *pipe,
+st_texture_image_data(struct st_context *st,
struct pipe_texture *dst,
GLuint face,
GLuint level,
void *src,
GLuint src_row_stride, GLuint src_image_stride)
{
+ struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
GLuint depth = dst->depth[level];
GLuint i;
@@ -269,10 +271,10 @@ st_texture_image_data(struct pipe_context *pipe,
DBG("%s\n", __FUNCTION__);
for (i = 0; i < depth; i++) {
- dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i,
- PIPE_TRANSFER_WRITE, 0, 0,
- dst->width[level],
- dst->height[level]);
+ dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ dst->width[level],
+ dst->height[level]);
st_surface_data(pipe, dst_transfer,
0, 0, /* dstx, dsty */