summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_texture.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2009-02-05 19:41:18 +0100
committerMichel Dänzer <[email protected]>2009-02-05 19:41:18 +0100
commit4617981ec72f7985941bee4b03c534d97ff96bc6 (patch)
treec3c8fb33499227cf4e3e905b3c04ff6599666663 /src/mesa/state_tracker/st_texture.c
parente0c3b4970da052308bf7b4e5cbe9186a4b8321db (diff)
gallium: No longer allow CPU mapping surfaces directly.
Instead, a new pipe_transfer object has to be created and mapped for transferring data between the CPU and a texture. This gives the driver more flexibility for textures in address spaces that aren't CPU accessible. This is a first pass; softpipe/xlib builds and runs glxgears, but it only shows a black window. Looks like something's off related to the Z buffer, so the depth test always fails.
Diffstat (limited to 'src/mesa/state_tracker/st_texture.c')
-rw-r--r--src/mesa/state_tracker/st_texture.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 63cfe5fc163..63a36324d42 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -191,19 +191,19 @@ st_texture_image_offset(const struct pipe_texture * pt,
*/
GLubyte *
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
- GLuint zoffset,
- GLuint flags )
+ GLuint zoffset, enum pipe_transfer_usage usage,
+ GLuint x, GLuint y, GLuint w, GLuint h)
{
struct pipe_screen *screen = st->pipe->screen;
struct pipe_texture *pt = stImage->pt;
DBG("%s \n", __FUNCTION__);
- stImage->surface = screen->get_tex_surface(screen, pt, stImage->face,
- stImage->level, zoffset,
- flags);
+ stImage->transfer = screen->get_tex_transfer(screen, pt, stImage->face,
+ stImage->level, zoffset,
+ usage, x, y, w, h);
- if (stImage->surface)
- return screen->surface_map(screen, stImage->surface, flags);
+ if (stImage->transfer)
+ return screen->transfer_map(screen, stImage->transfer);
else
return NULL;
}
@@ -217,9 +217,9 @@ st_texture_image_unmap(struct st_context *st,
DBG("%s\n", __FUNCTION__);
- screen->surface_unmap(screen, stImage->surface);
+ screen->transfer_unmap(screen, stImage->transfer);
- pipe_surface_reference(&stImage->surface, NULL);
+ screen->tex_transfer_release(screen, &stImage->transfer);
}
@@ -234,13 +234,13 @@ st_texture_image_unmap(struct st_context *st,
*/
static void
st_surface_data(struct pipe_context *pipe,
- struct pipe_surface *dst,
+ struct pipe_transfer *dst,
unsigned dstx, unsigned dsty,
const void *src, unsigned src_stride,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
struct pipe_screen *screen = pipe->screen;
- void *map = screen->surface_map(screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE);
+ void *map = screen->transfer_map(screen, dst);
pipe_copy_rect(map,
&dst->block,
@@ -250,7 +250,7 @@ st_surface_data(struct pipe_context *pipe,
src, src_stride,
srcx, srcy);
- screen->surface_unmap(screen, dst);
+ screen->transfer_unmap(screen, dst);
}
@@ -268,21 +268,23 @@ st_texture_image_data(struct pipe_context *pipe,
GLuint depth = dst->depth[level];
GLuint i;
const GLubyte *srcUB = src;
- struct pipe_surface *dst_surface;
+ struct pipe_transfer *dst_transfer;
DBG("%s\n", __FUNCTION__);
for (i = 0; i < depth; i++) {
- dst_surface = screen->get_tex_surface(screen, dst, face, level, i,
- PIPE_BUFFER_USAGE_CPU_WRITE);
+ dst_transfer = screen->get_tex_transfer(screen, dst, face, level, i,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ dst->width[level],
+ dst->height[level]);
- st_surface_data(pipe, dst_surface,
+ st_surface_data(pipe, dst_transfer,
0, 0, /* dstx, dsty */
srcUB,
src_row_stride,
0, 0, /* source x, y */
dst->width[level], dst->height[level]); /* width, height */
- screen->tex_surface_release(screen, &dst_surface);
+ screen->tex_transfer_release(screen, &dst_transfer);
srcUB += src_image_stride;
}