From 7be78f85131f22fef74a42c307ac48ef21431160 Mon Sep 17 00:00:00 2001
From: Alberto Torres <kungfoobar@gmail.com>
Date: Tue, 21 Jan 2025 13:08:11 +0100
Subject: [PATCH] Ensure only one of BC/ASTC is considered native, prefer ASTC
 on android.

---
 src/gpu_formats/texture_optimize.nim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gpu_formats/texture_optimize.nim b/src/gpu_formats/texture_optimize.nim
index dc4856a..a59b4dd 100644
--- a/src/gpu_formats/texture_optimize.nim
+++ b/src/gpu_formats/texture_optimize.nim
@@ -295,7 +295,7 @@ proc loadOptimized*(tex: Texture, slices: seq[SliceMem[byte]],
         tex.format.component_type != UShort
     
     var native_bc, native_astc = false
-    if has_bptc_support:
+    if has_bptc_support and not defined(android):
         native_bc = true
         # TODO: BC6H or RGBM
         will_compress = will_compress and
@@ -365,7 +365,7 @@ proc loadOptimized*(tex: Texture, slices: seq[SliceMem[byte]],
                 let channels = tex.format.channel_count
 
             when defined(myouUseBC7Encoder) and not defined(myouForceAstc):
-                if has_bptc_support or will_encode_all:
+                if native_bc or will_encode_all:
                     let bc_format = if channels == 1:
                         4.int8 # BC4
                     else:
@@ -373,7 +373,7 @@ proc loadOptimized*(tex: Texture, slices: seq[SliceMem[byte]],
                     bcn_compress(tex, pixels, cb, bc_format, settings.quality_speed)
                     if not will_encode_all: return
             when defined(myouUseAstcEncoder):
-                if has_astc_support or will_encode_all:
+                if native_astc or will_encode_all:
                     let blk_size = if channels == 1:
                         settings.astc_block_1ch
                     elif channels == 2: