C Specification
To create an OpenCL buffer object from a Direct3D 10 buffer, call the function
// Provided by cl_khr_d3d10_sharing
cl_mem clCreateFromD3D10BufferKHR(
cl_context context,
cl_mem_flags flags,
ID3D10Buffer* resource,
cl_int* errcode_ret);
clCreateFromD3D10BufferKHR is provided by the cl_khr_d3d10_sharing extension.
|
Parameters
-
context is a valid OpenCL context created from a Direct3D 10 device.
-
flags is a bit-field that is used to specify usage information. Refer to the List of supported memory flag values table for a description of flags. Only the
CL_MEM_,READ_ ONLY CL_MEM_andWRITE_ ONLY CL_MEM_flags specified in that table can be used.READ_ WRITE -
resource is a pointer to the Direct3D 10 buffer to share.
-
errcode_ret will return an appropriate error code. If errcode_ret is
NULL, no error code is returned.
Description
The size of the returned OpenCL buffer object is the same as the size of resource. This call will increment the internal Direct3D 10 reference count on resource. The internal Direct3D 10 reference count on resource will be decremented when the OpenCL reference count on the returned OpenCL memory object drops to zero.
| Refer to the Lifetime of Shared Direct3D Memory Objects and Acquiring, Releasing, and Synchronizing Access to Shared OpenCL/OpenGL Memory Objects sections for more information. |
clCreateFromD3D10BufferKHR returns a valid non-zero OpenCL buffer object
and errcode_ret is set to CL_SUCCESS if the buffer object is created
successfully.
Otherwise, it returns a NULL value with one of the following error values
returned in errcode_ret:
-
CL_INVALID_if context is not a valid context.CONTEXT -
CL_INVALID_if values specified in flags are not valid.VALUE -
CL_INVALID_if resource is not a Direct3D 10 buffer resource, if resource was created with the D3D10_USAGE flag D3D10_USAGE_IMMUTABLE, if aD3D10_ RESOURCE_ KHR cl_memfrom resource has already been created using clCreateFromD3D10BufferKHR, or if context was not created against the same Direct3D 10 device from which resource was created. -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.