MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / BufferD3D10

Class BufferD3D10

include/internal/CL/cl.hpp:3355–3450  ·  view source on GitHub ↗

! \brief Class interface for creating OpenCL buffers from ID3D10Buffer's. * * This is provided to facilitate interoperability with Direct3D. * * See Memory for details about copy semantics, etc. * * \see Memory */

Source from the content-addressed store, hash-verified

3353 * \see Memory
3354 */
3355class BufferD3D10 : public Buffer
3356{
3357public:
3358 typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
3359 cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
3360 cl_int* errcode_ret);
3361
3362 /*! \brief Constructs a BufferD3D10, in a specified context, from a
3363 * given ID3D10Buffer.
3364 *
3365 * Wraps clCreateFromD3D10BufferKHR().
3366 */
3367 BufferD3D10(
3368 const Context& context,
3369 cl_mem_flags flags,
3370 ID3D10Buffer* bufobj,
3371 cl_int * err = NULL)
3372 {
3373 static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
3374
3375#if defined(CL_VERSION_1_2)
3376 vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
3377 cl_platform platform = -1;
3378 for( int i = 0; i < props.size(); ++i ) {
3379 if( props[i] == CL_CONTEXT_PLATFORM ) {
3380 platform = props[i+1];
3381 }
3382 }
3383 __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clCreateFromD3D10BufferKHR);
3384#endif
3385#if defined(CL_VERSION_1_1)
3386 __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
3387#endif
3388
3389 cl_int error;
3390 object_ = pfn_clCreateFromD3D10BufferKHR(
3391 context(),
3392 flags,
3393 bufobj,
3394 &error);
3395
3396 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
3397 if (err != NULL) {
3398 *err = error;
3399 }
3400 }
3401
3402 //! \brief Default constructor - initializes to NULL.
3403 BufferD3D10() : Buffer() { }
3404
3405 /*! \brief Constructor from cl_mem - takes ownership.
3406 *
3407 * See Memory for further details.
3408 */
3409 __CL_EXPLICIT_CONSTRUCTORS BufferD3D10(const cl_mem& buffer) : Buffer(buffer) { }
3410
3411 /*! \brief Assignment from cl_mem - performs shallow copy.
3412 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected