Skip to content
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

HwRender GLFW implementation does not work on Android #19

Open
XenuIsWatching opened this issue Sep 27, 2023 · 4 comments
Open

HwRender GLFW implementation does not work on Android #19

XenuIsWatching opened this issue Sep 27, 2023 · 4 comments

Comments

@XenuIsWatching
Copy link
Contributor

GLFW does not have an Android implementation. This makes it so some cores, such as Dolphin, can not run with HW acceleration.

I'm not quite sure how implementation would begin with getting a HW acceleration with OpenGL ES3 with Android NDK would begin

@Skurdt
Copy link
Owner

Skurdt commented Sep 27, 2023

I'm using glfw to create an invisible window (and it's gl context), render the output there and do a dumb and slow glCopyPixels call onto an array. This then go to the same unity texture creation path used for non HW accelerated cores.
This is done like that only because, on windows, the unity runtime is set (for me) to run on directx. You can very much call that a hack :p

On android, since unity runs on opengl (or variants...) a native plugin may work way better there. (ie. use the existing context and bypass the pixel copy stuff)

Implementing directx, for cores using it, would also probably require a native plugin on windows too.

@Phantomxm2021
Copy link

Any update for this problem?

@Skurdt
Copy link
Owner

Skurdt commented Jan 27, 2024

I'm using a very very tiny set of GLFW functions. This is basically to spawn a window and get a dumb opengl framebuffer.
Maybe it can be replaced by SDL, which I believe does have a android runtime.

Still, it would be the dumbest way to implement the feature on android, since it only runs on gl and a native plugin would have direct access to the Texture2D, avoiding copying pixels altogether.

@Skurdt
Copy link
Owner

Skurdt commented May 25, 2024

I swapped to use sdl3 for the opengl window.
Obviously the result is exactly the same but it should allow getting it work on platforms where glfw is not supported.

I spent a week trying to get a android version working but unfortunately, the hardware path still doesn't work there.
Trying to build a libSDL3.so library was a literal nightmare to figure out, and I'm not even sure it can load as a .so file properly.
The current issue seems related to android activity (specifically something about org.libsdl.app.SDLActivity), which I tried researching but I still have no clue what it is exactly and how, or if, the library can be initialized from unity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants