Android shader compiler problem (GLSL, OGL2.0 ES)

This topic contains 4 replies, has 2 voices, and was last updated by  Joe Davis 4 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #31501


    i have a shader that doesn’t compile on Android PVR devices. It’s relatively simple, and does compile without problems on iOS and non-PVR devices. It also works in the PVR SDK shader tool. The strange thing is, if i rearrange the source a little, it DOES compile on the device. Am i allowed to post the shader here?

    thank you,
    Balazs Vasvari


    Edit: the error message from the compiler is “compile failed”, nothing more. I’m using an Acer Iconia A1-810 (JB 4.2.2), but it does seem to affect all our users with PVR gpus. It also fails in the PVR SDK shader editor, if i change the compiler to SGX543 rev 2111. It also seems to be related to precision qualifiers, because if i change one of the “lowp” uniforms to “highp”, it works again.


    Joe Davis


    Can you share the shader source with us?



    Hi Joe,

    thank you (try chaning uniform lowp vec4 material_modifier to mediump, and it compiles):


    #define SG3D_ANDROID 1
    #define SG3D_VARIATION0 1

    // uniforms
    uniform highp mat4 sg3d_world_matrix;
    uniform highp mat4 sg3d_camera_matrix;
    uniform highp mat4 sg3d_view_matrix;
    uniform highp mat4 sg3d_viewproj_matrix;
    uniform highp mat4 sg3d_proj_matrix;

    // varyings
    varying highp vec2 var_uv;
    varying mediump vec4 var_color;
    varying lowp vec4 var_fog;
    //varying mediump vec3 var_normal;

    uniform lowp vec4 object_marker;
    uniform lowp vec4 material_modifier;
    uniform lowp sampler2D SG3D_TEXTURE_DIFFUSE;
    uniform lowp sampler2D SG3D_TEXTURE_OPACITY;
    uniform lowp samplerCube SEP_TEXTURE_REFCUBE;


    void main()
    lowp vec3 mask=texture2D(SG3D_TEXTURE_OPACITY, var_uv).xyz;
    lowp vec4 albedo_specular=texture2D(SG3D_TEXTURE_DIFFUSE, var_uv); =*; =*; +=albedo_specular.rgb*clamp(mask.r+material_modifier.x, 0.0, 1.0); = mix(, vec3(0.75, 0.75, 0.75), object_marker.w);
    gl_FragColor.w = mask.g*var_color.w;


    Joe Davis


    I’ve reproduced the error in our 3.1 SDK’s compiler. However, our latest reference driver’s compiler compiles it successfully.

    Unfortunately, you’ll have to stick with the mediump workaround.


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