baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.86k stars 1.33k forks source link

SIGSEGV in arm64/libVkLayer_GLES_RenderDoc.so #1254

Closed stolk closed 5 years ago

stolk commented 5 years ago

When I press "Capture frame", my 64b arm app crashes in arm64/libVkLayer_GLES_RenderDoc.so

That .so doesn't seem to have symbols, unfortunately, so I can't see in which function call it crashes. If you have a .so with symbols, I am happy to try that out.

Device log below, from Huawei Honor 8 tablet, 64bit 6.0.1 android.

I/renderdoc( 7758): RDOC 007758: [05:28:25]     android_hook.cpp( 785) - Log     - Refreshing android hooks...
I/renderdoc( 7758): RDOC 007758: [05:28:25]     android_hook.cpp( 787) - Log     - Refreshed
I/renderdoc( 7758): RDOC 007758: [05:28:25]        gl_driver.cpp( 959) - Log     - Core context 00000055997E5EE0 created with attribs, sharing with context 0000000000000000
I/renderdoc( 7758): RDOC 007758: [05:28:25]        gl_common.cpp( 461) - Log     - Checking enabled extensions, running as OpenGL ES 3.1
I/renderdoc( 7758): RDOC 007758: [05:28:25]      gl_emulated.cpp(2064) - Log     - Emulating ARB_clear_buffer_object
I/renderdoc( 7758): RDOC 007758: [05:28:25]      gl_emulated.cpp(2079) - Log     - Emulating ARB_internalformat_query2
I/renderdoc( 7758): RDOC 007758: [05:28:25]      gl_emulated.cpp(2133) - Log     - Emulating EXT_direct_state_access
I/renderdoc( 7758): RDOC 007758: [05:28:25]      gl_emulated.cpp(2220) - Log     - Emulating ARB_direct_state_access
I/renderdoc( 7758): RDOC 007758: [05:28:25]        gl_driver.cpp(1167) - Log     - Activating new GL context: Qualcomm / Adreno (TM) 405 / OpenGL ES 3.1 V@140.0 (GIT@I7d704ff208)
I/armor   ( 7758): Created surface of size 1920x1200
I/armor   ( 7758): DEBUG build Armor V1.26
I/armor   ( 7758): GL_RENDERER: Adreno (TM) 405
I/armor   ( 7758): GL_VERSION: OpenGL ES 3.1 V@140.0 (GIT@I7d704ff208)
I/armor   ( 7758): GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 3.10
I/armor   ( 7758): Chipmunk2D is using single precision.
I/armor   ( 7758): Does not support debug output.
I/armor   ( 7758): Compiled vertex shader Hud
I/armor   ( 7758): Compiled fragment shader Hud
I/armor   ( 7758): Loaded program Hud as handle 1
I/armor   ( 7758): Compiled vertex shader Font
I/armor   ( 7758): Compiled fragment shader Font
I/armor   ( 7758): Loaded program Font as handle 4
I/armor   ( 7758): Compiled vertex shader Wall
I/armor   ( 7758): Compiled fragment shader Wall
I/armor   ( 7758): Loaded program Wall as handle 7
I/armor   ( 7758): Compiled vertex shader Prts
I/armor   ( 7758): Compiled fragment shader Prts
I/armor   ( 7758): Loaded program Prts as handle 10
I/armor   ( 7758): Compiled vertex shader Clds
I/armor   ( 7758): Compiled fragment shader Clds
I/armor   ( 7758): Loaded program Clds as handle 13
I/armor   ( 7758): ctrl_create( 1920, 1200 )
I/armor   ( 7758): Setting up view for 1920x1200 @1.000000x
V/GamesNativeSDK( 7758): Play Games callback indicates connection failure.
I/ActivityManager( 1200): Displayed com.steenriver.armor/.ArmorActivity: +5s698ms (total +53s425ms)
I/armor   ( 7758): Loaded 5 textures for tanks.
E/GoogleApiAvailability( 7758): Google Play services is invalid. Cannot recover.
W/JankManagerService(  399): START_APP: JL_APP_LAUNCHING_END and JL_APP_LAUNCHING_BEGIN too long| span:5697
I/GamesNativeSDK( 7758): Error connecting to Google Play: code 9.
I/armor   ( 7758): Sign in finished with a result ERROR_NOT_AUTHORIZED
I/armor   ( 7758): OnAuthActionFinished
I/armor   ( 7758): You are not logged in!
I/renderdoccmd( 7602): handle_cmd(12)
I/renderdoccmd( 7602): handle_cmd(14)
I/armor   ( 7758): Loaded 13 textures for tanks.
I/armor   ( 7758): Loaded 3 textures for bullets.
I/armor   ( 7758): Loaded 7 textures for powerups.
I/armor   ( 7758): Loaded 2 textures for explosions.
I/armor   ( 7758): Loaded 3 textures for smokepods.
I/armor   ( 7758): Loaded 1 textures for annotations.
I/armor   ( 7758): Loaded 6 non-mipmap textures for hud.
I/armor   ( 7758): Total size in VBOs is 12864 bytes in 6 VBOs.
I/OpenAL_SLES( 7758): OpenSLES could not be loaded.
I/OpenAL_SLES( 7758): opensles_open_playback pDevice=0x5599b69ca0, deviceName=Android Default
I/OpenAL_SLES( 7758): OpenSLES could not be loaded.
I/armor   ( 7758): Using OpenAL device 'Android Default'
I/armor   ( 7758): Using ALUT 1.1
I/armor   ( 7758): AL_VENDOR OpenAL Community
I/armor   ( 7758): AL_RENDERER OpenAL Soft
I/armor   ( 7758): AL_VERSION 1.1 ALSOFT 1.12.854
I/OpenAL  ( 7758): _SC_NPROCESSORS_ONLN=8
I/armor   ( 7758): CMD_INIT_WINDOW handled
V/GamesNativeSDK( 7758): Detaching from JVM on thread main_dispatch
W/InputEventReceiver( 7758): Attempted to finish an input event but the input event receiver has already been disposed.
V/threaded_app( 7758): WindowFocusChanged: 0x559945c150 -- 1
V/ArmorActivity( 7758): onWindowFocusChanged
I/armor   ( 7758): CMD_GAINED_FOCUS handled
I/armor   ( 7758): Created 37 polygonal walls.
I/armor   ( 7758): Spawned 2 tanks.
I/armor   ( 7758): Created 0 patrol routes.
I/renderdoc( 7758): RDOC 007758: [05:29:25]        gl_driver.cpp(1851) - Log     - Starting capture, frame 3509
F/libc    ( 7758): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 7857 (Thread-10538)
F/DEBUG   (  503): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
F/DEBUG   (  503): Build fingerprint: 'Huawei/JDN/hwjdn:6.0.1/HuaweiMediaPad/JDN-W09C233B023:user/release-keys'
F/DEBUG   (  503): Revision: '0'
F/DEBUG   (  503): ABI: 'arm64'
F/DEBUG   (  503): pid: 7758, tid: 7857, name: Thread-10538  >>> com.steenriver.armor <<<
F/DEBUG   (  503): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x28
F/DEBUG   (  503):     x0   0000005598a9bc40  x1   0000000000000040  x2   0000000000000001  x3   0000000000000001
F/DEBUG   (  503):     x4   0000000000000000  x5   0000000000000001  x6   0000005599bd7880  x7   92062450000e0576
F/DEBUG   (  503):     x8   0000000000000000  x9   0000007f962bca20  x10  0000000000008c8e  x11  0000000000008892
F/DEBUG   (  503):     x12  0000000000000000  x13  0000000000000000  x14  0000000000000000  x15  0000007fb087abd8
F/DEBUG   (  503):     x16  0000007f96313ab8  x17  0000007fb07e4c48  x18  0000000000000024  x19  0000007f9635e3b8
F/DEBUG   (  503):     x20  0000007f9635efb8  x21  00000055997e61e8  x22  0000005599810020  x23  0000000100000576
F/DEBUG   (  503):     x24  000000000000009f  x25  0000000000000000  x26  00000055997e61e8  x27  a272ef2690590a26
F/DEBUG   (  503):     x28  0000000000001000  x29  0000007f92058590  x30  0000007f955a6900
F/DEBUG   (  503):     sp   0000007f920584c0  pc   0000007f955a6974  pstate 0000000080000000
F/DEBUG   (  503): 
F/DEBUG   (  503): backtrace:
F/DEBUG   (  503):     #00 pc 0000000000244974  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so
F/DEBUG   (  503):     #01 pc 000000000026e540  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so
F/DEBUG   (  503):     #02 pc 000000000026e838  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so
F/DEBUG   (  503):     #03 pc 000000000030aafc  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so
F/DEBUG   (  503):     #04 pc 00000000001e5fe0  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (_Z9dirt_drawv+2556)
F/DEBUG   (  503):     #05 pc 0000000000216ccc  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (_Z13wld_draw_dirtv+656)
F/DEBUG   (  503):     #06 pc 00000000001dfb3c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (_Z14ctrl_drawFramev+8664)
F/DEBUG   (  503):     #07 pc 00000000001d859c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so
F/DEBUG   (  503):     #08 pc 00000000001d789c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (android_main+716)
F/DEBUG   (  503):     #09 pc 000000000024c55c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so
F/DEBUG   (  503):     #10 pc 0000000000067684  /system/lib64/libc.so (_ZL15__pthread_startPv+52)
F/DEBUG   (  503):     #11 pc 000000000001c684  /system/lib64/libc.so (__start_thread+16)
F/DEBUG   (  503): 
F/DEBUG   (  503): Tombstone written to: /data/tombstones/tombstone_01
W/ActivityManager( 1200):   Force finishing activity com.steenriver.armor/.ArmorActivity
E/DEBUG   (  503): AM write failed: Broken pipe
I/BootReceiver( 1200): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
E/JavaBinder( 1200): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 112)
W/ActivityManager( 1200): Exception thrown during pause
W/ActivityManager( 1200): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
W/ActivityManager( 1200):   at android.os.BinderProxy.transactNative(Native Method)
W/ActivityManager( 1200):   at android.os.BinderProxy.transact(Binder.java:505)
W/ActivityManager( 1200):   at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
W/ActivityManager( 1200):   at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:1056)
W/ActivityManager( 1200):   at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:3628)
W/ActivityManager( 1200):   at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:3452)
W/ActivityManager( 1200):   at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:3273)
W/ActivityManager( 1200):   at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:12605)
W/ActivityManager( 1200):   at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:12500)
W/ActivityManager( 1200):   at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:13207)
W/ActivityManager( 1200):   at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12709)
W/ActivityManager( 1200):   at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
E/lowmemorykiller(  358): Error writing /proc/7758/oom_score_adj; errno=22
W/ActivityManager( 1200):   Force finishing activity org.renderdoc.renderdoccmd.arm64/.Loader
W/PGApi_client( 2079): recv actoionId = 10000, action = com.huawei.pgmng.PGAction@ae1a6cc actionId =10000 pkg =org.renderdoc.renderdoccmd.arm64 extend1 =926 extend2 = flag =3 type =1
E/JavaBinder( 1200): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 60)
W/ActivityManager( 1200): Skipping native crash dialog of ProcessRecord{181f220 7758:com.steenriver.armor/u0a103}
I/renderdoccmd( 7602): handle_cmd(10)
I/renderdoccmd( 7602): handle_cmd(11)
I/renderdoccmd( 7602): handle_cmd(13)
E/ReportTools( 1200): This is not beta user build
W/PGApi_client( 2079): recv actoionId = 10000, action = com.huawei.pgmng.PGAction@ae5d15 actionId =10000 pkg =com.android.settings extend1 =926 extend2 = flag =3 type =1
I/renderdoccmd( 7602): handle_cmd(1)
I/renderdoccmd( 7602): APP_CMD_INIT_WINDOW
I/renderdoccmd( 7602): thread handle exists
I/renderdoccmd( 7602): Trying to splash
I/renderdoccmd( 7602): Doing a splash
I/Adreno  ( 7602): QUALCOMM build                   : 2d64e0f, I7d704ff208
I/Adreno  ( 7602): Build Date                       : 08/08/16
I/Adreno  ( 7602): OpenGL ES Shader Compiler Version: XE031.06.00.05
I/Adreno  ( 7602): Local Branch                     : mybranch21199707
I/Adreno  ( 7602): Remote Branch                    : quic/LA.BR.1.2.6_rb1.16
I/Adreno  ( 7602): Remote Branch                    : NONE
I/Adreno  ( 7602): Reconstruct Branch               : NOTHING
D/Index   ( 3695): Locale 'en_CA' is already indexed
D/GraphicsStats( 1200): Buffer count: 9
I/WindowState( 1200): WIN DEATH: Window{d05a4ac u0 com.steenriver.armor/com.steenriver.armor.ArmorActivity}
I/Zygote  (  530): Process 7758 exited due to signal (11)
I/ActivityManager( 1200): Process com.steenriver.armor (pid 7758) has died
D/ActivityManager( 1200): cleanUpApplicationRecord -- 7758
I/renderdoccmd( 7602): Done splashing
W/DeviceInfoFile( 2376): !devFile.exists()
E/DeviceInfo( 2376): file is not exist: /proc/ddr_info
E/DeviceInfo( 2376): can't get ddr, default value: NULL
W/PGApi_client( 2079): recv actoionId = 10010, action = com.huawei.pgmng.PGAction@dd8382a actionId =10010 pkg =com.huawei.android.launcher extend1 =926 extend2 = flag =3 type =1
I/ActivityManager( 1200): Killing 6849:com.huawei.android.hwouc/u0a47 (adj 15): empty #17
I/renderdoccmd( 7602): handle_cmd(14)
I/renderdoccmd( 7602): handle_cmd(2)
D/ActivityManager( 1200): cleanUpApplicationRecord -- 6849
I/renderdoccmd( 7602): handle_cmd(0)
I/renderdoccmd( 7602): handle_cmd(15)
I/renderdoccmd( 7602): android_main exiting
E/PackageLogInfoManager( 2376): checkPackageLogState, cr: android.app.ContextImpl$ApplicationContentResolver@808979e, packageNames: null
D/MRUtils ( 2141): getMotionEnableState enabled: 1
D/MRUtils ( 2141): getMotionEnableState enabled: 0
W/InputMethodManagerService( 1200): Got RemoteException sending setActive(false) notification to pid 7758 uid 10103
W/WindowAnimator( 1200): Failed to dispatch window animation state change.
W/WindowAnimator( 1200): android.os.DeadObjectException
W/WindowAnimator( 1200):    at android.os.BinderProxy.transactNative(Native Method)
W/WindowAnimator( 1200):    at android.os.BinderProxy.transact(Binder.java:505)
W/WindowAnimator( 1200):    at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
W/WindowAnimator( 1200):    at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:293)
W/WindowAnimator( 1200):    at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:688)
W/WindowAnimator( 1200):    at com.android.server.wm.WindowAnimator.access$000(WindowAnimator.java:53)
W/WindowAnimator( 1200):    at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:126)
W/WindowAnimator( 1200):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:882)
W/WindowAnimator( 1200):    at android.view.Choreographer.doCallbacks(Choreographer.java:696)
W/WindowAnimator( 1200):    at android.view.Choreographer.doFrame(Choreographer.java:628)
W/WindowAnimator( 1200):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:870)
W/WindowAnimator( 1200):    at android.os.Handler.handleCallback(Handler.java:743)
W/WindowAnimator( 1200):    at android.os.Handler.dispatchMessage(Handler.java:95)
W/WindowAnimator( 1200):    at android.os.Looper.loop(Looper.java:150)
W/WindowAnimator( 1200):    at android.os.HandlerThread.run(HandlerThread.java:61)
W/WindowAnimator( 1200):    at com.android.server.ServiceThread.run(ServiceThread.java:46)
W/OpenGLRenderer( 2141): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
W/OpenGLRenderer( 2141): Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
baldurk commented 5 years ago

