mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 13:59:56 -04:00
Check that ASTC re-encoded to BC3 keeps the cut-outs of alpha-tested foliage at every footprint.
--probe-astc now runs cut-out mip chains through the BC3 encoder at all 14 footprints, linear and sRGB, plus two chains large enough to take several scratch chunks: transparent and opaque patches of void-extent blocks, whose edges cut through BC3's 4x4 blocks where the footprint's side is 5, 6 or 10, mixed with ASTC blocks whose alpha jumps from transparent to opaque between neighbouring texels, down to 1x1. Alpha 0 and 255 must come out exact and every alpha test at 1/4, 1/2 and 3/4 must keep its side outside the block's alpha step. The encoder passes on an RTX 5090, before and after this change (418540 BC3 blocks across a transparent-to-opaque edge); an encoder that lets an opaque 255 drop to 254 in an edge block passes the old bounds and fails the new check. The encoder reads texel bytes as integers instead of through unpackUnorm4x8, so its alpha endpoints are the block's exact least and greatest alpha on any GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,11 @@
|
||||
// then each texel takes the nearest of the four palette entries along that axis. Alpha: the eight-value BC3 alpha
|
||||
// block between the block's smallest and largest alpha. The bytes are what the texels hold, so an sRGB image keeps
|
||||
// sRGB-encoded values, as BC3_SRGB expects.
|
||||
//
|
||||
// The texel bytes are read as integers, so the alpha endpoints are exactly the block's least and greatest alpha: a
|
||||
// texel that is fully transparent or fully opaque keeps 0 or 255, wherever the source's own block edges fall inside
|
||||
// the 4x4 block, and an alpha test keeps the outline of cut-out foliage. Through unpackUnorm4x8 an opaque 255 could
|
||||
// come back as 254.99 on a GPU whose division is not exact and be cut to 254 by the conversion to uint.
|
||||
// Compiled to runtime/bc3_encode_spv.h by tools/build_shaders.py; vk_astc.c records the dispatch.
|
||||
#version 450
|
||||
|
||||
@@ -25,7 +30,8 @@ layout(push_constant) uniform Params {
|
||||
|
||||
vec4 texel(uint x, uint y, uint z) {
|
||||
x = min(x, pc.width - 1u), y = min(y, pc.height - 1u);
|
||||
return unpackUnorm4x8(px[pc.in_base + (z * pc.height + y) * pc.width + x]) * 255.0;
|
||||
uint v = px[pc.in_base + (z * pc.height + y) * pc.width + x];
|
||||
return vec4(uvec4(v, v >> 8, v >> 16, v >> 24) & 0xFFu);
|
||||
}
|
||||
|
||||
uint to565(vec3 c) {
|
||||
|
||||
Reference in New Issue
Block a user