summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/glx
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-10-08 04:06:42 +0200
committerMarek Olšák <[email protected]>2012-10-11 21:12:16 +0200
commit369e46888904c6d379b8b477d9242cff1608e30e (patch)
tree528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/state_trackers/glx
parentec4c74a9dc10039d97ad24c4f16bd2400517991d (diff)
gallium: unify transfer functions
"get_transfer + transfer_map" becomes "transfer_map". "transfer_unmap + transfer_destroy" becomes "transfer_unmap". transfer_map must create and return the transfer object and transfer_unmap must destroy it. transfer_map is successful if the returned buffer pointer is not NULL. If transfer_map fails, the pointer to the transfer object remains unchanged (i.e. doesn't have to be NULL). Acked-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/glx')
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 7e915567a43..607584f0195 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1368,12 +1368,12 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
internal_format = choose_pixel_format(drawable->xm_visual);
- tex_xfer = pipe_get_transfer(pipe, res,
- 0, 0, /* level, layer */
- PIPE_TRANSFER_WRITE,
- x, y,
- w, h);
- if (!tex_xfer)
+ map = pipe_transfer_map(pipe, res,
+ 0, 0, /* level, layer */
+ PIPE_TRANSFER_WRITE,
+ x, y,
+ w, h, &tex_xfer);
+ if (!map)
return;
/* Grab the XImage that we want to turn into a texture. */
@@ -1385,14 +1385,7 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
ZPixmap);
if (!img) {
- pipe_transfer_destroy(pipe, tex_xfer);
- return;
- }
-
- map = pipe_transfer_map(pipe, tex_xfer);
-
- if (!map) {
- pipe_transfer_destroy(pipe, tex_xfer);
+ pipe_transfer_unmap(pipe, tex_xfer);
return;
}
@@ -1407,8 +1400,6 @@ XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
pipe_transfer_unmap(pipe, tex_xfer);
- pipe_transfer_destroy(pipe, tex_xfer);
-
st->teximage(st,
ST_TEXTURE_2D,
0, /* level */