Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Shader failed to compile on Android Nougat #6400

Closed

Description

@snorrid

Mapbox crashes our app on Android 7.0, tested on devices with 7.0(Nexus 5X/Nexus 6P). Works on Nexus 5 with Android 6.0

Shader failed to compile: ERROR: Valid GLSL but not GLSL ES  
Vertex shader fill failed to compile: precision highp float;
 #ifdef GL_ES
precision highp float;
#else
#define lowp
#define mediump
#define highp
#endif
attribute vec2 a_pos;

uniform mat4 u_matrix;

uniform lowp vec4 u_color;
uniform lowp float u_opacity;

void main() {
  lowp vec4 color = u_color;
  lowp float opacity = u_opacity;

  gl_Position = u_matrix * vec4(a_pos, 0, 1);
}
java.lang.Error: Vertex shader fill failed to compile
at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:139)
at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:1377)

Platform: Android 7.0 Nougat
Mapbox SDK version: mapbox-android-sdk:4.x

Activity

  1. added
    Android
    on Sep 20, 2016
  2. cammace commented on Sep 20, 2016

    @cammace
    Contributor

    Sounds like you might be using an emulator? Could you try changing the Emulated Performance setting to Hardware or Software and see if that resolves the issue.

  3. snorrid commented on Sep 20, 2016

    @snorrid
    Author

    This is failing on real devices in our device suite, no emulators.

  4. cammace commented on Sep 20, 2016

    @cammace
    Contributor

    This looks similar to issue #5878.

    cc: @ivovandongen to help look into this

  5. ivovandongen commented on Sep 21, 2016

    @ivovandongen
    Contributor

    @snorrid Anything special about those devices? And which version of Android Studio/gradle plugin are you using?

    Just re-tested with the AS 2.2 on a nexus 5x with android 7.0 and I can't reproduce. The emulators do seem to be broken still though.

  6. ivovandongen commented on Sep 21, 2016

    @ivovandongen
    Contributor

    I've validated the shader in the error and it seems to comply to the specification. (validator)

  7. lucaswoj commented on Sep 21, 2016

    @lucaswoj
    Contributor

    @tobrun @bleege Can you repro this on physical device?

  8. cammace commented on Sep 26, 2016

    @cammace
    Contributor

    I can't reproduce on any physical devices but run into this issue with emulators. It seems to be happening with the latest Android Studio emulator only, Genymotion's not having issues if the device is running greater then API 20. For now, if you need an emulator for building and testing your project I'd recommend using this till we resolve this issue.

  9. jeffypooo commented on Sep 28, 2016

    @jeffypooo

    @cammace I get the same shader crash with a Genymotion emulator running 7.0 and 6.0

    Logcat:

    
    Shader failed to compile: Vertex shader failed to compile with the following errors:
                               ERROR: 0:6: error(#101) Macro redefined: lowp
                               ERROR: 0:7: error(#101) Macro redefined: mediump
                               ERROR: 0:8: error(#101) Macro redefined: highp
                               ERROR: error(#273) 3 compilation errors.  No code generated
     Vertex shader fill failed to compile: precision highp float;
                               #ifdef GL_ES
                               precision highp float;
                               #else
                               #define lowp
                               #define mediump
                               #define highp
                               #endif
    
                               attribute vec2 a_pos;
    
                               uniform mat4 u_matrix;
    
                               uniform lowp vec4 u_color;
                               uniform lowp float u_opacity;
    
                               void main() {
                                   lowp vec4 color = u_color;
                                   lowp float opacity = u_opacity;
    
                                   gl_Position = u_matrix * vec4(a_pos, 0, 1);
                               }
    

    I'm running Windows 10 with an AMD FirePro W5100 GPU

  10. drd commented on Oct 20, 2016

    @drd

    Any updates on this? We are using software GL in the meantime, but that's definitely not a great solution in the long run. Does anyone have theories as to where the problem is?

  11. uudruid74 commented on Oct 22, 2016

    @uudruid74

    Software GL using Mesa fails for me, -gpu swiftshader works for me:
    LD_PRELOAD='/usr/lib64/libstdc++.so.6' emulator -no-boot-anim -netdelay none -netspeed full -avd Nexus_5_API_22_x86 -gpu swiftshader -qemu -m 1526

  12. uudruid74 commented on Oct 27, 2016

    @uudruid74

    The issue (at least for me) is that the Android Emulator is supporting OpenGL in hardware but not GLES. This is triggering different code to be compiled, and the code is evidently buggy when GL_ES is not defined. This output is using the standard Mapbox Android SDK installed via Maven (see the last line in the dump). It would appear highp needs to have a type defined, but does not!

    10-25 23:16:35.504 2444-2444/? E/mbgl: [Shader]: Shader failed to compile: ERROR: Valid GLSL but not GLSL ES
    10-25 23:16:35.504 2444-2444/? E/mbgl: [Shader]: Vertex shader fill failed to compile: precision highp float;
    #ifdef GL_ES
    precision highp float;
    #else
    #define lowp
    #define mediump
    #define highp
    #endif
    attribute vec2 a_pos;
    uniform mat4 u_matrix;
    void main() {
    gl_Position = u_matrix * vec4(a_pos, 0, 1);
    }
    --------- beginning of crash
    10-25 23:16:35.506 2444-2444/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadcab1 in tid 2444 (oid.untamedmaps)
    10-25 23:16:35.607 1132-1132/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    10-25 23:16:35.607 1132-1132/? I/DEBUG: Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:5.1.1/LMY48X/2780077:userdebug/test-keys'
    10-25 23:16:35.608 1132-1132/? I/DEBUG: Revision: '0'
    10-25 23:16:35.608 1132-1132/? I/DEBUG: ABI: 'x86_64'
    10-25 23:16:35.608 1132-1132/? I/DEBUG: pid: 2444, tid: 2444, name: oid.untamedmaps >>> systems.eddon.android.untamedmaps <<<
    10-25 23:16:35.608 1132-1132/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadcab1
    10-25 23:16:35.618 1132-1132/? I/DEBUG: rax 00000000deadcab1 rbx 00007fff34ed3170 rcx 0000000000000000 rdx 00007f9c04605700
    10-25 23:16:35.618 1132-1132/? I/DEBUG: rsi 00007fff34ed31b8 rdi 00007f9c05fe4b60
    10-25 23:16:35.618 1132-1132/? I/DEBUG: r8 00007fff34ed2f60 r9 00007f9c0621cb01 r10 00007f9c0623acd0 r11 00007f9c05d93000
    10-25 23:16:35.618 1132-1132/? I/DEBUG: r12 00007f9c1ba997c0 r13 000000001308c220 r14 00007fff34ed31b8 r15 00007f9c180c7300
    10-25 23:16:35.618 1132-1132/? I/DEBUG: cs 0000000000000033 ss 000000000000002b
    10-25 23:16:35.618 1132-1132/? I/DEBUG: rip 00007f9c05fe4b6d rbp 00007fff34ed3130 rsp 00007fff34ed3130 eflags 0000000000010206
    10-25 23:16:35.618 1132-1132/? I/DEBUG: backtrace:
    10-25 23:16:35.618 1132-1132/? I/DEBUG: #00 pc 0000000000251b6d /data/app/systems.eddon.android.untamedmaps-1/lib/x86_64/libmapbox-gl.so
    10-25 23:16:35.618 1132-1132/? I/DEBUG: #01 pc 0000000000251b97 /data/app/systems.eddon.android.untamedmaps-1/lib/x86_64/libmapbox-gl.so
    10-25 23:16:35.618 1132-1132/? I/DEBUG: #02 pc 0000000000251b56 /data/app/systems.eddon.android.untamedmaps-1/lib/x86_64/libmapbox-gl.so (std::terminate()+22)
    10-25 23:16:35.619 1132-1132/? I/DEBUG: #03 pc 00000000002524c4 /data/app/systems.eddon.android.untamedmaps-1/lib/x86_64/libmapbox-gl.so (std::rethrow_exception(std::exception_ptr)+20)
    10-25 23:16:35.619 1132-1132/? I/DEBUG: #04 pc 0000000000105bc9 /data/app/systems.eddon.android.untamedmaps-1/lib/x86_64/libmapbox-gl.so (jni::ThrowJavaError(_JNIEnv&, std::exception_ptr)+57)
    10-25 23:16:35.619 1132-1132/? I/DEBUG: #05 pc 000000000011483f /data/app/systems.eddon.android.untamedmaps-1/lib/x86_64/libmapbox-gl.so
    10-25 23:16:35.619 1132-1132/? I/DEBUG: #06 pc 00000000000381f3 /data/data/systems.eddon.android.untamedmaps/cache/slice-com.mapbox.mapboxsdk-mapbox-android-sdk-4.1.1_1a31abfec8c174e9a709d81268f840582d8f19d6-classes.dex
    
  13. jeffypooo commented on Nov 12, 2016

    @jeffypooo

    Still experiencing this issue, any news?

  14. tobrun commented on Nov 14, 2016

    @tobrun
    Member

    Fixed with #7044, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions