diff options
Diffstat (limited to 'src/clpp11.hpp')
-rw-r--r-- | src/clpp11.hpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp index 97045644..2335caef 100644 --- a/src/clpp11.hpp +++ b/src/clpp11.hpp @@ -668,6 +668,9 @@ class Buffer { // Copies from host to device: writing the device buffer a-synchronously void WriteAsync(const Queue &queue, const size_t size, const T* host, const size_t offset = 0) { + if (access_ == BufferAccess::kReadOnly) { + throw LogicError("Buffer: writing to a read-only buffer"); + } if (GetSize() < (offset+size)*sizeof(T)) { throw LogicError("Buffer: target device buffer is too small"); } |