mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 12:08:38 +00:00
Let a finalized texture slot follow only a live entry of its own texel format
slot_resolve sent a slot whose entry was released to any live entry at the same storage, whatever its format. The quick menu samples its 768x432 RGB10A2 scene capture through such a slot; after a fuse the Autobuild thumbnail of the fused object, RGBA8 at the same storage, was the live entry there, and the menu drew it behind the wheel for its opening frames: the fused object's silhouette, or garbled colours when the thumbnail image held the capture's raw bytes. Maxwell reads the storage through the slot descriptor's format, so a follower now needs the slot's texel format (sRGB aside); without one the released entry keeps the slot, and its image is the capture the game last wrote. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f65b4ee07
commit
1c5c6fdbe3
1 file changed
+18
-1
+18
-1
@@ -155,6 +155,17 @@ static void make_key(const tex_t *t, TexKey *k) {
|
||||
}
|
||||
|
||||
// Keys equal apart from the descriptor's swizzle selectors: the same storage, format and geometry.
|
||||
// The colour format without its sRGB decode: a target and its sRGB view share one texel layout (slot_resolve).
|
||||
static int linear_format(int f) {
|
||||
switch (f) {
|
||||
case NVN_FORMAT_RGBA8_SRGB: return NVN_FORMAT_RGBA8;
|
||||
case NVN_FORMAT_RGBX8_SRGB: return NVN_FORMAT_RGBX8;
|
||||
case NVN_FORMAT_BGRA8_SRGB: return NVN_FORMAT_BGRA8;
|
||||
case NVN_FORMAT_BGRX8_SRGB: return NVN_FORMAT_BGRX8;
|
||||
default: return f;
|
||||
}
|
||||
}
|
||||
|
||||
static int same_but_swizzle(const TexKey *a, const TexKey *b) {
|
||||
TexKey x = *a, y = *b;
|
||||
x.d.swizzle_r = x.d.swizzle_g = x.d.swizzle_b = x.d.swizzle_a = 0;
|
||||
@@ -1111,10 +1122,16 @@ static Tex *slot_resolve(TexSlot *s, view_t *view, int *has_view) {
|
||||
// Prefer the live entry that differs from the slot descriptor only in its swizzle: transient render targets
|
||||
// share storage, and the newest one at the address is usually another size. The map screen samples its
|
||||
// 2250x1080 map target through an (R,G,B,1) descriptor and followed a 960x60 target at the same address.
|
||||
// Only an entry of the slot's texel format follows (sRGB aside): Maxwell reads the storage through the slot
|
||||
// descriptor's format, and an entry of another format holds another texture's texels. The quick menu samples
|
||||
// its 768x432 RGB10A2 scene capture through a slot whose entry was released; after a fuse the Autobuild
|
||||
// thumbnail of the fused object, RGBA8 at the same storage, was the live entry, and the menu drew it behind
|
||||
// the wheel (the object's silhouette, or garbled colours). Without such an entry the released one keeps the
|
||||
// slot: its image holds what was last written through that descriptor.
|
||||
Tex *own = e, *any = NULL;
|
||||
e = NULL;
|
||||
for (Tex *p = nvn_hm_get(&by_addr, &k.addr); p; p = p->next_at) {
|
||||
if (p->released) continue;
|
||||
if (p->released || linear_format(p->key.d.format) != linear_format(k.d.format)) continue;
|
||||
if (!any) any = p;
|
||||
if (same_but_swizzle(&p->key, &k)) { e = p; break; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user