Repository navigation
fix: renderer device leak, target rebuilds from window size, planar probe culls, golden tests on Windows - #242
proggeramlug wants to merge 5 commits into
Conversation
MaterialSystem::new mem::forget-ed a stub depth texture, two of its views and the comparison sampler, on the theory that the bind group keeps them alive. It does - without the forget. A forgotten wgpu handle never releases its reference, and every handle holds the device, so no renderer's device (or any memory heap it had allocated) was ever freed: ~580 MB per renderer on a Radeon 760M, on DX12 and Vulkan alike. The golden suite, which builds a renderer per test, ran out of GPU memory after ~30 (41 failures in a serial run on Windows). Measured with a create/drop loop: private bytes now stay flat.
…e and renderer teardown set_temporal_upscale and rebuild_render_targets read native_width/height directly, which is 0 before the platform's first resize, and resize(0, 0) configures a 1x1 surface; they use native_size() now, like set_render_scale. Tests: the output scale stays applied once through render-scale and temporal-upscale changes (it compounded before set_render_scale's fix: a 4K window at 0.75 ended at 1215x683 after four dynamic-resolution steps), and dropping a renderer leaves no texture memory or views alive (82 KB and 3 views before the previous commit).
… show A planar probe redraws the scene mirrored, almost all of it vertex work: in the shooter on a Radeon 760M the water probe cost 5 ms of a 27 ms fight frame (40.6 fps without it, 31.7 with). Two culls that cannot change the picture: - a probe renders only on frames where a draw whose material samples it is inside the main frustum (instanced or unbounded draws count as visible); - a cached model or scene node whose bounding sphere covers under 3 probe pixels, seen from the mirrored eye, is not drawn into the probe.
…kan's texture count wgpu-hal 29's Vulkan backend never counts a created texture (only add_raw_texture does) but subtracts on every destroy, so hal.textures reads negative there (-76), and Vulkan is the default pick on Windows: the static-ultra memory test failed its 'counters enabled' precondition. It now accepts live texture memory instead; texture memory and views are counted both ways on every backend and still catch a leaked texture in the growth check. WGPU_BACKEND=vulkan|dx12 narrows try_engine's adapter pick.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
With a current weight of 1 (a reset, a camera cut, the first frames) the resolve still loaded the history texture's provenance, and its stale confidence fed the reconstruction-detail term added to the output: the frame after reset_temporal_history() differed from a fresh render of the same pose by one 8-bit level. History is now read only when it can be used (the history_usable condition the blend already applies). Found by temporal_history::camera_motion_sequence_bounds_ghosting_flicker_and_cut_residue, which failed on DX12 and Vulkan on a Radeon 760M and now passes on both; golden_render 88/89 on both backends (the remaining failure, ssgi_hiz_immediate_scene_produces_finite_indirect_radiance, is SSIM 0.99844 against 0.9985 and fails on main too).
|
Added a TAA fix ( |
… profile - New video row WATER REFLECTIONS (settings key waterReflections, default on, off in the LOW preset). It links or unlinks the river's planar probe from the water material; the engine (Bloom-Engine/engine#242) renders a probe only when something on screen samples it, so off costs nothing and the water reflects the sky. - First-run calibration: under 30 fps on the title screen it also applies the LOW preset with the sun's shadows off (applySlowGpuProfile). Radeon 760M, 4K panel, fresh install: the title measured 27.6 fps at 0.75 and chose output 0.5, LOW, shadows off, water reflections off; a fight then runs 57.9 fps mean (worst window 46.2), against 29 on HIGH. tools/check.sh --bot: static, boot, AI, menus 22/22, whole run won.
Found while bringing the shooter up on Windows (Radeon 760M iGPU, 4K panel).
Renderer memory leak (all platforms).
MaterialSystem::newmem::forget-ed a stub depth texture, two views and the comparison sampler. Each wgpu handle holds the device, so no renderer's device (or its memory heaps) was ever freed: about 580 MB per renderer on DX12 and on Vulkan. A game builds one renderer and doesn't notice; the golden suite builds one per test and ran out of GPU memory after about 30 (41 failures in a serial Windows run, now 2, see below). New testdropping_a_renderer_releases_its_texturesfails without the fix (82 KB and 3 views left alive) and passes with it.Render-target rebuilds from the window size.
mainalready fixedset_render_scalecompounding the output scale (I had found the same bug; the new testoutput_scale_does_not_compound_through_render_scale_changescovers it and fails on the old code).set_temporal_upscaleandrebuild_render_targetsreadnative_width/heightdirectly, which is 0 before the first resize; they now usenative_size().Planar probes. In the shooter the water probe costs 5 ms of a 27 ms fight frame on the 760M, nearly all of it vertex work: a 256-pixel probe saves only 0.5 ms. Two culls that leave the picture unchanged:
Measured honestly: in the shooter's fight harness the river is almost always in view, so the first cull gains nothing there; the second gains about 0.4 ms. They pay off when the water is off-screen. The real fix for that scene is LODs for the trees.
Golden tests on Windows. wgpu-hal 29's Vulkan backend never counts a created texture but subtracts on every destroy, so
hal.texturesreads negative (-76). Vulkan is the default pick on Windows, so the static-ultra memory test failed its precondition; it now accepts live texture memory, which is counted on every backend and still catches a leaked texture.WGPU_BACKEND=vulkan|dx12now narrowstry_engine's adapter pick.Results (Windows, Radeon 760M):
render_targets: 6 of 6.golden_render --test-threads=1: 87 passed, 2 failed. The two failures,camera_motion_sequence_bounds_ghosting_flicker_and_cut_residueandssgi_hiz_immediate_scene_produces_finite_indirect_radiance, also fail onmainwithout this change, on DX12 and Vulkan, each run on its own.tools/check-file-lines.js: 0 failures.