Android fixes#150
Conversation
|
Inspired by @klaymen1n |
| #elif defined (__SYMBIAN32__) | ||
| # define KHRONOS_APICALL IMPORT_C | ||
| #elif defined(__ANDROID__) | ||
| #elif defined(__ANDROID__) || defined(ANDROID) |
There was a problem hiding this comment.
I think only using __ANDROID__ is enough.
__ANDROID_ is an intrinsic defined by the compiler. ANDROID is added by the Android build CMake toolchain.
| uint64 alphas = 0; | ||
| memcpy(&alphas, src+j+2, sizeof(alphas)); |
There was a problem hiding this comment.
This needs extra documentation.
Or at least it's not SDL2/3-related.
aap should comment on this.
There was a problem hiding this comment.
Oh, I see. Is this alignment-related?
If so, you can unconditionally do the memcpy. The undefined sanitizer will also complain about this.
There was a problem hiding this comment.
We can replace this with a for loop and let the compiler do the rest ?
There was a problem hiding this comment.
Nah, the compiler should do that with -O2.
| natras->backingStore->levels[level].size); | ||
| } | ||
| }else{ | ||
| } else if(level == 0) { |
There was a problem hiding this comment.
This fixes a bug that causes some textures to appear black. Maybe related to #128
|
Only a few minor adjustments are needed. |
|
I've tried to simulate computer resolution on devices without resolution support, and it's incredibly difficult. I can't get past the first cutscene. |
|
Although there are no bugs: In ARM, some types tend to behave differently; some bitwise types may be broken, and that may be what causes some breakages in the format conversion. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves texture handling and device initialization across GL3/GLES backends while adding OpenGL capability logging.
Changes:
- Fix undefined behavior in DXT decompression and correct DXT block flipping pointer usage.
- Add OpenGL info logging and adjust SDL2/SDL3 video mode/window creation logic.
- Update raster upload/mipmap generation behavior and tighten video-mode index validation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/image.cpp | Avoid unaligned/aliasing reads in DXT5 alpha decode; fix pointer usage in DXT1 flipping loop. |
| src/gl/gl3raster.cpp | Changes texture upload path and mipmap generation behavior during raster unlock. |
| src/gl/gl3device.cpp | Adds GL info logging, GLES-specific beginUpdate state changes, and SDL/GLFW mode handling updates. |
| src/CMakeLists.txt | Avoids redundant SDL3 find_package when SDL3 target already exists. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else if(level == 0) { | ||
| glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | ||
| glTexImage2D(GL_TEXTURE_2D, level, natras->internalFormat, | ||
| raster->width, raster->height, | ||
| 0, natras->format, natras->type, raster->pixels); | ||
| } | ||
| if(level == 0 && natras->autogenMipmap) | ||
| // if(level == 0 && natras->autogenMipmap) | ||
| glGenerateMipmap(GL_TEXTURE_2D); | ||
| bindTexture(prev); |
| #if defined(LIBRW_SDL2) || defined(LIBRW_SDL3) | ||
| const char *version = (const char *)glGetString(GL_VERSION); | ||
| const char *vendor = (const char *)glGetString(GL_VENDOR); | ||
| const char *renderer = (const char *)glGetString(GL_RENDERER); | ||
| const char *extensions = (const char *)glGetString(GL_EXTENSIONS); | ||
| const char *shadingLang = (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION); |
| #if defined(LIBRW_GL_LOG_INFO) | ||
| const char *basePath = SDL_GetBasePath(); | ||
|
|
||
| if(basePath) { | ||
| char logPath[512]; | ||
| snprintf(logPath, sizeof(logPath), "%sGL_info.txt", basePath); | ||
| FILE *log = fopen(logPath, "w"); |
| if(gl3Caps.gles) { | ||
| // glDisable(GL_DEPTH_TEST); | ||
| glDepthMask(GL_FALSE); | ||
| glDisable(GL_STENCIL_TEST); |
| case DEVICEGETVIDEOMODEINFO: | ||
| if (n <= 0) | ||
| return 0; | ||
| rwmode = (VideoMode*)arg; | ||
| rwmode->width = glGlobals.modes[n].mode.w; | ||
| rwmode->height = glGlobals.modes[n].mode.h; |
|
|
||
| case DEVICESETVIDEOMODE: | ||
| if(n >= glGlobals.numModes) | ||
| if (n <= 0 || n >= glGlobals.numModes) |


@madebr