Problems with OpenCL / OpenGL Texture interop / windows

To improve rendering quality, I write on the universal separation eyepiece in OpenCL 1.1.

The main image (covering only a small part of the final image) turns into a very large framebuffer. Then its color texture is discarded and placed in another texture through OpenCL. Finally, the on-screen aligned square gets a visualization to show the result.

Bye idea. What do we have:

  • 2 downscaler kernel instances (it stores the results with an exchange of coordinates (i.e. as (y, x))
  • inputTexture (color binding to rtt-framebuffer)
  • tempTexture, size: inputHeight x outputWidth created using CL_MEM_READ_WRITE
  • outputTexture

The launch kernel_instance_1( <otherParams>, inputTexture, tempTexture )gives the desired result, but only in the very first frame . Somehow, the changes that occur in the animation are not displayed at all. Since I am not getting any errors (see below), I assume that the kernel launches every frame, but the original content of the texture remains the same (which it does not have, I also have a live output of this texture).

Question: Should I call clCreateFromGLTexture2D () every time the contents of the framebuffer have changed?

EDIT I just realized: inputTexture is still attached to the framebuffer object GL_COLOR_ATTACHMENT0- maybe this is a problem? Endedit

A launch kernel_instance_2( <otherParams>, tempTexture, outputTexture )does not give a visible result, even with a barrier set between kernel calls. That is, outputTexture remains empty.

Question: tempTexture , OpenCL ?

, OpenCL, :

clCreateKernel( separable_X )
clRetainMemObject( separable_X::convolution )
clCreateKernel( separable_Y )
clRetainMemObject( separable_Y::convolution )
clCreateFromGLTexture2D( separable_X::dst + separable_y::src, texID=24, usage=temporary (source and target) )
clCreateFromGLTexture2D( separable_Y::dst, texID=18, usage=target )
clCreateFromGLTexture2D( separable_X::src, texID=22, usage=source )
clRetainMemObject( separable_X::dst )
clRetainMemObject( separable_Y::src )
clRetainMemObject( separable_Y::dst )
clRetainMemObject( clearEmpty::dst )
clEnqueueAcquireGLObjects( count=3 )
clEnqueueBarrier()
clSetKernelArg( separable_X::convert )
clSetKernelArg( separable_X::offset )
clSetKernelArg( separable_X::convolution )
clSetKernelArg( separable_X::dst )
clSetKernelArg( separable_X::src )
clEnqueueNDRangeKernel( separable_X, (1440, 1080, 0), waiting4 0 events )
clSetKernelArg( separable_Y::convert )
clSetKernelArg( separable_Y::offset )
clEnqueueBarrier()
clSetKernelArg( separable_Y::convolution )
clSetKernelArg( separable_Y::dst )
clSetKernelArg( separable_Y::src )
clEnqueueNDRangeKernel( separable_Y, (540, 1440, 0), waiting4 0 events )
clEnqueueBarrier()
clEnqueueReleaseGLObjects( count=3 )

- , .

, , , clEnqueueReleaseGLObjects() -9999, - "NVidia: ".

Question: , write_imagef() , - 1.0f, - RGBA8? , write_imagef( texture, (int2)coord, clamp( color, 0.f, 1.f ) );...

- ...

, :

?
__kernel (separable_X separable_Y), , separable() -.

GL CL?
 - , GL, a glFinish() clEnqueueAcquireGLObjects()
 - clEnqueueReleaseGLObjects(), cl_events (, )

+4
1

glFinish clEnqueueAcquireGLObjects, , clFinish AFTER clEnqueueReleaseGLObjects. 9.8.6.2 OpenCL 1.1.

, :

clCreateFromGLTexture2D() , ?

, , OpenCL- OpenGL. , .

tempTexture , OpenCL ?

. OpenCL , .

, write_imagef() , - 1.0f, - RGBA8?

, . .

+1

All Articles