diff options
author | Bruno Jiménez <[email protected]> | 2014-08-07 16:34:53 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2014-08-08 18:06:14 +0300 |
commit | ec73778f1fd6e14623422d62605fc69dc8fb7aa4 (patch) | |
tree | 72b3c00bc98623e7088ea9a68478be28f031e3a1 /src/gallium/state_trackers/clover/api/transfer.cpp | |
parent | 8d853468bd8c75b8e15c572d85ae403ab4ec4086 (diff) |
clover: Add support for CL_MAP_WRITE_INVALIDATE_REGION
OpenCL 1.2 CL_MAP_WRITE_INVALIDATE_REGION sounds a lot like
PIPE_TRANSFER_DISCARD_RANGE:
From OpenCL 1.2 spec:
The contents of the region being mapped are to be discarded.
From p_defines.h:
Discards the memory within the mapped region.
v2: Move the code for validating flags to the front-end as
suggested by Francisco Jerez
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/clover/api/transfer.cpp')
-rw-r--r-- | src/gallium/state_trackers/clover/api/transfer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/clover/api/transfer.cpp b/src/gallium/state_trackers/clover/api/transfer.cpp index 07d8a7307f2..b8d7771e62a 100644 --- a/src/gallium/state_trackers/clover/api/transfer.cpp +++ b/src/gallium/state_trackers/clover/api/transfer.cpp @@ -168,6 +168,16 @@ namespace { } /// + /// Checks that the mapping flags are correct. + /// + void + validate_flags(const cl_map_flags flags) { + if ((flags & (CL_MAP_WRITE | CL_MAP_READ)) && + (flags & CL_MAP_WRITE_INVALIDATE_REGION)) + throw error(CL_INVALID_VALUE); + } + + /// /// Class that encapsulates the task of mapping an object of type /// \a T. The return value of get() should be implicitly /// convertible to \a void *. @@ -629,6 +639,7 @@ clEnqueueMapBuffer(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, validate_common(q, deps); validate_object(q, mem, obj_origin, obj_pitch, region); + validate_flags(flags); void *map = mem.resource(q).add_map(q, flags, blocking, obj_origin, region); @@ -656,6 +667,7 @@ clEnqueueMapImage(cl_command_queue d_q, cl_mem d_mem, cl_bool blocking, validate_common(q, deps); validate_object(q, img, origin, region); + validate_flags(flags); void *map = img.resource(q).add_map(q, flags, blocking, origin, region); |