summaryrefslogtreecommitdiff
path: root/src/clpp11.hpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-10-17 19:56:47 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2017-10-17 19:56:47 +0200
commitb1270f04b89c3271aca11594501f7e997848e394 (patch)
treead5de2b87b6885e6b4e43bd84f6ccfb4bc0d3786 /src/clpp11.hpp
parentf349731d5498f484995514112551c1b60ca4f6d3 (diff)
Made buffers of batched routines read/write (was: read-only)
Diffstat (limited to 'src/clpp11.hpp')
-rw-r--r--src/clpp11.hpp3
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");
}