The default Android build process strips symbols so I can't easily give you a .so. If you build from source locally though you'll get proper symbols. When you build you'll need an android version of llvm-4.0 to get interceptor-lib working, without which you might not get hooking properly. I've uploaded my build of llvm up here since it's a PITA to get building.

If you're able to share your apk with me either here or privately, I can also look into the crash and debug it from my side. I might need something like that anyway as it's quite likely the callstack alone won't point directly to the culprit.

stolk commented 5 years ago

Thanks. I'll try building it myself first.

I'm using these instructions: https://github.com/baldurk/renderdoc/blob/v1.x/docs/CONTRIBUTING/Compiling.md

But I get:

bram@Desktop64:~/src/renderdoc/build-android$ cmake -DBUILD_ANDROID=On -DANDROID_ABI=arm64-v8a ..
CMake Error at /usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:100 (message):
  Could not find toolchain file: /build/cmake/android.toolchain.cmake
Call Stack (most recent call first):
  CMakeLists.txt:108 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

I have SDK and NDK installed, and ANDROID_HOME and ANDROID_NDK_HOME are pointing to them.

I tried adding a reference to the make binary too, to no avail:

bram@Desktop64:~/src/renderdoc/build-android$ cmake -DBUILD_ANDROID=On -DANDROID_ABI=arm64-v8a -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ..
CMake Error at /usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:100 (message):
  Could not find toolchain file: /build/cmake/android.toolchain.cmake
