2D Subbuffer

Hi,

I need to use OpenCL subbuffers but it seems that OpenCL does not allows to do 2D subbuffers?
It only allows to do subbuffers with consecutive memory. Am I wrong?

For instance,

We can do 4 subbuffers: WWWWXXXXYYYYZZZZ

But we cannot do 4 2D subbuffers:

WWWW X X X X
WWWW X X X X
WWWW X X X X
WWWW X X X X
Y Y Y Y Z Z Z Z
Y Y Y Y Z Z Z Z
Y Y Y Y Z Z Z Z
Y Y Y Y Z Z Z Z

Thank you in advance :slight_smile:

It is possible with clEnqueueReadBufferRect. To read โ€˜wโ€™ only, origin should be (0,0,0), region should be (4sizeof(w), 4,1) and buffer_row_pitch should be 8sizeof(w). You can also map and/or copy a subbuffer the same way.

For any further questions read 5.2.x of the spec

Yes clint3112, you can update 2D regions of data with *Rect methods. But if you need to launch a kernel only onto a subregion, I suspect that you cannot create a 2D subbuffer :frowning:

clCreateSubBuffer should do that, doesnโ€™t it?