Incorrect display on the phone(ClippingPlane)

Hi!

I have found out that with certain Adreno GPU:s gl_FragCoord.w is zero all the time. I am preparing a fix for this, but could use some help from the experts… I think it would be good to use v_positionEC as a varying to clip calculations:

I would use just v_positionEC here:

  var shaderCode =
    "    float clipDistance = clip(vec4(v_positionEC, 1.0), " +
    samplerUniformName +

And here it would already be an eye-space position:

function clippingFunctionUnion(clippingPlanesLength) {
  var functionString =
    "float clip(vec4 position, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n" +
    "{\n" +
    "    vec3 clipNormal = vec3(0.0);\n" +
    "    vec3 clipPosition = vec3(0.0);\n" +

There is one observations though that discourages my approach: For some reason the clip in sandcastle with aeroplane model works even without the fix. I am wondering if rendering the aeroplane model sets some extensions on that enable the gl_FragCoord.w?

@sam.rothstein @omar Maybe you could ping someone to check the Android clip stuff? :slight_smile: We have tested this using ten android devices and a missing gl_FragCoord.w seems to bother almost 50% of modern Android devices.