Call Stack (most recent call first):
  CMakeLists.txt:108 (project)

-- Configuring incomplete, errors occurred!
baldurk commented 5 years ago

The cmake build expects $ANDROID_NDK to be pointing to the root of the NDK, it's outlined in the dependencies page linked from that compiling page. Looks like it doesn't have any error checks for if the variable is empty.

I'm not super familiar with android to know if ANDROID_NDK_HOME is common, but I think I can set up the cmake script to check both variables anyway, but in the meantime export ANDROID_NDK=$ANDROID_NDK_HOME should fix it for you.

stolk commented 5 years ago

Thank you for the llvm and the instructions.

I managed to build it, and get more information on the crash.

It looks like WrappedOpenGL::glBindBuffer(RDCGLenum, unsigned int) uses a pointer to a ResourceRecord that is nil. And all triggered by a glDrawArrays that my app does.

F/DEBUG   (  503): backtrace:
F/DEBUG   (  503):     #00 pc 00000000002852e8  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so (_ZNK14ResourceRecord13GetResourceIDEv+32)
F/DEBUG   (  503):     #01 pc 00000000004b3464  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so (_ZN13WrappedOpenGL12glBindBufferE9RDCGLenumj+716)
F/DEBUG   (  503):     #02 pc 000000000052eda0  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so (_ZN13WrappedOpenGL25RestoreClientMemoryArraysEPNS_16ClientMemoryDataE9RDCGLenum+668)
F/DEBUG   (  503):     #03 pc 000000000052f18c  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so (_ZN13WrappedOpenGL12glDrawArraysE9RDCGLenumii+524)
F/DEBUG   (  503):     #04 pc 00000000006e3ea0  /data/app/org.renderdoc.renderdoccmd.arm64-1/lib/arm64/libVkLayer_GLES_RenderDoc.so (_Z29glDrawArrays_renderdoc_hooked9RDCGLenumii+108)
F/DEBUG   (  503):     #05 pc 00000000001e5fe0  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (_Z9dirt_drawv+2556)
F/DEBUG   (  503):     #06 pc 0000000000216ccc  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (_Z13wld_draw_dirtv+656)
F/DEBUG   (  503):     #07 pc 00000000001dfb3c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (_Z14ctrl_drawFramev+8664)
F/DEBUG   (  503):     #08 pc 00000000001d859c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so
F/DEBUG   (  503):     #09 pc 00000000001d789c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so (android_main+716)
F/DEBUG   (  503):     #10 pc 000000000024c55c  /data/app/com.steenriver.armor-1/lib/arm64/libarmor.so
F/DEBUG   (  503):     #11 pc 0000000000067684  /system/lib64/libc.so (_ZL15__pthread_startPv+52)
F/DEBUG   (  503):     #12 pc 000000000001c684  /system/lib64/libc.so (__start_thread+16)
F/DEBUG   (  503): 
F/DEBUG   (  503): Tombstone written to: /data/tombstones/tombstone_03

