filament icon indicating copy to clipboard operation
filament copied to clipboard

refraction crashes on Adreno 710 GPU

Open naudvard opened this issue 1 month ago • 4 comments

Describe the bug In Android, when using a material with refractionMode on screenspace configured with both IOR and transmission, the app crashes when rendering on multiple phones with Adreno 710 GPU. Version : 1.67.1

To Reproduce

  1. Go on sample-image-based-lighting
  2. Replace clear_coat.mat content with the following :
material {
    name : clear_coat,
    shadingModel : lit,
    refractionMode: screenspace,
    refractionType: solid,
    reflections: default,
    parameters : [
        {
            type : float3,
            name : baseColor
        }
    ],
}

fragment {
    void material(inout MaterialInputs material) {
        prepareMaterial(material);

        //material.baseColor.rgb = materialParams.baseColor;
        material.baseColor = float4(1.0, 1.0, 1.0, 1.0);

        // To create a metallic paint-like material we want
        // a rough base metallic layer and a glossy clear coat
        material.roughness = 0.2;
        material.metallic = 0.0;
        material.clearCoat = 1.0;
        material.ior = 1.15;
        material.transmission = 0.5;
    }
}
  1. STart the application on an Android device running an Adreno 710 GPU.
  2. Observe the application crash

Expected behavior No crash

Logs sample-image-based-lighting-release-unsigned.apk_2025_12_2_14_37_11.log

Smartphone (please complete the following information):

  • Device: Any device with 710 GPU, like a Xiaomi Redmi Note 13 Pro 5G
  • OS: At least Android 14, 15 and 16

naudvard avatar Dec 02 '25 13:12 naudvard

Seems like there's something Adreno driver doesn't like in the gaussian blur shader:

12-02 13:36:54.354 E/Filament(27074): Link error in "separableGaussianBlur":
12-02 13:36:54.354 E/Filament(27074):  - glError=0
12-02 13:36:54.354 E/Filament(27074):  - LogInfo="(null)"
12-02 13:36:54.354 E/Filament(27074): Postcondition
12-02 13:36:54.354 E/Filament(27074): in operator():357
12-02 13:36:54.354 E/Filament(27074): reason: OpenGL program separableGaussianBlur failed to link or compile
12-02 13:36:54.354 E/Filament(27074): 
12-02 13:36:54.355 I/libc    (27074): handling signal: 6

show50726 avatar Dec 03 '25 06:12 show50726

We also found the bug on some Adreno 740, depending on the version. Here two S23 Ultra, one crashing one not: Crashing: Image Image

Not crashing: Image Image

Log of the crash:

sample-image-based-lighting-release-unsigned.apk_2025_12_4_9_55_39_Samsung_Galaxy_S23_Ultra.log

naudvard avatar Dec 04 '25 10:12 naudvard

I'm afraid we won't be able to prioritize investigating this deeply at the moment.

However, if you have time to debug, you could try removing random lines in separableGaussianBlur.vs or separableGaussianBlur.fs and see which lines are causing the compilation error. If you can pinpoint which specific lines are upsetting the Adreno driver, we can likely patch it with a workaround.

show50726 avatar Dec 05 '25 06:12 show50726

It seems to be textureLod, I replaced them in sourceTexLod (separableGaussianBlur.fs) with texture and it works just fine.

highp vec4 sourceTexLod(const highp vec2 p, float m, float l) {
    if (materialConstants_arraySampler) {
        return texture(materialParams_sourceArray, vec3(p, l));
    } else {
        return texture(materialParams_source, p);
    }
}

Precisely, it is if (materialConstants_arraySampler) { return textureLod(materialParams_sourceArray, vec3(p, l), m); } Replacing it with return textureLod(materialParams_source, p, m); works, so I think its a driver issue when passing a sampler2DArray in textureLod

naudvard avatar Dec 10 '25 13:12 naudvard