Request for a clEnqueueFillBufferRect

Discussion created by settle on Sep 20, 2012
Latest reply on Oct 1, 2012 by binying

In both the cl.h and cl.hpp header files I found the clEnqueueFillBuffer function but no clEnqueueFillBufferRect function.  I thought this was strange since for every read/write/copy buffer function there is a corresponding rectangular function, but indeed for whatever reason there is no clEnqueueFillBufferRect in the 1.2 specification.  I'd like to request AMD add support for it since I often need to zero out interior regions of 2D and 3D rectangular buffer objects.  Right now I create a temporary buffer, fill it, and then copy the temporary buffer into the rectangular buffer.  However, the downside to my current method is that it takes more memory and cannot write to read-only or no-access buffers, but a fill function can.  Below are possibly entries for both the C and C++ headers.


In cl.h

extern CL_API_ENTRY cl_int CL_API_CALL

clEnqueueFillBufferRect(cl_command_queue   /* command_queue */,

                    cl_mem                 /* buffer */,

                    const void *           /* pattern */,

                    size_t                 /* pattern_size */,

                    const size_t *         /* buffer_offset */,

                    const size_t *         /* region */,

                    size_t                 /* buffer_row_pitch */,

                    size_t                 /* buffer_slice_pitch */,

                    cl_uint                /* num_events_in_wait_list */,

                    const cl_event *       /* event_wait_list */,

                    cl_event *             /* event */) CL_API_SUFFIX__VERSION_1_2;

In cl.hpp

#if defined(CL_VERSION_1_2)


     * Enqueue a command to fill a 2D or 3D rectangular buffer object with a pattern

     * of a given size. The pattern is specified a as vector.

     * \tparam PatternType The datatype of the pattern field.

     *     The pattern type must be an accepted OpenCL data type.


    template<typename PatternType>

    cl_int enqueueFillBufferRect(

        const Buffer& buffer,

        PatternType pattern,

        const size_t<3>& buffer_offset,

        const size_t<3>& region,

        ::size_t buffer_row_pitch,

        ::size_t buffer_slice_pitch,

        const VECTOR_CLASS<Event>* events = NULL,

        Event* event = NULL) const


        cl_event tmp;

        cl_int err = detail::errHandler(






                (const ::size_t *)buffer_offset,

                (const ::size_t *)region,



                (events != NULL) ? (cl_uint) events->size() : 0,

                (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,

                (event != NULL) ? &tmp : NULL),



        if (event != NULL && err == CL_SUCCESS)

            *event = tmp;


        return err;


#endif // #if defined(CL_VERSION_1_2)