Skip to content

[Android.GL] DrawRangeElementsBaseVertex() fails with 'called unimplemented OpenGL ES API' #2181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bosoni opened this issue Jan 11, 2025 · 9 comments · Fixed by #2187 or #2191
Closed
Labels
bug Something isn't working

Comments

@bosoni
Copy link

bosoni commented Jan 11, 2025

Sorry, I dont know how to copy development branchs android library where test uses.

But I just downloaded newest .exe and installed it, and created new project with newest nugets and works with desktop,
but not on android.

I included a little test, 2 images, both moving. Desktop shows them, android not.

If using only 1 image (test has other commented out) it shows just black box.

And when using 2 images, it renders only one black box, there isnt that other black box.

[tested that again using that .zip file below, and edited ^ texts because there were some errors]

KNI_Test_2.zip

What operating system are you using:

  • Windows11

What KNI platform are you using:

Android

@bosoni
Copy link
Author

bosoni commented Jan 11, 2025

More information (which I forgot):

Last year 6.11.2024 I tried KNI (desktop and web worked then and now) but on Android it shows texture when using only 1 image.

When using 2 images, 2 black boxes.

And when I tested

        spriteBatch.Begin();
        spriteBatch.Draw(texture2, new Vector2(300 - x, 10), Color.White);
        spriteBatch.End();

        spriteBatch.Begin();
        spriteBatch.Draw(texture, new Vector2(x, 100), Color.White);
        spriteBatch.End();

both textures works. But that is so wrong (very unoptimized way to do).

Maybe (hopefully) this helps to find this Android spritebatch draw problem.

@nkast
Copy link

nkast commented Jan 12, 2025

I've tested it on my phone it's working fine.

So, in one case it shows the textures black, and in the other case it shows the first texture of the batch but not the second?
Can you tell me what versions did you use for each case?
Last version 3.14 was on Sep 23, 2024. I can't tell what 6.11.2024 is.
If it's Nov 16 2024, then you probably got v3.14 as well. Or was it 3.12 on Jun 11?

Have you tried on other phones?,
and can you give me the specs of your GPU?
If you use 'System Info Droid' and and select 'Email Report' from the menu, it will generate an email. Copy the text here. I am mostly interested in the GPU specs to compare with mine.

@bosoni
Copy link
Author

bosoni commented Jan 12, 2025

"I can't tell what 6.11.2024 is.
If it's Nov 16 2024, then you probably got v3.14 as well. Or was it 3.12 on Jun 11?"

Yeah I meant sixth of the november. Cant remember which version of KNI.

But today I tested with different devices (using newest kni nugets like yesterday). Android emulator which starts under VS2022 shows only one black box. Bluestacks shows 2 black boxes.

And then I tested 2 phones:

Phones (both uses Android 10)
Moto e(6i)
Xiaomi Redmi 9A

IMG_20250112_125808
Screenshot (1086)
Screenshot (1087)
IMG_20250112_125714_737

@bosoni
Copy link
Author

bosoni commented Jan 12, 2025

1 visible black box is only on that emulator which starts under VS2022 (I just tested and changed coordinates and it only renders 1 black box, other was not out of screen). But all other shows 2 black boxes so there is some little thing wrong.

Under VS2022 debug output shows something maybe important?

