Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenCL - OpenGL Interop performance
    text
    copied!<p>I have a code where I create GL texture 8K(7680 x 4320) and I render to this texture. Then I switch it to CL and I do some stuff...</p> <p><strong>Problem is that "switching" is very slow.</strong></p> <p>If I don't run any CL code, only switch. It has around 40FPS on my GTS 450.</p> <p>If I comment "clEnqueueAcquireGLObjects(..)" line => no switch. It has around 600FPS.</p> <p>Is There some way how I can speed up?</p> <p>I want to ask too If this is problem only with Nvidia or others like Ati, Intel and some SoC(ARM) have a same speed issue?</p> <p>Creating GL-CL texture:</p> <pre><code>glGenFramebuffers(1, &amp;m_fbo); glGenTextures(1, &amp;m_tex); glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); glBindTexture(GL_TEXTURE_2D, m_tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_imageSize.x, m_imageSize.y, 0, GL_RGBA, GL_INT, NULL); //GL_ALPHA glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_tex, 0); if(glCheckFramebufferStatus(GL_FRAMEBUFFER)!=GL_FRAMEBUFFER_COMPLETE) return false; glBindFramebuffer(GL_FRAMEBUFFER, 0); int err; m_memD = clCreateFromGLTexture2D(ecl.getContext(), CL_MEM_READ_WRITE, GL_TEXTURE_2D, 0, m_tex, &amp;err); if(ERR_CL) return false; </code></pre> <p>GL - CL Interop:</p> <pre><code>void activateCL() { glFinish(); int err = clEnqueueAcquireGLObjects(m_queue, 1, &amp;m_memD, 0, 0, 0); } void activateGL() { int err; err = clFinish(m_queue); err = clEnqueueReleaseGLObjects(m_queue, 1, &amp;m_memD, 0, 0, 0); } bool activateGLRendering() { activateGL(); glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); return true; } bool deactivateGLRendering() { glBindFramebuffer(GL_FRAMEBUFFER, 0); return true; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload