From 5cd53f201750c48e8e13e8ba2280d38edb2e6e89 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 17 Sep 2025 06:46:33 +1000 Subject: [PATCH] OpenGL: Simplify RGBA texture conversion --- .github/workflows/build_linux.yml | 10 +++++----- .github/workflows/build_ps1.yml | 2 +- src/_GLShared.h | 30 ++++++++++-------------------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index e053d556f..e06137f79 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -129,11 +129,11 @@ jobs: SOURCE_FILE: 'cc-nix64-gl2' DEST_NAME: 'ClassiCube-Linux64-ModernGL' - - uses: ./.github/actions/upload_build - if: ${{ always() && steps.compile.outcome == 'success' }} - with: - SOURCE_FILE: 'cc-sdl64-gl2' - DEST_NAME: 'ClassiCube-Linux64-SDL2' +# - uses: ./.github/actions/upload_build +# if: ${{ always() && steps.compile.outcome == 'success' }} +# with: +# SOURCE_FILE: 'cc-sdl64-gl2' +# DEST_NAME: 'ClassiCube-Linux64-SDL2' - uses: ./.github/actions/notify_success diff --git a/.github/workflows/build_ps1.yml b/.github/workflows/build_ps1.yml index ae2306c96..9ab7c8e48 100644 --- a/.github/workflows/build_ps1.yml +++ b/.github/workflows/build_ps1.yml @@ -34,7 +34,7 @@ jobs: - uses: ./.github/actions/upload_build if: ${{ always() && steps.compile.outcome == 'success' }} with: - SOURCE_FILE: 'build/ps1/ClassiCube-PS1.elf' + SOURCE_FILE: 'build/ps1/ClassiCube-ps1.elf' DEST_NAME: 'ClassiCube-PS1.elf' - uses: ./.github/actions/upload_build diff --git a/src/_GLShared.h b/src/_GLShared.h index 8eec7ec8d..dd497511d 100644 --- a/src/_GLShared.h +++ b/src/_GLShared.h @@ -70,28 +70,18 @@ static void* FastAllocTempMem(int size) { static cc_bool convert_rgba; static void ConvertRGBA(void* dst, const void* src, int numPixels) { - cc_uint8* d = (cc_uint8*)dst; - cc_uint8* s = (cc_uint8*)src; + cc_uint8* d = (cc_uint8*)dst; + BitmapCol* s = (BitmapCol*)src; int i; - for (i = 0; i < numPixels; i++, d += 4, s += 4) { -#ifdef CC_BUILD_IRIX - d[0] = s[1]; - d[1] = s[2]; - d[2] = s[3]; - d[3] = s[0]; -#elif defined CC_BUILD_HPUX - /* HP-UX specific color channel mapping - try IRIX style G,B,A,R */ - d[0] = s[1]; /* R = G */ - d[1] = s[2]; /* G = B */ - d[2] = s[3]; /* B = A */ - d[3] = s[0]; /* A = R */ -#else - d[0] = s[2]; - d[1] = s[1]; - d[2] = s[0]; - d[3] = s[3]; -#endif + /* R,G,B,A byte order regardless of system endian */ + for (i = 0; i < numPixels; i++, d += 4, s++) + { + BitmapCol col = *s; + d[0] = BitmapCol_R(col); + d[1] = BitmapCol_G(col); + d[2] = BitmapCol_B(col); + d[3] = BitmapCol_A(col); } }