From d6d7f76e8477db1eff5552b22ad3103f9bf7e996 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Sat, 8 Feb 2025 22:26:47 +0800 Subject: [PATCH] fix(texture): BGRA hack to make Optfine shaders and Xaero maps both work. --- src/main/cpp/gl/texture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cpp/gl/texture.cpp b/src/main/cpp/gl/texture.cpp index e102a21..4afe182 100644 --- a/src/main/cpp/gl/texture.cpp +++ b/src/main/cpp/gl/texture.cpp @@ -295,7 +295,7 @@ void glTexImage2D(GLenum target, GLint level,GLint internalFormat,GLsizei width, } LOAD_GLES(glTexImage2D, void, GLenum target, GLint level,GLint internalFormat,GLsizei width, GLsizei height,GLint border, GLenum format, GLenum type,const GLvoid* pixels); gles_glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels); - if (tex.format == GL_BGRA && internalFormat == GL_RGBA8) { + if (tex.format == GL_BGRA && internalFormat == GL_RGBA8 && width <= 128 && height <= 128) { // xaero has 64x64 tiles...hack here LOG_D("Detected GL_BGRA format @ tex = %d, do swizzle", bound_texture); if (tex.swizzle_param[0] == 0) { // assert this as never called glTexParameteri(..., GL_TEXTURE_SWIZZLE_R, ...) tex.swizzle_param[0] = GL_RED;