Results 1 to 7 of 7

Thread: Drawing Partially Complete OpenCL Images

  1. #1

    Drawing Partially Complete OpenCL Images

    Hi,

    I'm wondering if there is any way to display an OpenCL image as it is being written to? I'm creating an image using:

    clCreateFromGLTexture

    ...then acquiring/releasing the image via:

    clEnqueueAcquireGLObjects
    clEnqueueReleaseGLObjects

    I would like to be able to draw the partially-completed image; is something like this possible? Thanks for any suggestions.

    Mark

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Posts
    246
    No. While OpenCL has ownership the OpenGL side can't use it. If you have a long running OpenCL computation you could have it write many image images instead of one big one, and display those as they finish.

  3. #3
    Quote Originally Posted by Dithermaster View Post
    No. While OpenCL has ownership the OpenGL side can't use it. If you have a long running OpenCL computation you could have it write many image images instead of one big one, and display those as they finish.
    Thanks for confirming this behavior; it was what I'd expected from the documentation. I'll look into dividing into sub-regions and displaying those. Thanks again.

    ~M

  4. #4
    Quote Originally Posted by Engine Developer View Post
    Thanks for confirming this behavior; it was what I'd expected from the documentation. I'll look into dividing into sub-regions and displaying those. Thanks again.

    ~M
    I've had a look at this approach and it is going to be impossible to create one texture per-region as this is for an image being rendered. Even small-ish images would take hundreds of thousands of GL textures to be created (the global range is the number of pixels in the image). Is there any other way to display GL textures without having to wait for the compute to finish? Thanks for any further suggestions.

  5. #5
    Senior Member
    Join Date
    Apr 2015
    Posts
    310
    What is the nature of computations you perform? Maybe you don't even need OpenCL to begin with.
    https://gpuopen.com/deferred-path-tracing-enscape/

    We ported the stackless traversal algorithm to run on OpenGL® 4.2 hardware, so that the kernel runs in a plain fragment or vertex shader without the need for Compute Shader or OpenCL™.

  6. #6
    Quote Originally Posted by Engine Developer View Post
    I've had a look at this approach and it is going to be impossible to create one texture per-region as this is for an image being rendered. Even small-ish images would take hundreds of thousands of GL textures to be created (the global range is the number of pixels in the image). Is there any other way to display GL textures without having to wait for the compute to finish? Thanks for any further suggestions.
    Coming at it from the other direction, is it possible to access buffers on the card as they are being filled? This way I wouldn't need to use GL objects to fetch partial results. I'm just trying this approach now, however I only see zero-values after copying a buffer back to host. Is there anything specific to keep in mind when fetching results in this way? Thanks for any assistance.

  7. #7
    The approach I would follow is to split the computation in multiple kernel dispatches that work on different regions of the same image. Between each dispatch you would release the gl object and then use GL to render the partial result before acquiring the object again in CL side, and then process the next region. It would involve overhead on synchronization, though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean