diff options
author | Marek Olšák <[email protected]> | 2012-10-08 04:06:42 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-10-11 21:12:16 +0200 |
commit | 369e46888904c6d379b8b477d9242cff1608e30e (patch) | |
tree | 528b10f900f23af3acd22a0edcf50fde0eeee86e /src/gallium/state_trackers/clover | |
parent | ec4c74a9dc10039d97ad24c4f16bd2400517991d (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/clover')
-rw-r--r-- | src/gallium/state_trackers/clover/core/resource.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/clover/core/resource.cpp b/src/gallium/state_trackers/clover/core/resource.cpp index 0c671f47388..80bcd2a851a 100644 --- a/src/gallium/state_trackers/clover/core/resource.cpp +++ b/src/gallium/state_trackers/clover/core/resource.cpp @@ -177,14 +177,10 @@ mapping::mapping(command_queue &q, resource &r, (flags & CL_MAP_READ ? PIPE_TRANSFER_READ : 0 ) | (blocking ? PIPE_TRANSFER_UNSYNCHRONIZED : 0)); - pxfer = pctx->get_transfer(pctx, r.pipe, 0, usage, - box(origin + r.offset, region)); - if (!pxfer) - throw error(CL_OUT_OF_RESOURCES); - - p = pctx->transfer_map(pctx, pxfer); + p = pctx->transfer_map(pctx, r.pipe, 0, usage, + box(origin + r.offset, region), &pxfer); if (!p) { - pctx->transfer_destroy(pctx, pxfer); + pxfer = NULL; throw error(CL_OUT_OF_RESOURCES); } } @@ -198,6 +194,5 @@ mapping::mapping(mapping &&m) : mapping::~mapping() { if (pxfer) { pctx->transfer_unmap(pctx, pxfer); - pctx->transfer_destroy(pctx, pxfer); } } |