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

depth component16-32 texture not work on mali t760

i'm doing deferred shading. i use a framebuffer which attach 4 color texture and 1 depth texture as geometrypass.

i try to rebuild world position using depth, and use it for lighting.

so i need to use depth in my fragment shader,and i want my depth texture to be more precise like  16bits or 24bits or more.

but when i read from depth texture in the 2nd shader,it seems depth_component24 is not work,i can get the depth but it behaves like a 8bits depth beacuse my light model works but not accurate.

i use the same code on PC and it works fine.

(i use highp in my shader,)

so does anyone know the reason?

or anyone successfully read from more than 8bit depth texture?

  • so does anyone know the reason?

    D24 definitely works on Mali, so it's likely something in your shader code. Can you share a reproducer and some screenshots of what "good" and "bad" look like?

    Cheers ,
    Pete

  • I  use

    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, ui_width, ui_height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, uc_pbuffer) to init texture

    and i use

    nearest filter and edge clamp for depth texture param

    i read depth in shader like this:

    uniform sampler2D g_depth;

    float depth=texture(g_depth, v_texCoord).x;

    The result is below,left is on phone and right is on PC

    In fact ,i have tried to output depth by encodeing it to RGBA as a texture in the first shader,and  decode it in the second shader and it works fine.So i can know it maybe not my calculation problem.

  • Hello pttsukida,

    which precision qualifiers have you used in the fragment shader reading from the depth texture?

    Please keep in mind that the predeclared (default) precision is lowp only for the sampler2D type.

    Jörg

  • thanks a lot!  jörg.

    It's the reason. I use highp float but forget to use highp Sampler2D.