"[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=10.0.2.2:61169,embedding=1,timeout=1736682960
Loaded assembly: System.Private.CoreLib.dll [External]
[monodroid-gc] GREF GC Threshold: 46080
Loaded assembly: Game1.dll
Loaded assembly: Mono.Android.dll [External]
Loaded assembly: System.Runtime.dll [External]
Loaded assembly: Java.Interop.dll [External]
Loaded assembly: System.Runtime.InteropServices.dll [External]
Loaded assembly: System.Collections.dll [External]
Loaded assembly: Mono.Android.Runtime.dll [External]
Loaded assembly: System.Threading.dll [External]
Loaded assembly: System.Threading.Thread.dll [External]
Loaded assembly: System.Diagnostics.StackTrace.dll [External]
[Game1.Game1] Attempt to remove non-JNI local reference
[libEGL] loaded /vendor/lib64/egl/libEGL_emulation.so
[libEGL] loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
[libEGL] loaded /vendor/lib64/egl/libGLESv2_emulation.so
Loaded assembly: MonoGame.Framework.dll [External]
Loaded assembly: System.Memory.dll [External]
Loaded assembly: System.Reflection.Emit.Lightweight.dll [External]
Loaded assembly: System.Reflection.Emit.ILGeneration.dll [External]
Loaded assembly: System.Reflection.Primitives.dll [External]
Loaded assembly: Xna.Framework.Game.dll [External]
Loaded assembly: Xna.Framework.Graphics.dll [External]
Loaded assembly: System.ComponentModel.dll [External]
Loaded assembly: Xna.Framework.Input.dll [External]
Loaded assembly: Xna.Framework.Media.dll [External]
Loaded assembly: Xna.Framework.dll [External]
Loaded assembly: System.Linq.dll [External]
Loaded assembly: System.Console.dll [External]
Loaded assembly: Xna.Framework.Content.dll [External]
[monodroid-assembly] Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
[DOTNET] GameFactory not found.
[DOTNET] Initialize input with 'GameFactory.RegisterGameFactory(new ConcreteGameFactory());'.
[DOTNET] Registering ConcreteGameFactoryStrategy through reflection.
[DOTNET] InputFactory not found.
[DOTNET] Initialize input with 'InputFactory.RegisterInputFactory(new ConcreteInputFactory());'.
[DOTNET] Registering ConcreteInputFactoryStrategy through reflection.
Loaded assembly: System.Xml.ReaderWriter.dll [External]
Loaded assembly: System.Private.Xml.dll [External]
Loaded assembly: Xna.Framework.Audio.dll [External]
[CompatibilityChangeReporter] Compat change id reported: 237531167; UID 10190; state: DISABLED
[OpenGLRenderer] Unknown dataspace 0
[OpenGLRenderer] Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
[OpenGLRenderer] Failed to initialize 101010-2 format, error = EGL_SUCCESS
[Gralloc4] mapper 4.x is not supported
[OpenGLRenderer] Unable to match the desired swap behavior.
[DOTNET] GraphicsFactory not found.
[DOTNET] Initialize graphics with 'GraphicsFactory.RegisterGraphicsFactory(new ConcreteGraphicsFactory());'.
[DOTNET] Registering Concrete GraphicsFactoryStrategy through reflection.
[monodroid-assembly] Shared library 'dl' not loaded, p/invoke 'dlopen' may fail
[DOTNET] FuncLoader.LoadLibrary libGLESv1_CM.so
[DOTNET] FuncLoader.LoadLibrary libGLESv2.so
[DOTNET] FuncLoader.LoadLibrary libGLESv3.so
[DOTNET] FuncLoader.LoadLibrary libGL.so Not Found!
[GL] Loading Entry Points
[monodroid-assembly] Shared library 'dl' not loaded, p/invoke 'dlsym' may fail
[GL] Bound ES
[AndroidGameView] Device Supports
[AndroidGameView] Red:8 Green:8 Blue:8 Alpha:0 Depth:24 Stencil:8 SampleBuffers:0 Samples:0
[AndroidGameView] Red:8 Green:8 Blue:8 Alpha:8 Depth:24 Stencil:8 SampleBuffers:0 Samples:0
[AndroidGameView] Red:8 Green:8 Blue:8 Alpha:8 Depth:24 Stencil:8 SampleBuffers:0 Samples:0
[AndroidGameView] Checking Config : Red:8 Green:8 Blue:8 Alpha:8 Depth:24 Stencil:0 SampleBuffers:0 Samples:0
[AndroidGameView] EglChooseConfig returned True and 1
[AndroidGameView] Selected Config : Red:8 Green:8 Blue:8 Alpha:8 Depth:24 Stencil:0 SampleBuffers:0 Samples:0
[AndroidGameView] Creating GLES 3.2 Context
[EGL_emulation] eglCreateContext: EGL_BAD_CONFIG: no ES 3.2 support
[EGL_emulation] tid 5323: eglCreateContext(1834): error 0x3005 (EGL_BAD_CONFIG)
[AndroidGameView] GLES 3.2 Not Supported. Bad Config
[AndroidGameView] Creating GLES 3.1 Context
[EGL_emulation] eglCreateContext: EGL_BAD_CONFIG: no ES 3.1 support
[EGL_emulation] tid 5323: eglCreateContext(1828): error 0x3005 (EGL_BAD_CONFIG)
[AndroidGameView] GLES 3.1 Not Supported. Bad Config
[AndroidGameView] Creating GLES 3.0 Context
[AndroidGameView] Created GLES 3.0 Context
[Kni] GameWindow.ChangeClientBounds: newClientBounds=1080,2201
[libEGL] validate_display:549 error 3008 (EGL_BAD_DISPLAY)
Loaded assembly: System.Text.RegularExpressions.dll [External]
[DOTNET] TitleContainerFactory not found.
[DOTNET] Initialize title with 'TitleContainerFactory.RegisterTitleContainerFactory(new ConcreteTitleContainerFactory());'.
[DOTNET] Registering Concrete TitleContainerFactoryStrategy through reflection.
Loaded assembly: System.Private.Uri.dll [External]
Loaded assembly: System.Text.Encoding.Extensions.dll [External]
Loaded assembly: System.Collections.Concurrent.dll [External]
[emuglGLESv2_enc] device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glTexParameteri:2607 GL error 0x500 condition [!GLESv2Validation::textureParamValue(ctx, pname, param, (GLfloat)param, (GLenum)param)]
[emuglGLESv2_enc] device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glTexParameteri:2607 GL error 0x500 condition [!GLESv2Validation::textureParamValue(ctx, pname, param, (GLfloat)param, (GLenum)param)]
[libEGL] called unimplemented OpenGL ES API
[Choreographer] Skipped 64 frames! The application may be doing too much work on its main thread.
[OpenGLRenderer] Unable to match the desired swap behavior.
[Kni] GameWindow.ChangeClientBounds: newClientBounds=2264,1017
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.10ms min=0.90ms max=46.35ms count=56
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.51ms min=1.16ms max=7.27ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.36ms min=4.63ms max=7.39ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.23ms min=5.14ms max=8.67ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.17ms min=4.44ms max=8.26ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.13ms min=3.22ms max=8.31ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.22ms min=1.52ms max=7.68ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.83ms min=1.35ms max=7.23ms count=53
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.69ms min=1.29ms max=7.05ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.76ms min=1.65ms max=10.02ms count=59
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.24ms min=1.16ms max=8.08ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.96ms min=1.16ms max=8.85ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.16ms min=1.11ms max=8.82ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.15ms min=1.35ms max=8.69ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.18ms min=4.61ms max=8.14ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.12ms min=4.44ms max=7.08ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.12ms min=4.43ms max=8.40ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.07ms min=4.38ms max=8.10ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=6.04ms min=4.52ms max=7.28ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.95ms min=2.90ms max=7.38ms count=60
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.89ms min=2.93ms max=8.05ms count=61
[libEGL] called unimplemented OpenGL ES API
[EGL_emulation] app_time_stats: avg=5.99ms min=4.39ms max=7.19ms count=60
[libEGL] called unimplemented OpenGL ES API

