This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

glReadPixels

Note: This was originally posted on 9th March 2012 at http://forums.arm.com

Hi all,

i try to render scene in an off screen  way, controlling the location of my pixels (the pointer is fixed by myself).
It seems that MALI400 is not supporting eglCreatePixmapSurface, interface that would allows me to create a  surface that will use pixels in the location i want.

As it is not working i have to use the API glReadPixels which is very very slow (compare to other GPU).

So i'm wondering if there is a reason for such bad perf for ReadPixels and if someone knows a way with MALI to render a scene at place (pixel buffer address) you want.

Thanks for your help.

BR

Seb
Parents
  • Note: This was originally posted on 14th March 2012 at http://forums.arm.com

    Hi Karthik,

    First i wanted to thanks you for the very good feedback you provided me.I implemented the solution you gave and it is working fine with a very good level of performance compare to glReadPixels.

    For information, I wanted to notice that i had to adapt a part of step 6 code:
    you are creating a texture and also a EGLImageKHR. On my side i modified your code to arrive to following one.

    glViewport[color=#666600]([/color][color=#006666]0[/color][color=#666600],[/color] [color=#006666]0[/color][color=#666600],[/color] w[color=#666600],[/color] h[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glViewport"[/color][color=#666600]);[/color][color=#880000]/* Initialize FBOs. */[/color]
    glGenFramebuffers[color=#666600]([/color][color=#006666]1[/color][color=#666600],[/color] [color=#666600]&[/color]iFBO[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glGenFramebuffers"[/color][color=#666600]);[/color][color=#666600]
    [/color][color=#880000]/* Initialize FBO texture. */[/color]
    glGenTextures[color=#666600]([/color][color=#006666]1[/color][color=#666600],[/color] [color=#666600]&[/color]iFBOTex[color=#666600]);[/color]
    glBindTexture[color=#666600]([/color]GL_TEXTURE_2D[color=#666600],[/color] iFBOTex[color=#666600]);[/color]

    _glEGLImageTargetTexture2DOES[color=#666600]([/color]GL_TEXTURE_2D[color=#666600],[/color] pEGLImage[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"_glEGLImageTargetTexture2DOES"[/color][color=#666600]);[/color][color=#666600]
    [/color][color=#880000]/* Attach texture to the framebuffer. */[/color]
    glFramebufferTexture2D[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600],[/color] GL_COLOR_ATTACHMENT0[color=#666600],[/color] GL_TEXTURE_2D[color=#666600],[/color] iFBOTex[color=#666600],[/color] [color=#006666]0[/color][color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glFramebufferTexture2D"[/color][color=#666600]);[/color]



    [color=#880000]/* Check FBO is OK. */[/color]
    iResult [color=#666600]=[/color] glCheckFramebufferStatus[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600]);[/color]
    [color=#000088]if[/color][color=#666600]([/color]iResult [color=#666600]!=[/color] GL_FRAMEBUFFER_COMPLETE[color=#666600])[/color]
    [color=#666600]{[/color]
    LOGE[color=#666600]([/color][color=#008800]"Error: Framebuffer incomplete at %s:%i\n"[/color][color=#666600],[/color] __FILE__[color=#666600],[/color] __LINE__[color=#666600]);[/color]
    [color=#666600]}[/color]
    [color=#880000]/* Render to framebuffer object. */[/color]
    [color=#880000]/* Bind our framebuffer for rendering. */[/color]
    glBindFramebuffer[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600],[/color] iFBO[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glBindFramebuffer"[/color][color=#666600]);[/color]

    [color=#880000]/* Unbind framebuffer. */[/color]
    glBindFramebuffer[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600],[/color] [color=#006666]0[/color][color=#666600]);[/color]




Reply
  • Note: This was originally posted on 14th March 2012 at http://forums.arm.com

    Hi Karthik,

    First i wanted to thanks you for the very good feedback you provided me.I implemented the solution you gave and it is working fine with a very good level of performance compare to glReadPixels.

    For information, I wanted to notice that i had to adapt a part of step 6 code:
    you are creating a texture and also a EGLImageKHR. On my side i modified your code to arrive to following one.

    glViewport[color=#666600]([/color][color=#006666]0[/color][color=#666600],[/color] [color=#006666]0[/color][color=#666600],[/color] w[color=#666600],[/color] h[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glViewport"[/color][color=#666600]);[/color][color=#880000]/* Initialize FBOs. */[/color]
    glGenFramebuffers[color=#666600]([/color][color=#006666]1[/color][color=#666600],[/color] [color=#666600]&[/color]iFBO[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glGenFramebuffers"[/color][color=#666600]);[/color][color=#666600]
    [/color][color=#880000]/* Initialize FBO texture. */[/color]
    glGenTextures[color=#666600]([/color][color=#006666]1[/color][color=#666600],[/color] [color=#666600]&[/color]iFBOTex[color=#666600]);[/color]
    glBindTexture[color=#666600]([/color]GL_TEXTURE_2D[color=#666600],[/color] iFBOTex[color=#666600]);[/color]

    _glEGLImageTargetTexture2DOES[color=#666600]([/color]GL_TEXTURE_2D[color=#666600],[/color] pEGLImage[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"_glEGLImageTargetTexture2DOES"[/color][color=#666600]);[/color][color=#666600]
    [/color][color=#880000]/* Attach texture to the framebuffer. */[/color]
    glFramebufferTexture2D[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600],[/color] GL_COLOR_ATTACHMENT0[color=#666600],[/color] GL_TEXTURE_2D[color=#666600],[/color] iFBOTex[color=#666600],[/color] [color=#006666]0[/color][color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glFramebufferTexture2D"[/color][color=#666600]);[/color]



    [color=#880000]/* Check FBO is OK. */[/color]
    iResult [color=#666600]=[/color] glCheckFramebufferStatus[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600]);[/color]
    [color=#000088]if[/color][color=#666600]([/color]iResult [color=#666600]!=[/color] GL_FRAMEBUFFER_COMPLETE[color=#666600])[/color]
    [color=#666600]{[/color]
    LOGE[color=#666600]([/color][color=#008800]"Error: Framebuffer incomplete at %s:%i\n"[/color][color=#666600],[/color] __FILE__[color=#666600],[/color] __LINE__[color=#666600]);[/color]
    [color=#666600]}[/color]
    [color=#880000]/* Render to framebuffer object. */[/color]
    [color=#880000]/* Bind our framebuffer for rendering. */[/color]
    glBindFramebuffer[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600],[/color] iFBO[color=#666600]);[/color]
    checkGlError[color=#666600]([/color][color=#008800]"glBindFramebuffer"[/color][color=#666600]);[/color]

    [color=#880000]/* Unbind framebuffer. */[/color]
    glBindFramebuffer[color=#666600]([/color]GL_FRAMEBUFFER[color=#666600],[/color] [color=#006666]0[/color][color=#666600]);[/color]




Children
No data