Demangled, this is the stacktrace:

ResourceRecord::GetResourceID() const
WrappedOpenGL::glBindBuffer(RDCGLenum, unsigned int)
WrappedOpenGL::RestoreClientMemoryArrays(WrappedOpenGL::ClientMemoryData*, RDCGLenum)
WrappedOpenGL::glDrawArrays(RDCGLenum, int, int)
glDrawArrays_renderdoc_hooked(RDCGLenum, int, int)
dirt_draw()
...
baldurk commented 5 years ago

That seems to suggest that the binding on ARRAY_BUFFER at the time of the draw was some buffer we didn't recognise, so we crash trying to re-bind it. To figure out the crash we'd need to track down why that is.

It could be hooking related - do you get any errors in logcat for your arm64 build, as I know your arm32 build had trouble?

I've also pushed a branch logging_1254 with an extra commit that logs buffer creation/destruction and the specific buffers found at the time of the draw. If it's not too difficult it would be helpful if you could log the GL buffer names in your application that you expect to be bound to ARRAY_BUFFER at the time and where they got created, that could narrow down which buffer in particular is not getting recognised.

stolk commented 5 years ago

Same hook errors as I had before. See attached log.

But I think it manages to hook, because there is no "Not Presenting" and I also see the statistics being overlaid at the top of my app, with renderdoc timings and such.

