mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 20:09:57 -04:00
Make an area's textures at once after a load instead of over the first seconds, which showed the ground and walls black.
The texture pool creates 16 entries a refresh and stops after 6 ms a frame, so that textures streaming in do not make long frames. An area load leaves thousands of slots at once (4,936 loading the test save), and at that rate they came in over the frames after the load screen: the scene's first frames showed a quarter of the picture as black stand-ins, for 22 presented frames on a free machine and for about three seconds with the CPU busy. While a refresh leaves pool_load_backlog slots or more (512; 0 never), the pool is loading: the count limit is off, a frame's refreshes may take pool_load_ms (50), and frame_hold leaves out the presents of frames drawn meanwhile (up to 2 s), so the picture before the load stays until fewer than 64 slots are left. Measured with the flight recorder's thumbnails of every present: the 4,847 textures are made in one frame of 345 ms, 30 frames before the scene fades in, and the black share of the picture goes from the fade straight to its final value. The streaming limits are as before below the backlog. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -112,8 +112,16 @@ void vk_present_drain(void) {
|
||||
// setting and does not use the allowance. It holds with DLSS Frame Generation too: a present left out is a longer gap
|
||||
// between two rendered frames to it (its constants and tags are set at the host present, gfx_present.c), and a dark
|
||||
// frame it is given comes out as several generated ones.
|
||||
// And it covers an area load (vk_exec_draw.c vk_exec_pool_loading): while the texture pool still makes the area's
|
||||
// textures, the frames show the ground and the walls as black stand-ins, so the picture before the load stays for up
|
||||
// to LOAD_HOLD_NS, also beside the allowance.
|
||||
#define RESIZE_HOLD 6
|
||||
static struct { int64_t limit_ns, left_ns; uint64_t last_ns, held, runs, shown; int holding, resize_left; } FH = {.limit_ns = -1};
|
||||
#define LOAD_HOLD_NS 2000000000ull
|
||||
static struct {
|
||||
int64_t limit_ns, left_ns;
|
||||
uint64_t last_ns, held, runs, shown, load_t0, load_held;
|
||||
int holding, resize_left;
|
||||
} FH = {.limit_ns = -1};
|
||||
|
||||
static void frame_hold_refill(uint64_t now) {
|
||||
if (FH.limit_ns < 0) {
|
||||
@@ -148,6 +156,18 @@ static int frame_hold(uint32_t skipped, int resized, uint64_t frame) {
|
||||
FH.resize_left--;
|
||||
return 1;
|
||||
}
|
||||
if (FH.limit_ns > 0 && vk_exec_pool_loading()) {
|
||||
uint64_t now = kern_now_ns();
|
||||
if (!FH.load_t0) FH.load_t0 = now, FH.load_held = 0;
|
||||
if (now - FH.load_t0 < LOAD_HOLD_NS) {
|
||||
FH.load_held++;
|
||||
return 1;
|
||||
}
|
||||
} else if (FH.load_t0) {
|
||||
rt_log("vk: frame %llu: the previous picture stayed for %llu frames, %.0f ms, while an area's textures were made",
|
||||
(unsigned long long)frame, (unsigned long long)FH.load_held, (double)(kern_now_ns() - FH.load_t0) / 1e6);
|
||||
FH.load_t0 = 0;
|
||||
}
|
||||
int hold = skipped && FH.left_ns > 0 && !vk_dlssg_active();
|
||||
if (hold && !FH.holding) FH.runs++;
|
||||
if (skipped && !hold) FH.shown++;
|
||||
|
||||
Reference in New Issue
Block a user