! \brief Class interface for GL Buffer Memory Objects. * * This is provided to facilitate interoperability with OpenGL. * * See Memory for details about copy semantics, etc. * * \see Memory */
| 3459 | * \see Memory |
| 3460 | */ |
| 3461 | class BufferGL : public Buffer |
| 3462 | { |
| 3463 | public: |
| 3464 | /*! \brief Constructs a BufferGL in a specified context, from a given |
| 3465 | * GL buffer. |
| 3466 | * |
| 3467 | * Wraps clCreateFromGLBuffer(). |
| 3468 | */ |
| 3469 | BufferGL( |
| 3470 | const Context& context, |
| 3471 | cl_mem_flags flags, |
| 3472 | cl_GLuint bufobj, |
| 3473 | cl_int * err = NULL) |
| 3474 | { |
| 3475 | cl_int error; |
| 3476 | object_ = ::clCreateFromGLBuffer( |
| 3477 | context(), |
| 3478 | flags, |
| 3479 | bufobj, |
| 3480 | &error); |
| 3481 | |
| 3482 | detail::errHandler(error, __CREATE_GL_BUFFER_ERR); |
| 3483 | if (err != NULL) { |
| 3484 | *err = error; |
| 3485 | } |
| 3486 | } |
| 3487 | |
| 3488 | //! \brief Default constructor - initializes to NULL. |
| 3489 | BufferGL() : Buffer() { } |
| 3490 | |
| 3491 | /*! \brief Constructor from cl_mem - takes ownership. |
| 3492 | * |
| 3493 | * See Memory for further details. |
| 3494 | */ |
| 3495 | __CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem& buffer) : Buffer(buffer) { } |
| 3496 | |
| 3497 | /*! \brief Assignment from cl_mem - performs shallow copy. |
| 3498 | * |
| 3499 | * See Memory for further details. |
| 3500 | */ |
| 3501 | BufferGL& operator = (const cl_mem& rhs) |
| 3502 | { |
| 3503 | Buffer::operator=(rhs); |
| 3504 | return *this; |
| 3505 | } |
| 3506 | |
| 3507 | /*! \brief Copy constructor to forward copy to the superclass correctly. |
| 3508 | * Required for MSVC. |
| 3509 | */ |
| 3510 | BufferGL(const BufferGL& buf) : Buffer(buf) {} |
| 3511 | |
| 3512 | /*! \brief Copy assignment to forward copy to the superclass correctly. |
| 3513 | * Required for MSVC. |
| 3514 | */ |
| 3515 | BufferGL& operator = (const BufferGL &buf) |
| 3516 | { |
| 3517 | Buffer::operator=(buf); |
| 3518 | return *this; |
nothing calls this directly
no outgoing calls
no test coverage detected