}
}
+ ///
+ /// 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
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);
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);
pctx(q.pipe) {
unsigned usage = ((flags & CL_MAP_WRITE ? PIPE_TRANSFER_WRITE : 0 ) |
(flags & CL_MAP_READ ? PIPE_TRANSFER_READ : 0 ) |
+ (flags & CL_MAP_WRITE_INVALIDATE_REGION ?
+ PIPE_TRANSFER_DISCARD_RANGE : 0) |
(!blocking ? PIPE_TRANSFER_UNSYNCHRONIZED : 0));
p = pctx->transfer_map(pctx, r.pipe, 0, usage,