mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -04:00
Compare textures up to 8 MiB by content before uploading them a second time, by default.
A texture whose pages show a write is uploaded again unless a hash of its bytes says they are the same. The hash covered textures up to 64 KiB; for larger ones it was a switch left off until measured in play (tex_same_big). A run through Hyrule Field measured it (RTX 5090, about three minutes of running): without it 44,000 to 52,000 second uploads of 33 to 47 GiB of storage in four runs of six, one 1536x1536 texture 29 times within 300 frames with the same bytes each time, and 66 thousand million texels decoded on the GPU in a run; with it 214 to 592 second uploads, 24 GiB found unchanged, and 20 to 24 thousand million texels decoded, which is the first uploads. The GPU's upload work fell from 0.41 to 0.14 ms a frame, and the second uploads' 2.9 s of the submitting thread are gone for about as much hashing. tex_same_big = 0 hashes only the small ones, as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1061,11 +1061,11 @@ static int test_textures(pool_t *tpool, pool_t *phys) {
|
||||
#ifdef _WIN32 // elsewhere an import's pinning can mark pages written again without a CPU write: the count is not exact
|
||||
GCHECK(re1 == re0 + 1, "storage rewritten: %llu re-uploads (want 1)", (unsigned long long)(re1 - re0));
|
||||
// The same bytes written again, so that every page of the storage shows a write. The texture is over 64 KiB: with
|
||||
// NX2NAVI_TEX_SAME_BIG it is compared by content and left as it is, without the switch it is uploaded again. Other
|
||||
// NX2NAVI_TEX_SAME_BIG (the default) it is compared by content and left as it is, with 0 it is uploaded again. Other
|
||||
// bytes upload either way, and the image holds them. After two comparisons in a row that found other bytes its
|
||||
// uploads take no hash any more, so the same bytes written again then upload with the switch too.
|
||||
{
|
||||
int big = rt_knob("TEX_SAME_BIG", "0") == 1;
|
||||
int big = rt_knob("TEX_SAME_BIG", "1") == 1;
|
||||
volatile uint8_t *sm = (volatile uint8_t *)t.mem;
|
||||
uint64_t re2, re3, re4, re5;
|
||||
GCHECK(t.L.size > (64u << 10), "the RGBA8 texture's storage is %llu bytes, not over 64 KiB", (unsigned long long)t.L.size);
|
||||
|
||||
Reference in New Issue
Block a user