and that called unimplemented goes and goes on.

@bosoni
Copy link
Author

bosoni commented Jan 12, 2025

This uses GLES3? On godot 3.6, if I use gles3 and even checked in options fallback to gles2, it does not work because of lowprice phones' graphic drivers. GLES3 works right if using godot 4.x (maybe fallback works then). But That does not solve the issue, that little test does not work even with emulators.

@bosoni
Copy link
Author

bosoni commented Jan 12, 2025

I just tested Samsung Galaxy A05s (Android 14) and test works right with both images.

@nkast
Copy link

nkast commented Jan 12, 2025

Maybe that unimplemented message is a good clue.
From what I see, the emulator doesn't work either. I can test it on the emulator on both my desktop and laptop.
Hopefully I could replicate it on at least one of them and make some tests.

@nkast
Copy link

nkast commented Jan 12, 2025

It uses gles3 and fallback to gles2.

@nkast
Copy link

nkast commented Jan 13, 2025

@bosoni, I had the same issue with the emulator.
the 'unimplemented OpenGL ES API' come from a call to DrawRangeElementsBaseVertex(...)
Apparently, it returns a function pointer for it instead of null, even though the GLES context is 3.1.

Thanks for reporting, that was a serious bug.

@nkast nkast added the bug Something isn't working label Jan 13, 2025
@nkast nkast changed the title Android problem [Android.GL] DrawRangeElementsBaseVertex() fails with 'called unimplemented OpenGL ES API' Jan 14, 2025
nkast added a commit that referenced this issue Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants