Repository navigation
Conversation
Owner
|
The texture memory saving is real and welcome (827 to 695 MB peak), since low-memory kills are one of the main Mali problems. Three things before merging:
|
Add analytical BC3 -> ASTC 4x4 RGBA and BC5_UNORM -> ASTC 4x4 LA (CEM 4) transcoders for GPUs without hardware BC support (such as ARM Mali). - BC3 -> ASTC 4x4 keeps 16 B/block (4x smaller than RGBA8), preserves 4-colour RGB mode regardless of endpoint order, and preserves exact 0/255 alpha cutouts when a0 <= a1. - BC5_UNORM -> ASTC 4x4 LA keeps 16 B/block (2x smaller than RG8), uses exact Void-Extent for constant blocks and CEM 4 L/A encoding with exact 0/255 cutouts, and remaps sampled VkImageView swizzles (expanding IDENTITY per slot before mapping R,G,B,A -> R,A,ZERO,ONE). - Excludes render targets (t->flags & 8) and 3D volumes (t->target == 2), tracks per-image bc_astc_mode across CopyTextureToTexture / snapshots / CopyBufferToTexture / non-shadow RT guards, and leaves Adreno / Turnip (BC=1) untouched with zero overhead. - Adds LARECOMP_BC_ASTC_EXT, LARECOMP_BC3_ASTC, and LARECOMP_BC5_ASTC toggles.
Propinbo
force-pushed
the
feat/mali-bc-astc
branch
from
November 27, 2026 14:57
d63e3a0 to
9a4e8a6
Compare
Contributor
Author
|
Thanks for the thorough review! Rebased onto
|
Propinbo
added a commit
to Propinbo/BOTWRecompAndroid
that referenced
this pull request
Nov 27, 2026
…cjr#586 updates, PR mamcjr#582 close, SM-X730 restore [skip ci]
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.



Summary
On GPUs without hardware BCn support (such as ARM Mali),
textures.cpreviously transcoded onlyBC1toASTC 4x4and decodedBC3toRGBA8(4xlarger) andBC5_UNORMtoR8G8_UNORM(2xlarger).This PR extends the BC-less CPU transcode path in
runtime/nvn/bc1_astc.candtextures.cto transcode sampled non-RTBC3andBC5_UNORMtextures intoASTC 4x4blocks (16 B/block), with zero changes todevice.cor Adreno/Turnip (textureCompressionBC = 1) paths:BC3->ASTC 4x4 RGBA(VK_FORMAT_ASTC_4x4_UNORM_BLOCK/_SRGB_BLOCK,1xsize vs4xRGBA8):c0 <= c1, constant-alpha single-partition (0x53), constant-RGB, dual-plane RGB+alpha (0x442), and exact0/255alpha cutouts whena0 <= a1.BC5_UNORM->ASTC 4x4 LA(CEM 4,VK_FORMAT_ASTC_4x4_UNORM_BLOCK,1xsize vs2xRG8_UNORM):0x452,delta <= 48), steep dual-plane (0x443) preserving exact0/255cutouts, and view-levelVkComponentMappingexpansion (IDENTITYexpanded per slot before(R, G, B, A) -> (R, A, ZERO, ONE)inruntime/nvn/vulkan/bc_astc_policy.h).textures.c,exec.c):t->flags & 8), 3D volumes (t->target == 2), 1D / 1D-array textures (t->target == 0 || t->target == 3), MSAA textures (t->samples > 1), orBC5_SNORM.bc_vf,bc_astc_mode, andastc_*oncreate_image()R8G8B8A8_UNORMfallback.vm == bc_astc_modeinview_format(), propagatesbc_astc_modeinsnapshot_image(), skips non-shadow attachment binds before creating unused cachedVkImageViewentries or markinggpu_ownedinbegin_pass(), and skipscopy_buffer_to_texture/vkCmdBlitImageacross ASTC /LAimages.Zero-Cost Isolation & Env Rollback
BC=1) and desktop:textureCompressionBC != 0skipsbc_target_ex()/bc_astc_cfg()(bc_vf = 0,bc_astc_mode = 0, zero extravkGetPhysicalDeviceFormatPropertiescalls), anddevice.chas0lines modified.LARECOMP_BC_ASTC_EXT=0— disableBC3andBC5_UNORM->ASTC 4x4LARECOMP_BC3_ASTC=0|1,LARECOMP_BC5_ASTC=0|1— per-format overrides (LARECOMP_BC1_ASTC=0unchanged)Tested vs. Untested GPU Matrix
Mali-G925-Immortalis MC12(driver-id 9,v1.r49p1-03bet0)1.9.0,v0.5.1-beta(da30d45), PR commit9a4e8a6dBC=1)!format_supports(vf, need)(BC=1)!BC && ASTCGPUs!BC+ASTC_4x4format feature checks; rollback viaLARECOMP_BC_ASTC_EXT=0Verification (
SM-X730, Rebased ontov0.5.1-beta@9a4e8a6d)9a4e8a6d/SM-X730):tools/test_soft_linear.py: PASS (23 + 3 + 203).tools/test_vulkan_compat.py(16/16) &tools/test_vulkan_startup.py(33/33): PASS.tools/test_bc1_astc.c(200kblocks/class WSL &aarch64Bionic onSM-X730): PASS (0illegal blocks,0exact0/255cutout mismatches, bothK_ONECHANchannel orientations,test_odd_dims,test_policy_helpers).tools/test_android_runtime.ps1onSM-X730: 11/11 PASS,0mock sync hazards (includes 1T-vs-4T bit-exactbc3_to_astc&bc5_unorm_to_astc_laintest_bc_parallel,0x4Bshadow + LA swizzle intest_bc_shadow, and Case 10 intest_rt_load_uploadtestingfork()env-precedence,resolve_tex_format/bc_target_exexclusions,view_format, andexec.cASTC guards).1.9.0texture error audit (plateau+zora-plaza+kakariko-day):BC3:115textures (47peak),53.25 MBASTC vs212.89 MBRGBA8 ref,3,489,781blocks (const_a=69.2%,astc_err=0),55.84Mtexels — RGBmean=0.387, p95=2, p99=3, max=4; Alpha allmean=0.718, p95=3, p99=15, max=44(non-constmean=2.329, p95=11, p99=24, max=44).BC5_UNORM:252textures (99peak),25.28 MBASTC vs101.08 MBRGBA8 ref (2xsmaller thanRG8),1,657,053blocks (steep=12.8%,astc_err=0),26.51Mtexels — Rmean=0.568, p95=3, p99=5, max=27; Gmean=0.553, p95=3, p99=5, max=27; steepmean=1.737, p95=6, p99=12, max=27.BC1:BC1_SAMPLED=1111(416peak,415.78 MB -> 831.57 MBASTC vs3325.90 MBRGBA8),BC1_RT=0,BC1_3D=0,BC3_EXCL=0,BC5U_EXCL=0.ext0:BC1=on BC3/5u=offvsext1:BC1/3/5u=on) &9a4e8a6dRelease smoke (SM-X730):VmRSSpeak:4043.6 MB -> 3863.9 MB(-179.7 MB); VMA steady-stategpu memblocks settled at1184 MBvs1440 MB(1440 MBinitial 256 MB block high-water mark).30 FPSperf parity preserved:plateau(30.00 / 29.64 low1vs30.00 / 29.42),zora-plaza(30.00 / 29.43vs30.00 / 29.28; on final9a4e8a6dsmoke:30.00 FPS / 29.50 low1 / gpu p50 29.27 ms / rnd p50 16.76 ms / 1184 MB gpu mem / 3746.6 MB RSS),kakariko-day(29.96 / 25.69vs29.81 / 26.15).2560x1440match,bilinear,LARECOMP_SYNC_SHADERS=1):hateno-dye-interior: alignedframe_00724vsframe_0072038.49 dB(mean_abs=0.695), shelf/cloth ROI43.03 dB.zora-plaza: alignedframe_00764vsframe_0076532.97 dB(mean_abs=2.959), pillar/arch ROI34.71 dB.riverside-stable-night:25.40 dB(mean_abs=8.782).