Add Android support and fix GLES renderer/audio compatibility#40
Closed
Simon358 wants to merge 2 commits into
Closed
Add Android support and fix GLES renderer/audio compatibility#40Simon358 wants to merge 2 commits into
Simon358 wants to merge 2 commits into
Conversation
Signed-off-by: Simon Butt <simon@snapscan.co.za>
Contributor
|
hmm with graphics changes i am mostly worried about the render changes since we optimized it recently, having the bottleneck back would be terrible D: |
Collaborator
|
Closing as duplicate in favor of #41 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces several critical fixes to enable the Android port to build, launch, and run with stable graphics and audio.
•
Gradle Downgrade: Updated gradle-wrapper.properties to use Gradle 8.7. This resolves a "configuration mutation" error caused by an incompatibility between Gradle 9.x and Android Gradle Plugin 8.2.2.
•
Missing Assets: Updated app/build.gradle to include external SDL resource directories in the sourceSets, fixing a resource linking error (ic_launcher not found).
•
Library Bundling: Modified CMakeLists.txt to build SDL3 as a shared library (SDL_SHARED ON), ensuring libSDL3.so is correctly bundled into the APK for runtime linking.
•
Mobile-Native Context: Updated NativeRenderer_InitialiseGLContext to request an OpenGL ES 3.0 context on Android instead of the desktop-only OpenGL 3.3 Core profile.
•
GLES-Compatible Function Loading: Switched NativeRenderer_InitialiseGLExt to use SDL_GL_GetProcAddress on Android, allowing SDL to handle cross-platform function resolution for mobile drivers.
•
Desktop-to-Mobile Readback Fix: Replaced desktop-only glGetTexImage calls with a glReadPixels implementation using framebuffers. This was necessary as glGetTexImage is not available in the OpenGL ES specification.
•
Format & Precision:
◦
Changed internal VRAM format to GL_RG8 on Android to match 8-bit component expectations of mobile GPUs.
◦
Increased shader integer precision to mediump to prevent indexing artifacts on mobile hardware.
•
Feature Gating: Wrapped glPolygonMode (desktop-only) in an #ifndef ANDROID block to prevent crashes.
•
Driver Selection: Updated NativeAudio_SelectDriverHint to skip Linux-specific sound system hints (alsa, pulseaudio) when running on Android, allowing SDL to correctly initialize the mobile audio driver.
•
Logcat Integration: Replaced standard printf/fprintf calls in the audio subsystem with Platform_Log to ensure audio initialization and error messages are visible in Android's Logcat.