google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.95k stars 1.22k forks source link

glError 1282 error - only on release version? #1565

Open wearetelescopic opened 1 year ago

wearetelescopic commented 1 year ago

SPECIFIC ISSUE ENCOUNTERED

I've got an app that works perfectly well during development and testing. It's using the ObjectRenderer.java or OcclusionObjectRenderer.java classes from the ARCore examples to render and object onto an achor on a plane. (see https://github.com/googlecodelabs/arcore-depth).

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. onDrawFrame, add an object to an anchor, e.g. occludedVirtualObject.updateModelMatrix(anchorMatrix, scaleFactor); occludedVirtualObject.draw(viewmtx, projmtx, colorCorrectionRgba, OBJECT_COLOR);``
    1. upload app to play store
    2. download via play store, run and test Triggers the error in ObjectRenderer.java ShaderUtil.checkGLError(TAG, "After draw");

WORKAROUNDS (IF ANY)

n/a

ADDITIONAL COMMENTS

I have no idea how to debug this, given that this only happens on release apps. The moment we start debugging, the error disappears and everything works as expected.

devbridie commented 1 year ago

Can you run the app locally but in release mode? Here's some steps: https://developer.android.com/studio/run#changing-variant

Additionally you could try adding ShaderUtil.checkGLError after each OpenGL call to figure our which GL call triggers the error. I would suspect a shader optimisation where you'd be setting a shader variable that is actually unused, which is detected in shader compilation and removed.

wearetelescopic commented 1 year ago

Thanks, I just did that as suggested - run as release, but as per the debug version it works just fine! Any further ideas...?

wearetelescopic commented 1 year ago

Got some more info, uploaded the release to play store with the additional debug info, and the error is triggered right after this line in the ObjectRenderer:

GLES20.glUniform4f(
        lightingParametersUniform,
        viewLightDirection[0],
        viewLightDirection[1],
        viewLightDirection[2],
        1.f);

Anyone any idea why this would be the case only on the play store?