I'll try your branch.

android.log

baldurk commented 5 years ago

That means it's very likely still the same hooking problem.

The difference is that in the previous android log you posted it was also seeing hooking failures for EGL functions including eglSwapBuffers - and if eglSwapBuffers isn't hit then it will not show the RenderDoc overlap and it will display as "Not Presenting" because the present boundary isn't hit.

In your latest log all the egl functions have been hooked which means that works - but lots of gl functions are still failing to hook.

My guess is that somehow glDrawArrays is being hooked and going through my code, but glGenBuffers isn't. Perhaps it's getting hooked too late, after the point where you've already created some buffers. If a buffer is bound that RenderDoc didn't intercept the creation for, then you'd see a crash like the one you're getting. If you try my branch you'll be able to see based on the presence or absence of logging calls.

stolk commented 5 years ago

I think it sees the glGenBuffers, because it shows up in the log:

I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 544) - Warning - Couldn't find __loader_dlopen, falling back to slow path for dlopen hooking
I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 785) - Log     - Refreshing android hooks...
I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 333) - Warning - Couldn't open 'com.steenriver.armor' to look for relro!
I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 287) - Warning - Missing required section to hook [vdso]
I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 287) - Warning - Missing required section to hook /data/dalvik-cache/arm64/system@framework@boot.oat
I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 787) - Log     - Refreshed
I/renderdoc(11326): RDOC 011326: [03:24:26]     android_hook.cpp( 746) - Log     - Fetching 458 original function pointers over 3 libraries
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 762) - Log     - Finished
I/renderdoc(11326): RDOC 011326: [03:24:27]        egl_hooks.cpp( 611) - Debug   - EGL library hooked
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 780) - Log     - Called library callbacks - hook registration complete
V/ActivityThread(11326): ActivityThread,callActivityOnCreate
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 287) - Warning - Missing required section to hook /system/framework/oat/arm64/QPerformance.odex
I/OpenAL_SLES(11326): alc_opensles_init
V/threaded_app(11326): Creating: 0x5598afde80
V/threaded_app(11326): Config: mcc=0 mnc=0 lang=en cnt=CA orien=2 touch=3 dens=320 keys=1 nav=1 keysHid=3 navHid=0 sdk=23 size=3 long=1 modetype=1 modenight=1
V/ArmorActivity(11326): onCreate
I/OpenAL_SLES(11326): API:23
I/OpenAL_SLES(11326): Model:JDN-W09
I/armor   (11326): filesPath set to /data/user/0/com.steenriver.armor/files
V/ArmorActivity(11326): sourceDir /data/app/com.steenriver.armor-2/base.apk
V/ArmorActivity(11326): native library dir /data/app/com.steenriver.armor-2/lib/arm64
I/armor   (11326): libsPath set to /data/app/com.steenriver.armor-2/lib/arm64
I/armor   (11326): STRING PASSED FROM JAVA:'zz'
E/ArmorActivity(11326): DisplayMetrics{density=2.0, width=1836, height=1200, scaledDensity=2.0, xdpi=225.777, ydpi=224.737}
E/ArmorActivity(11326): Diagonal in pixels:2193.375480851375
E/ArmorActivity(11326): Diagonal in inches:9.737213575129976
I/armor   (11326): STRING PASSED FROM JAVA:'7YRBBDB6B3003105'
I/armor   (11326): Identification nr: 960
D/ArmorActivity(11326): Creating IAB helper.
D/IabHelper(11326): Starting in-app billing setup.
D/ArmorActivity(11326): Setup finished.
E/ArmorActivity(11326): *** IAB3 ERROR *** Problem setting up in-app billing: IabResult: Billing service unavailable on device. (response: 3:Billing Unavailable)
D/HwSensorManager(11326): HwSensorManager version: 1.0.0
I/armor   (11326): No saved state to restore. We could set up the Google Play services.
I/armor   (11326): Initializing Services
I/armor   (11326): thread id is 11424, pid is 11326
I/armor   (11326): Uninitialized services, so creating
V/GamesNativeSDK(11326): Using classes from /data/user/0/com.steenriver.armor/app_.gpg.classloader/2e190de0913242cfb3e30a895073c67e_games.jar.
I/GamesNativeSDK(11326): Using existing jar.
I/GamesNativeSDK(11326): Writing 1941 bytes to jar file
V/GamesNativeSDK(11326): Using classes from /data/user/0/com.steenriver.armor/app_.gpg.classloader/d4a165677a8f8e2f478bf30b197f93de_nearby.jar.
I/GamesNativeSDK(11326): Using existing jar.
I/GamesNativeSDK(11326): Writing 1066 bytes to jar file
D/OpenGLRenderer(11326): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
I/armor   (11326): Got AssetManager 0x5598c87380 from Java.
I/base    (11326): Asset Manager has been set to 0x5598c87380.
V/threaded_app(11326): Start: 0x5598afde80
V/threaded_app(11326): activityState=10
V/GamesNativeSDK(11326): Received Activity Resume Event.
V/threaded_app(11326): Resume: 0x5598afde80
I/GamesNativeSDK(11326): Connecting to Google Play...
V/threaded_app(11326): activityState=11
I/armor   (11326): CMD_RESUME handled
V/GamesNativeSDK(11326): Attached to JVM on thread main_dispatch
V/threaded_app(11326): InputQueueCreated: 0x5598afde80 -- 0x5599510220
V/threaded_app(11326): APP_CMD_INPUT_CHANGED
V/threaded_app(11326): Attaching input queue to looper
W/GooglePlayServicesUtil(11326): Google Play Store is missing.
I/Adreno  (11326): QUALCOMM build                   : 2d64e0f, I7d704ff208
I/Adreno  (11326): Build Date                       : 08/08/16
I/Adreno  (11326): OpenGL ES Shader Compiler Version: XE031.06.00.05
I/Adreno  (11326): Local Branch                     : mybranch21199707
I/Adreno  (11326): Remote Branch                    : quic/LA.BR.1.2.6_rb1.16
I/Adreno  (11326): Remote Branch                    : NONE
I/Adreno  (11326): Reconstruct Branch               : NOTHING
I/OpenGLRenderer(11326): Initialized EGL, version 1.4
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 785) - Log     - Refreshing android hooks...
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 787) - Log     - Refreshed
I/renderdoc(11326): RDOC 011326: [03:24:27]        egl_hooks.cpp( 202) - Debug   - eglCreateContext:
I/renderdoc(11326): RDOC 011326: [03:24:27]        egl_hooks.cpp( 209) - Debug   - 3098: 2
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_driver.cpp( 960) - Log     - Core context 000000559967AD40 created with attribs, sharing with context 0000000000000000
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_common.cpp( 461) - Log     - Checking enabled extensions, running as OpenGL ES 3.1
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2064) - Log     - Emulating ARB_clear_buffer_object
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2079) - Log     - Emulating ARB_internalformat_query2
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2133) - Log     - Emulating EXT_direct_state_access
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2220) - Log     - Emulating ARB_direct_state_access
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_driver.cpp(1186) - Log     - Activating new GL context: Qualcomm / Adreno (TM) 405 / OpenGL ES 3.1 V@140.0 (GIT@I7d704ff208)
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_common.cpp( 494) - Log     - Vendor checks for 31 (Qualcomm / Adreno (TM) 405 / OpenGL ES 3.1 V@140.0 (GIT@I7d704ff208))
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_common.cpp( 783) - Warning - Reading from the depth buffer using glReadPixels is not supported (GL_NV_read_depth)
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_common.cpp( 787) - Warning - Reading from the stencil buffer using glReadPixels is not supported (GL_NV_read_stencil)
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_common.cpp( 791) - Warning - Reading from the packed depth-stencil buffers using glReadPixels is not supported (GL_NV_read_depth_stencil)
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::7
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [1] == ResourceId::8
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [2] == ResourceId::9
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [3] == ResourceId::10
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [4] == ResourceId::11
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [5] == ResourceId::12
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [6] == ResourceId::13
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [7] == ResourceId::14
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [8] == ResourceId::15
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [9] == ResourceId::16
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [10] == ResourceId::17
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [11] == ResourceId::18
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [12] == ResourceId::19
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [13] == ResourceId::20
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [14] == ResourceId::21
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [15] == ResourceId::22
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::23
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::24
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::25
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::26
W/OpenGLRenderer(11326): load: so=/system/lib64/libhwuibp.so
W/OpenGLRenderer(11326): dlopen failed: library "/system/lib64/libhwuibp.so" not found
W/OpenGLRenderer(11326): Initialize Binary Program Cache: Load Failed
V/threaded_app(11326): NativeWindowCreated: 0x5598afde80 -- 0x55996edbf0
V/threaded_app(11326): APP_CMD_INIT_WINDOW
I/armor   (11326): number of EGL configurations that match our preferred criteria: 1
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 785) - Log     - Refreshing android hooks...
I/renderdoc(11326): RDOC 011326: [03:24:27]     android_hook.cpp( 787) - Log     - Refreshed
I/renderdoc(11326): RDOC 011326: [03:24:27]        egl_hooks.cpp( 202) - Debug   - eglCreateContext:
I/renderdoc(11326): RDOC 011326: [03:24:27]        egl_hooks.cpp( 209) - Debug   - 3098: 3
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_driver.cpp( 960) - Log     - Core context 0000005599801060 created with attribs, sharing with context 0000000000000000
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_common.cpp( 461) - Log     - Checking enabled extensions, running as OpenGL ES 3.1
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2064) - Log     - Emulating ARB_clear_buffer_object
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2079) - Log     - Emulating ARB_internalformat_query2
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2133) - Log     - Emulating EXT_direct_state_access
I/renderdoc(11326): RDOC 011326: [03:24:27]      gl_emulated.cpp(2220) - Log     - Emulating ARB_direct_state_access
I/renderdoc(11326): RDOC 011326: [03:24:27]        gl_driver.cpp(1186) - Log     - Activating new GL context: Qualcomm / Adreno (TM) 405 / OpenGL ES 3.1 V@140.0 (GIT@I7d704ff208)
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::31
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [1] == ResourceId::32
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [2] == ResourceId::33
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [3] == ResourceId::34
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [4] == ResourceId::35
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [5] == ResourceId::36
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [6] == ResourceId::37
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [7] == ResourceId::38
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [8] == ResourceId::39
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [9] == ResourceId::40
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [10] == ResourceId::41
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [11] == ResourceId::42
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [12] == ResourceId::43
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [13] == ResourceId::44
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [14] == ResourceId::45
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [15] == ResourceId::46
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::47
I/armor   (11326): Created surface of size 1920x1200
I/armor   (11326): DEBUG build Armor V1.26
I/armor   (11326): GL_RENDERER: Adreno (TM) 405
I/armor   (11326): GL_VERSION: OpenGL ES 3.1 V@140.0 (GIT@I7d704ff208)
I/armor   (11326): GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 3.10
I/armor   (11326): Chipmunk2D is using single precision.
I/renderdoc(11326): RDOC 011326: [03:24:27]  gl_buffer_funcs.cpp(  96) - Log     - glGenBuffers [0] == ResourceId::48
I/armor   (11326): Does not support debug output.
I/armor   (11326): Compiled vertex shader Hud
I/armor   (11326): Compiled fragment shader Hud
I/armor   (11326): Loaded program Hud as handle 1
I/armor   (11326): Compiled vertex shader Font
I/armor   (11326): Compiled fragment shader Font
I/armor   (11326): Loaded program Font as handle 4
I/armor   (11326): Compiled vertex shader Wall
I/armor   (11326): Compiled fragment shader Wall
I/armor   (11326): Loaded program Wall as handle 7
I/armor   (11326): Compiled vertex shader Prts
I/armor   (11326): Compiled fragment shader Prts
I/armor   (11326): Loaded program Prts as handle 10
I/armor   (11326): Compiled vertex shader Clds
I/armor   (11326): Compiled fragment shader Clds
I/armor   (11326): Loaded program Clds as handle 13
I/armor   (11326): ctrl_create( 1920, 1200 )
I/armor   (11326): Setting up view for 1920x1200 @1.000000x
V/GamesNativeSDK(11326): Play Games callback indicates connection failure.
I/ActivityManager( 1200): Displayed com.steenriver.armor/.ArmorActivity: +6s172ms
E/GoogleApiAvailability(11326): Google Play services is invalid. Cannot recover.
I/armor   (11326): Loaded 5 textures for tanks.
W/JankManagerService(  399): START_APP: JL_APP_LAUNCHING_END and JL_APP_LAUNCHING_BEGIN too long| span:6172
I/GamesNativeSDK(11326): Error connecting to Google Play: code 9.
I/armor   (11326): Sign in finished with a result ERROR_NOT_AUTHORIZED
I/armor   (11326): OnAuthActionFinished
I/armor   (11326): You are not logged in!
V/threaded_app(11188): SaveInstanceState: 0x5598d3d750
I/renderdoccmd(11188): handle_cmd(12)
V/threaded_app(11188): APP_CMD_SAVE_STATE
V/threaded_app(11188): Stop: 0x5598d3d750
V/threaded_app(11188): activityState=14
I/renderdoccmd(11188): handle_cmd(14)
I/armor   (11326): Loaded 13 textures for tanks.
I/armor   (11326): Loaded 3 textures for bullets.
I/armor   (11326): Loaded 7 textures for powerups.
I/armor   (11326): Loaded 2 textures for explosions.
I/armor   (11326): Loaded 3 textures for smokepods.
I/armor   (11326): Loaded 1 textures for annotations.
I/armor   (11326): Loaded 6 non-mipmap textures for hud.
I/armor   (11326): Total size in VBOs is 12864 bytes in 6 VBOs.
I/OpenAL_SLES(11326): OpenSLES could not be loaded.
I/OpenAL_SLES(11326): opensles_open_playback pDevice=0x5599b877d0, deviceName=Android Default
I/OpenAL_SLES(11326): OpenSLES could not be loaded.
I/armor   (11326): Using OpenAL device 'Android Default'
I/armor   (11326): Using ALUT 1.1
I/armor   (11326): AL_VENDOR OpenAL Community
I/armor   (11326): AL_RENDERER OpenAL Soft
I/armor   (11326): AL_VERSION 1.1 ALSOFT 1.12.854
I/OpenAL  (11326): _SC_NPROCESSORS_ONLN=8
I/armor   (11326): CMD_INIT_WINDOW handled
W/InputEventReceiver(11326): Attempted to finish an input event but the input event receiver has already been disposed.
W/InputEventReceiver(11326): Attempted to finish an input event but the input event receiver has already been disposed.
V/threaded_app(11326): WindowFocusChanged: 0x5598afde80 -- 1
V/ArmorActivity(11326): onWindowFocusChanged
I/armor   (11326): CMD_GAINED_FOCUS handled
I/renderdoc(11326): RDOC 011326: [03:24:32]   resource_manager.h( 866) - Debug   - Preparing up to 7 potentially dirty resources
I/renderdoc(11326): RDOC 011326: [03:24:32]   resource_manager.h( 897) - Debug   - Prepared 7 dirty resources
I/renderdoc(11326): RDOC 011326: [03:24:32]   resource_manager.h( 913) - Debug   - Force-prepared 0 dirty resources
I/renderdoc(11326): RDOC 011326: [03:24:32]        gl_driver.cpp(2410) - Debug   - GL Context 3 Attempting capture
I/renderdoc(11326): RDOC 011326: [03:24:32]        gl_driver.cpp(1876) - Log     - Starting capture, frame 200
I/renderdoc(11326): RDOC 011326: [03:24:32]    gl_draw_funcs.cpp( 806) - Log     - Copying client-memory arrays, previous binding was 0
I/renderdoc(11326): RDOC 011326: [03:24:32]    gl_draw_funcs.cpp( 929) - Log     - Restoring client-memory arrays, previous binding was 0
I/renderdoc(11326): RDOC 011326: [03:24:32]    gl_draw_funcs.cpp( 806) - Log     - Copying client-memory arrays, previous binding was 162
I/renderdoc(11326): RDOC 011326: [03:24:32]    gl_draw_funcs.cpp( 929) - Log     - Restoring client-memory arrays, previous binding was 162
F/libc    (11326): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 11424 (Thread-10946)
baldurk commented 5 years ago

