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.

glBindAttribLocation(id, location, name): Error GL_INVALID_VALUE #9331

Closed

Description

@ivovandongen

Platform: Android 4.3 on Nexus 4
Mapbox SDK version: master

Steps to trigger behavior

  1. Open SimpleMapViewActivity
  2. Zoom in a bit
W/mbgl    ( 8747): {pboxsdk.testapp}[OpenGL]: Caching program in: /data/data/com.mapbox.mapboxsdk.testapp/cache/com.mapbox.gl.shader.fill.1e5a3a34.pbf
W/mbgl    ( 8747): {pboxsdk.testapp}[OpenGL]: Caching program in: /data/data/com.mapbox.mapboxsdk.testapp/cache/com.mapbox.gl.shader.fill_outline.1e5a3a34.pbf
...
D/AndroidRuntime( 8747): Shutting down VM
W/dalvikvm( 8747): threadid=1: thread exiting with uncaught exception (group=0x4173a700)
E/AndroidRuntime( 8747): FATAL EXCEPTION: main
E/AndroidRuntime( 8747): java.lang.Error: glBindAttribLocation(id, location, name): Error GL_INVALID_VALUE at /Users/ivo/git/mapbox-gl-native/src/mbgl/gl/attribute.cpp:9
E/AndroidRuntime( 8747): 	at com.mapbox.mapboxsdk.maps.NativeMapView.nativeRender(Native Method)
E/AndroidRuntime( 8747): 	at com.mapbox.mapboxsdk.maps.NativeMapView.render(NativeMapView.java:176)
E/AndroidRuntime( 8747): 	at com.mapbox.mapboxsdk.maps.MapView.onDraw(MapView.java:420)
E/AndroidRuntime( 8747): 	at android.view.View.draw(View.java:13944)
E/AndroidRuntime( 8747): 	at android.widget.FrameLayout.draw(FrameLayout.java:467)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12838)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3057)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12775)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3057)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12775)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3057)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12775)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3057)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12775)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3057)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12775)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3057)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12775)
E/AndroidRuntime( 8747): 	at android.view.View.getDisplayList(View.java:12880)
E/AndroidRuntime( 8747): 	at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1411)
E/AndroidRuntime( 8747): 	at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1359)
E/AndroidRuntime( 8747): 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:2367)
E/AndroidRuntime( 8747): 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2239)
E/AndroidRuntime( 8747): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1872)
E/AndroidRuntime( 8747): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
E/AndroidRuntime( 8747): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
E/AndroidRuntime( 8747): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
E/AndroidRuntime( 8747): 	at android.view.Choreographer.doCallbacks(Choreographer.java:562)
E/AndroidRuntime( 8747): 	at android.view.Choreographer.doFrame(Choreographer.java:532)
E/AndroidRuntime( 8747): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
E/AndroidRuntime( 8747): 	at android.os.Handler.handleCallback(Handler.java:730)
E/AndroidRuntime( 8747): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 8747): 	at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 8747): 	at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime( 8747): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 8747): 	at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime( 8747): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime( 8747): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime( 8747): 	at dalvik.system.NativeStart.main(Native Method)

Activity

  1. added
    Android
    Core
    on Jun 21, 2017
  2. jfirebaugh commented on Jun 21, 2017

    @jfirebaugh
    Contributor

    According to GL specs GL_INVALID_VALUE here means either:

    • index is greater than or equal to GL_MAX_VERTEX_ATTRIBS
    • program is not a value generated by OpenGL

    @ivovandongen Are you able to tell if either of those is the case?

  3. ivovandongen commented on Jun 21, 2017

    @ivovandongen
    ContributorAuthor

    It seems that we have 9 vertex attributes in this program (which is more than the 8 allowed on this device):

    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 0, attribute name: a_pos
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 1, attribute name: a_data
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 2, attribute name: a_opacity
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 3, attribute name: a_color
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 4, attribute name: a_width
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 5, attribute name: a_gapwidth
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 6, attribute name: a_offset
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 7, attribute name: a_blur
    06-22 00:44:51.928 9923-9923/com.mapbox.mapboxsdk.testapp I/mbgl: {pboxsdk.testapp}[General]: Program id 910013, Attribute location 8, attribute name: a_floorwidth
    
  4. ivovandongen commented on Jun 21, 2017

    @ivovandongen
    ContributorAuthor

    The shader involved is the line shader (in this case for the admin-2-boundaries layer)

  5. ivovandongen commented on Jun 21, 2017

    @ivovandongen
    ContributorAuthor

    Looks like #9250 might have pushed the number of attributes over the limit.

    cc @lbud

  6. jfirebaugh commented on Jun 22, 2017

    @jfirebaugh
    Contributor

    Ah, damn. Well, now that native follows the gl-js dynamic shader strategy, we could rework the code to also avoid calling glBindAttribLocation for an attribute that won't be used. Then the 8 attribute limit would be hit only if you attempt to make all the properties data-driven simultaneously.

    Otherwise we'll have to figure out how to pack a_width and a_floorwidth together or something.

  7. added this to the android-v5.2.0 milestone on Jun 22, 2017
  8. lbud commented on Jun 24, 2017

    @lbud
    Contributor

    Capturing from slack + voice with @kkaefer:

    We can't use glGetActiveAttrib because the program isn't linked yet by the time we need to bind attributes. We will therefore need to pass information about attributes (layout attributes + non-constant paint properties) into bindLocations when constructing the program. ⏳

  9. jfirebaugh commented on Jun 24, 2017

    @jfirebaugh
    Contributor

    You can link the program once (which will assign default locations for the attributes), use glGetActiveAttrib, reassign locations with glBindAttribLocation, then link the program again.

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

    AndroidCore

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions