WebCL WEBCL_html_image Extension Draft Specification
Name
WEBCL_html_image
Contact
WebCL
working group (public_webcl 'at' khronos.org)
Contributors
Steven Eliuk, Samsung Electronics,
Tomi Aarnio, Nokia Research,
Members of the WebCL working group.
Version
Last modified date: December 10, 2013
Revision: 2
Number
WebCL extension #4
Dependencies
Written against the WebCL API 1.0 specification.
Overview
The HTML Image Sharing extension makes it more convenient and
potentially faster for applications to transfer image data from
HTML Image / Canvas elements to WebCL memory objects, and
vice versa. The extension is enabled by
calling enableExtension("WEBCL_html_image")
, after
which the application may call the functions specified below.
In order to prevent information leakage, this extension prohibits reading data from (1) an
Image element whose origin is not the same as the origin of the current Document, and (2) a
Canvas element whose origin-clean flag is set to false. An attempt to violate these
restrictions will cause a `SECURITY_ERR` exception to be thrown. Applications may utilize
Cross-Origin Resource Sharing [CORS] to get access to
images on another domain, provided that the server hosting the images supports that mechanism.
When this extension is enabled:
-
WebCLBuffer and WebCLImage can be initialized at construction time from an ImageData,
Canvas, or Image Element. This does not create a binding of any kind between the WebCL
memory object and the data source. The source pixel format is treated as 32-bit RGBA (8-bits
per component) with non-premultiplied alpha, regardless of the source.
IDL
partial interface WebCLContext {
WebCLBuffer createBuffer(CLenum memFlags, ImageData srcPixels);
WebCLBuffer createBuffer(CLenum memFlags, HTMLCanvasElement srcCanvas);
WebCLBuffer createBuffer(CLenum memFlags, HTMLImageElement srcImage);
WebCLImage createImage(CLenum memFlags, ImageData srcPixels);
WebCLImage createImage(CLenum memFlags, HTMLCanvasElement srcCanvas);
WebCLImage createImage(CLenum memFlags, HTMLImageElement srcImage);
};
partial interface WebCLCommandQueue {
//////////////////////////////////////////////////////////////////////
//
// Writing to WebCLBuffer
//
void enqueueWriteBuffer(
WebCLBuffer buffer,
CLboolean blockingWrite,
CLuint bufferOffset,
ImageData srcPixels,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteBuffer(
WebCLBuffer buffer,
CLboolean blockingWrite,
CLuint bufferOffset,
HTMLCanvasElement srcCanvas,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteBuffer(
WebCLBuffer buffer,
CLboolean blockingWrite,
CLuint bufferOffset,
HTMLImageElement srcImage,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteBufferRect(
WebCLBuffer buffer,
CLboolean blockingWrite,
sequence<CLuint> bufferOrigin,
sequence<CLuint> srcOrigin,
sequence<CLuint> region,
CLuint bufferRowPitch,
CLuint bufferSlicePitch,
ImageData srcPixels,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteBufferRect(
WebCLBuffer buffer,
CLboolean blockingWrite,
sequence<CLuint> bufferOrigin,
sequence<CLuint> srcOrigin,
sequence<CLuint> region,
CLuint bufferRowPitch,
CLuint bufferSlicePitch,
HTMLCanvasElement srcCanvas,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteBufferRect(
WebCLBuffer buffer,
CLboolean blockingWrite,
sequence<CLuint> bufferOrigin,
sequence<CLuint> srcOrigin,
sequence<CLuint> region,
CLuint bufferRowPitch,
CLuint bufferSlicePitch,
HTMLImageElement srcImage,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
//////////////////////////////////////////////////////////////////////
//
// Writing to WebCLImage
//
void enqueueWriteImage(
WebCLImage image,
CLboolean blockingWrite,
sequence<CLuint> origin,
sequence<CLuint> region,
ImageData srcPixels,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteImage(
WebCLImage image,
CLboolean blockingWrite,
sequence<CLuint> origin,
sequence<CLuint> region,
HTMLCanvasElement srcCanvas,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueWriteImage(
WebCLImage image,
CLboolean blockingWrite,
sequence<CLuint> origin,
sequence<CLuint> region,
HTMLImageElement srcImage,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
//////////////////////////////////////////////////////////////////////
//
// Reading from WebCL to HTMLCanvasElement
//
void enqueueReadBuffer(
WebCLBuffer buffer,
CLboolean blockingRead,
CLuint bufferOffset,
CLuint numBytes,
HTMLCanvasElement dstCanvas,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueReadBufferRect(
WebCLBuffer buffer,
CLboolean blockingRead,
sequence<CLuint> bufferOrigin,
sequence<CLuint> dstOrigin,
sequence<CLuint> region,
CLuint bufferRowPitch,
CLuint bufferSlicePitch,
HTMLCanvasElement dstCanvas,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
void enqueueReadImage(
WebCLImage image,
CLboolean blockingRead,
sequence<CLuint> origin,
sequence<CLuint> region,
HTMLCanvasElement dstCanvas,
optional sequence<WebCLEvent>? eventWaitList,
optional WebCLEvent? event);
};
New Functions
- WebCLBuffer createBuffer(CLenum memFlags, ImageData srcPixels)
-
Creates a new WebCLBuffer with size equal to
srcPixels.data.length
.
- Exceptions:
- `WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
- `INVALID_VALUE` -- if `memFlags` is not `MEM_READ_WRITE`, `MEM_WRITE_ONLY`, or `MEM_READ_ONLY`
- `INVALID_IMAGE_SIZE` -- if
srcPixels.data.length > DEVICE_MAX_MEM_ALLOC_SIZE
- `INVALID_HOST_PTR` -- if `srcPixels` has unknown length, or is otherwise not valid
- `INVALID_HOST_PTR` -- if `srcPixels` object is not fully loaded
WebCLBuffer createBuffer(CLenum memFlags, HTMLCanvasElement srcCanvas)
Creates a new WebCLBuffer with size equal to srcCanvas.getContext("2d").getImageData().data.length
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_VALUE` -- if `memFlags` is not `MEM_READ_WRITE`, `MEM_WRITE_ONLY`, or `MEM_READ_ONLY`
`INVALID_IMAGE_SIZE` -- if srcCanvas.getContext("2d").getImageData().data.length > DEVICE_MAX_MEM_ALLOC_SIZE
`INVALID_HOST_PTR` -- if `srcCanvas` has unknown lengths, or is otherwise not valid
`INVALID_HOST_PTR` -- if `srcCanvas` object is not fully loaded
WebCLBuffer createBuffer(CLenum memFlags, HTMLImageElement srcImage)
Creates a new WebCLBuffer with size equal to srcImage.width * srcImage.height * 4
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_VALUE` -- if `memFlags` is not `MEM_READ_WRITE`, `MEM_WRITE_ONLY`, or `MEM_READ_ONLY`
`INVALID_IMAGE_SIZE` -- if srcImage.width * srcImage.height * 4 > DEVICE_MAX_MEM_ALLOC_SIZE
`INVALID_HOST_PTR` -- if `srcImage` has unknown lengths, or is otherwise not valid
`INVALID_HOST_PTR` -- if `srcImage` object is not fully loaded
WebCLImage createImage(CLenum memFlags, ImageData srcPixels)
Creates a new WebCLImage with channelOrder
equal to RGBA
,
channelType
equal to UNORM_INT8
, and width
and
height
equal to srcPixels.width
and srcPixels.height
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_VALUE` -- if `memFlags` is not `MEM_READ_WRITE`, `MEM_WRITE_ONLY`, or `MEM_READ_ONLY`
`INVALID_IMAGE_SIZE` -- if srcPixels.width > DEVICE_IMAGE2D_MAX_WIDTH
`INVALID_IMAGE_SIZE` -- if srcPixels.height > DEVICE_IMAGE2D_MAX_HEIGHT
`INVALID_HOST_PTR` -- if `srcPixels` has unknown dimensions, or is otherwise not valid
`INVALID_HOST_PTR` -- if `srcPixels` object is not fully loaded
WebCLImage createImage(CLenum memFlags, HTMLCanvasElement srcCanvas)
Creates a new WebCLImage with channelOrder
equal to RGBA
,
channelType
equal to UNORM_INT8
, and width
and
height
equal to srcCanvas.width
and srcCanvas.height
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_VALUE` -- if `memFlags` is not `MEM_READ_WRITE`, `MEM_WRITE_ONLY`, or `MEM_READ_ONLY`
`INVALID_IMAGE_SIZE` -- if srcCanvas.width > DEVICE_IMAGE2D_MAX_WIDTH
`INVALID_IMAGE_SIZE` -- if srcCanvas.height > DEVICE_IMAGE2D_MAX_HEIGHT
`INVALID_HOST_PTR` -- if `srcCanvas` has unknown dimensions, or is otherwise not valid
`INVALID_HOST_PTR` -- if `srcCanvas` object is not fully loaded
WebCLImage createImage(CLenum memFlags, HTMLImageElement srcImage)
Creates a new WebCLImage with channelOrder
equal to RGBA
,
channelType
equal to UNORM_INT8
, and width
and
height
equal to srcImage.width
and srcImage.height
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_VALUE` -- if `memFlags` is not `MEM_READ_WRITE`, `MEM_WRITE_ONLY`, or `MEM_READ_ONLY`
`INVALID_IMAGE_SIZE` -- if srcImage.width > DEVICE_IMAGE2D_MAX_WIDTH
`INVALID_IMAGE_SIZE` -- if srcImage.height > DEVICE_IMAGE2D_MAX_HEIGHT
`INVALID_HOST_PTR` -- if `srcImage` has unknown dimensions, or is otherwise not valid
`INVALID_HOST_PTR` -- if `srcImage` object is not fully loaded
- void enqueueWriteBuffer(WebCLBuffer buffer, CLboolean blockingWrite, CLuint bufferOffset, ImageData srcPixels, Optional sequence<WebCLEvent>? eventWaitList, Optional WebCLEvent? event)
-
Enqueues a command to write the contents of
srcPixels
to buffer
.
- Exceptions:
- `WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
- `INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as `buffer`
- `INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as all events in `eventWaitList`
- `INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
- `INVALID_VALUE` -- if any part of the region being written, specified by `bufferOffset`
and `srcPixels.data.length`, is out of bounds of `buffer`
- `INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
- `EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
- `INVALID_HOST_PTR` -- if `srcPixels` object is not fully loaded
void enqueueWriteBuffer(WebCLBuffer buffer, CLboolean blockingWrite, CLuint bufferOffset, HTMLCanvasElement srcCanvas, Optional sequence<WebCLEvent>? eventWaitList, Optional WebCLEvent? event)
Enqueues a command to write the contents of srcCanvas
to buffer
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if any part of the region being written, specified by `bufferOffset`
and `srcCanvas.getContext("2d").getImageData().data.length`, is out of bounds of
`buffer`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
`INVALID_HOST_PTR` -- if `srcCanvas` object is not fully loaded
void enqueueWriteBuffer(WebCLBuffer buffer, CLboolean blockingWrite, CLuint bufferOffset, HTMLImageElement srcImage, Optional sequence<WebCLEvent>? eventWaitList, Optional WebCLEvent? event)
Enqueues a command to write the contents of srcImage
to buffer
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if any part of the region being written, specified by `bufferOffset`
and `srcImage.width * srcImage.height * 4`, is out of bounds of `buffer`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
`INVALID_HOST_PTR` -- if `srcImage` object is not fully loaded
void enqueueWriteBufferRect(WebCLBuffer buffer, CLboolean blockingWrite, sequence<CLuint> bufferOrigin, sequence<CLuint> srcOrigin, sequence<CLuint> region, CLuint bufferRowPitch, CLuint bufferSlicePitch, ImageData srcPixels, Optional sequence<WebCLEvent>? eventWaitList, Optional WebCLEvent? event)
Enqueues a command to write a rectangular region to a buffer
object from srcPixels
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if `bufferOrigin`, `srcOrigin`, or `region` does not have exactly
three elements
`INVALID_VALUE` -- if any part of the region being written, specified by `bufferOrigin`,
`region`, `bufferRowPitch` and `bufferSlicePitch`, is out of bounds of `buffer`
`INVALID_VALUE` -- if any part of the region being read, specified by `srcOrigin`,
`region`, is out of bounds of `srcPixels`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
`INVALID_HOST_PTR` -- if `srcPixels` object is not fully loaded
void enqueueWriteBufferRect(WebCLBuffer buffer, CLboolean blockingWrite, sequence<CLuint> bufferOrigin, sequence<CLuint> srcOrigin, sequence<CLuint> region, CLuint bufferRowPitch, CLuint bufferSlicePitch, HTMLCanvasElement srcCanvas, Optional sequence<WebCLEvent>? eventWaitList, Optional WebCLEvent? event)
Enqueues a command to write a rectangular region to a buffer
object from srcCanvas
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if `bufferOrigin`, `srcOrigin`, or `region` does not have exactly
three elements
`INVALID_VALUE` -- if any part of the region being written, specified by `bufferOrigin`,
`region`, `bufferRowPitch` and `bufferSlicePitch`, is out of bounds of `buffer`
`INVALID_VALUE` -- if any part of the region being read, specified by `srcOrigin`,
`region`, is out of bounds of `srcCanvas`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
`INVALID_HOST_PTR` -- if `srcCanvas` object is not fully loaded
void enqueueWriteBufferRect(WebCLBuffer buffer, CLboolean blockingWrite, sequence<CLuint> bufferOrigin, sequence<CLuint> srcOrigin, sequence<CLuint> region, CLuint bufferRowPitch, CLuint bufferSlicePitch, HTMLImageElement srcImage, Optional sequence<WebCLEvent>? eventWaitList, Optional WebCLEvent? event)
Enqueues a command to write a rectangular region to a buffer
object from srcImage
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if `bufferOrigin`, `srcOrigin`, or `region` does not have exactly
three elements
`INVALID_VALUE` -- if any part of the region being written, specified by `bufferOrigin`,
`region`, `bufferRowPitch` and `bufferSlicePitch`, is out of bounds of `buffer`
`INVALID_VALUE` -- if any part of the region being read, specified by `srcOrigin`,
`region`, is out of bounds of `srcImage`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
`INVALID_HOST_PTR` -- if `srcImage` object is not fully loaded
void enqueueWriteImage(WebCLImage image, CLboolean blockingWrite, sequence<CLuint> origin, sequence<CLuint> region, ImageData srcPixels, optional sequence<WebCLEvent>? eventWaitList, optional WebCLEvent? event)
Enqueues a command to write the contents of srcPixels
to 2D image
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `image`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `image` is not a valid WebCLImage object
`INVALID_IMAGE_SIZE` -- if the image dimensions of `image` are not supported by this WebCLCommandQueue
`INVALID_VALUE` -- if `origin` or `region` does not have exactly two elements
`INVALID_VALUE` -- if any part of the region being written, specified by `origin` and `region`, is out of bounds of `image`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if
`blockingWrite` is `true` and the execution status of any
event in `eventWaitList`is a negative integer value
`INVALID_HOST_PTR` -- if `srcPixels` object is not fully loaded
void enqueueWriteImage(WebCLImage image, CLboolean blockingWrite, sequence<CLuint> origin, sequence<CLuint> region, HTMLCanvasElement srcCanvas, optional sequence<WebCLEvent>? eventWaitList, optional WebCLEvent? event)
Enqueues a command to write the contents of srcCanvas
to 2D image
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `image`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `image` is not a valid WebCLImage object
`INVALID_IMAGE_SIZE` -- if the image dimensions of `image` are not supported by this WebCLCommandQueue
`INVALID_VALUE` -- if `origin` or `region` does not have exactly two elements
`INVALID_VALUE` -- if any part of the region being written, specified by `origin` and `region`, is out of bounds of `image`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList`is a negative integer value
`INVALID_HOST_PTR` -- if `srcCanvas` object is not fully loaded
void enqueueWriteImage(WebCLImage image, CLboolean blockingWrite, sequence<CLuint> origin, sequence<CLuint> region, HTMLImageElement srcImage, optional sequence<WebCLEvent>? eventWaitList, optional WebCLEvent? event)
Enqueues a command to write the contents of srcImage
to 2D image
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `image`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `image` is not a valid WebCLImage object
`INVALID_IMAGE_SIZE` -- if the image dimensions of `image` are not supported by this WebCLCommandQueue
`INVALID_VALUE` -- if `origin` or `region` does not have exactly two elements
`INVALID_VALUE` -- if any part of the region being written, specified by `origin` and `region`, is out of bounds of `image`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingWrite` is `true` and the
execution status of any event in `eventWaitList`is a negative integer value
`INVALID_HOST_PTR` -- if `srcImage` object is not fully loaded
void enqueueReadBuffer(WebCLBuffer buffer, CLboolean blockingRead, CLuint bufferOffset, CLuint numBytes, HTMLCanvasElement dstCanvas, optional sequence<WebCLEvent> eventWaitList, optional WebCLEvent? event)
Enqueues a command to read the contents of buffer
object to dstCanvas
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if any part of the region being read, specified by `bufferOffset` and
`numBytes`, is out of bounds of `buffer`
`INVALID_VALUE` -- if any part of the region being written, specified by `dstCanvas` is
out of bounds
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingRead` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
void enqueueReadBufferRect(WebCLBuffer buffer, CLboolean blockingRead, sequence>CLuint> bufferOrigin, sequence>CLuint> dstOrigin, sequence>CLuint> region, CLuint bufferRowPitch, CLuint bufferSlicePitch, HTMLCanvasElement dstCanvas, optional sequence<WebCLEvent> eventWaitList, optional WebCLEvent? event)
Enqueues a command to read a rectangular region from a buffer
object to dstCanvas
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `buffer` is not a valid WebCLBuffer object
`INVALID_VALUE` -- if `bufferOrigin`, `dstOrigin`, or `region` does not have exactly
three elements
`INVALID_VALUE` -- if any part of the region being read, specified by `bufferOrigin`,
`region`, `bufferRowPitch` and `bufferSlicePitch`, is out of bounds of `buffer`
`INVALID_VALUE` -- if any part of the region being written, specified by `dstOrigin`,
`region`, is out of bounds of `dstCanvas`
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingRead` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
void enqueueReadImage(WebCLImage image, sequence<CLuint> origin, sequence<CLuint> region, HTMLCanvasElement dstCanvas, optional sequence<WebCLEvent> eventWaitList, optional WebCLEvent? event)
Enqueues commands to read the contents of image
object to dstCanvas
.
- Exceptions:
`WEBCL_EXTENSION_NOT_ENABLED` -- if the `WEBCL_html_sharing` extension has not been enabled
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as `buffer`
`INVALID_CONTEXT` -- if this WebCLCommandQueue is not associated with the same
WebCLContext as all events in `eventWaitList`
`INVALID_MEM_OBJECT` -- if `image` is not a valid WebCLImage object
`INVALID_IMAGE_SIZE` -- if the image dimensions of `image` are not supported by this
WebCLCommandQueue
`INVALID_VALUE` -- if `origin` or `region` does not have exactly two elements
`INVALID_VALUE` -- if any part of the region being read, specified by `origin` and
`region`, is out of bounds of `image`
`INVALID_VALUE` -- if any part of the region being written, specified by `dstCanvas` is
out of bounds
`INVALID_EVENT_WAIT_LIST` -- if any event in `eventWaitList` is invalid
`EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST` -- if `blockingRead` is `true` and the
execution status of any event in `eventWaitList` is a negative integer value
Sample Code
Issues
-
N/A
Revision History
Revision 1, 2013/11/20
- Migrated from the WebCL Working Draft
Revision 2, 2013/12/10
- Renamed to WEBCL_html_image