From the pattern of those log statements I think those are internally-allocated buffers and not application-allocated buffers. The buffer that's missing was named 162 and most drivers allocate starting from name 1 - there aren't 162 glGenBuffers calls there so that also points to missed calls.

I've pushed a new commit to that same logging branch to be absolutely sure, it prints a log statement before and after the internal allocations and adds a print in the glGenBuffers line of which GL name was created, which I should have added last time.

stolk commented 5 years ago

Thanks. Will try.

Note: the draw call that crashes on capture, actually creates the buffer right before drawing,

So every frame: glGenVertexArrays() glGenBuffers() glDrawArrays() <- crash here. glDeleteArrays() glDeleteBuffers()

It's not a buffer that is created at launch time, and then drawn later during capture time. It's all part of the same captured frame.

If I create and destroy buffers so quickly, I'm pretty sure Android's logging can't record them all. There must be a rate limit on the logs, otherwise they would fill up too quickly.

On Mon, Feb 4, 2019 at 11:41 AM Baldur Karlsson notifications@github.com wrote:

From the pattern of those log statements I think those are internally-allocated buffers and not application-allocated buffers. The buffer that's missing was named 162 and most drivers allocate starting from name 1 - there aren't 162 glGenBuffers calls there so that also points to missed calls.

I've pushed a new commit to that same logging branch to be absolutely sure, it prints a log statement before and after the internal allocations and adds a print in the glGenBuffers line of which GL name was created, which I should have added last time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/baldurk/renderdoc/issues/1254#issuecomment-460384125, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbycPbx8dQZsnn8MGulzHIzI7Fst18wks5vKIzqgaJpZM4agVSk .

