PVRVFrame error with GLES3 precision statements

This topic contains 3 replies, has 2 voices, and was last updated by  Dark_Photon 2 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #48743

    We’re seeing a problem here with some recent shader optimizations where precision qualifiers on samplers (GLES 3.00) aren’t being stripped before being passed to the underlying GL implementation (where they are invalid; only types int and float are allowed).

    NVidia GL drivers are permissive and allow this, but ATI GL drivers rightfully throw an error and fail the compile.

    I’ll file a ticket for the fix, but is there a recommended work-around for this? Removing the precision statement alone isn’t sufficient.

    For instance, this GLES-SL 3.00 shader:

    #version 300 es
    precision mediump float;
    precision lowp sampler2DArray;
    uniform sampler2DArray aTexture;
    …

    is translated as this GL-SL shader:

    #version 330 core
    #define PVR_GL_FRAGMENT_PRECISION_HIGH
    #define PVR_GL_ES                       1
    #define gl_MaxTextureImageUnits         8
    #define gl_MaxFragmentUniformVectors    64
    #define gl_MaxVertexUniformVectors      128
    #define gl_MaxVaryingVectors            8
    #define gl_MaxCombinedTextureImageUnits 8
    #define PVR_highp
    #define PVR_mediump
    #define PVR_lowp
    
    precision lowp sampler2DArray;     // <—— THIS is a syntax error —–
     
    uniform sampler2DArray aTexture; 
    …
    #48746

    Joe Davis
    Member

    Thanks for reporting. I’ve filed the bug as BRN55840.

    >is there a recommended work-around for this? Removing the precision statement alone isn’t sufficient.
    I’ll discuss with the PVRVFrame lead to see if the issue can be worked around.

    #48749

    Joe Davis
    Member

    We’ve found a workaround. The bug is specific to the stripping of default precision statements for samplers. If you explicitly state the precision instead of relying on the default, then PVRVFrame will correctly strip the precision qualifier before passing the resultant GLSL shader to the host.

    e.g. modify:

    precision lowp sampler2D;
    uniform sampler2D ATexture;
    uniform sampler2D BTexture;
    uniform sampler2D CTexture;

    to:

    uniform lowp sampler2D ATexture;
    uniform lowp sampler2D BTexture;
    uniform lowp sampler2D CTexture;
    #48759

    Thanks, Joe! That workaround seems to work well.

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.