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

Possible ESSL Compiler Bug on Mali-T880

Hello,

I am seeing an issue where a shader will erroneously result in a solid black color.  If a line is changed to use a multiply add (adding the smallest possible float value), the correct color is displayed.  Any insight into what is triggering the problem and possible workarounds would be greatly appreciated.

#version 310 es

precision highp float;

layout(std140) uniform;

layout(shared, binding = 8) uniform EgGrConstantBufferShaderType_PerMaterial {

    vec4 m_PerMaterialPacked0;

};

layout(shared, binding = 9) uniform EgGrConstantBufferShaderType_PerInstance {

    mat4 m_PerInstancePacked0;

    mat4 m_PerInstancePacked1;

    vec4 m_PerInstancePacked2;

    vec4 m_PerInstancePacked3;

    vec4 m_PerInstancePacked4;

};

layout(binding = 0) uniform sampler2D m_oUniqueSamplerT_0;

layout(binding = 1) uniform sampler2D m_oUniqueSamplerT_1;

layout(location = 0)  in highp vec4 VtxGeoOutput0;

layout(location = 2)  in highp vec4 VtxGeoOutput2;

layout(location = 0) out highp vec4 PixOutput0;

float g_fNearlyZero = 1.17549435e-38F;

#define MUL(a, b) (a * b)// + g_fNearlyZero)                                    ///< Changing this to (a * b + g_fNearlyZero) results in a correct color being displayed

void main()

{

    vec3  value0 = texture(m_oUniqueSamplerT_1, VtxGeoOutput2.xy).xyz;          // Diffuse / albedo texture color

    float value1 = texture(m_oUniqueSamplerT_0, VtxGeoOutput2.xy).x;            // 'Occlusion' scalar

    vec3  value2 = value0 * m_PerMaterialPacked0.x;                             // m_PerMaterialPacked0.x = 1.0 (scalar to control brightness of the diffuse)

    vec3  value3 = MUL(value1, value2);                                         ///< Use MUL macro to show issue. Scale diffuse by occlusion value

    vec3  value4 = m_PerInstancePacked3.xyz + m_PerInstancePacked2.xyz;         // m_PerInstancePacked3.xyz = vec3(1.0, 1.0, 1.0) + m_PerInstancePacked2.xyz = vec3(0.0, 0.0, 0.0)

    vec3  value5 = value3 * value4;                                             //

    PixOutput0.xyz = max(value5, 0.0);

    PixOutput0.w = 1.0;

    return;

}

Target hardware:

Mali-T880 GLES 3.1 v1.r9p0 in a Samsung Galaxy S7 Edge International version.

GL_RENDERER: Mali-T880

GL_VERSION: OpenGL ES 3.1 v1.r9p0-12dev0.c37094c9ad948aa7a7b056e38dcda762

GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 3.10

I've tested this code on a Galaxy Note 5 (Mali-T760) without problems.

Thanks,

Jeremiah

  • Hi Jeremiah,

    Thanks for the bug report. We've tried to reproduce the problem with just that shader compiling with the offline compiler, and don't seem to get anything incorrect in terms of the generated code. Would it be possible for you to share a standalone APK which reproduces the problem for you, and we can then investigate in more detail?

    Cheers,
    Pete