Skip to content

Commit

Permalink
properly calculate size of buffer to map when using cl.enqueueMapImage
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgal committed Oct 9, 2017
1 parent 683d84d commit 0e91c67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/commandqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,10 @@ NAN_METHOD(EnqueueMapImage) {

CHECK_ERR(err)

size_t size = image_row_pitch*region[1]*region[2];

size_t size = image_row_pitch * region[1];
if (image_slice_pitch) {
size = image_slice_pitch * region[2];
}
Local<v8::ArrayBuffer> obj = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), mPtr, size);

obj->Set(JS_STR("image_row_pitch"), Nan::New(static_cast<int>(image_row_pitch)));
Expand Down

0 comments on commit 0e91c67

Please sign in to comment.