-- Owner/Director of Game Studio Abraham Stolk Inc. Vancouver BC, Canada b.stolk@gmail.com

baldurk commented 5 years ago

Android's logging is pretty buggy (as with most things on Android) but there's not any deliberate rate limiting that I'm aware of apart from dropping duplicate messages which wouldn't apply in this case. It's recorded into a ring buffer so the faster the logs happen the faster the ring is looped around and older messages disappear.

Since logging is the only way to reliably debug on Android I've had 10000s of log prints per frame going in cases and they do come through, so if you're creating buffers mid-frame and a log print is not appearing that also indicates that the hook of glGenBuffers didn't succeed.

stolk commented 5 years ago

Ok, you're right. The only glGenBuffers that are seen are before the End allocating internal client memory buffers message.

I think I'll just have to give up on this. Probably just a crappy device or something. (gapid wouldn't work on my device either.)

My other devices are too old, but in the future, when I get a new device, I'll try again.

Thanks for all the help.

baldurk commented 5 years ago

Fair enough. RenderDoc uses the same hooking core as gapid so it'd make sense that they both don't work - I have a fallback path (PLT hooking mentioned in the logs) but it's fairly unreliable.

If you really wanted to get RenderDoc working it should be possible to modify your application at compile time to actively seek out RenderDoc and hook itself, since it's the interception that's the problem. But it's up to you if you want to go down that route.

stolk commented 5 years ago

This is a Huawei quirk, not worth fixing. Closing.

baldurk commented 5 years ago

Yeh I don't believe it's worth fixing in general, but I think you can e.g. link against the RenderDoc library directly instead of libGLES/libEGL and then you call directly into my hooked functions, this should work to get the function calls intercepted without needing to hook or patch anything.