Repository navigation
Conversation
…laced update_authored_textures borrowed ChunkTextureAssets mutably on every frame, even when the authored maps were unchanged, which marked the resource changed every frame and made the render world extract it again each time. It now borrows it mutably only to replace the maps. Co-Authored-By: Dylan T. <14214667+dktapps@users.noreply.github.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Measured: small, about 0.5 µs per frame on each thread (details below).
update_authored_texturesruns every frame. It passed itsResMut<ChunkTextureAssets>toapplyas&mut, which goes throughDerefMutand marks the resource changed, even thoughapplythen found the authored maps unchanged and wrote nothing.ChunkTextureAssetsis extracted to the render world withExtractResourcePlugin. So on every frame, including idle ones, extraction cloned it into the render world again and marked it changed there, and every render system reacting to that change ran again. An extract-dirtiness measurement on the idle flat world found it marked changed on 99% of frames, with nothing about the textures changing.The system now checks whether the maps differ before taking the resource mutably, and only takes it mutably to replace them.
applyand its tests are unchanged.Test:
render_mode::authored_textures::tests::unchanged_maps_leave_the_chunk_textures_unchangedruns the system three times with nothing to change. It asserts the resource counts as changed only on the first run, when it is inserted.Measured in Cinnabar's flat-world benchmark, 960×540, on an A/B build with the change switched on and off live. Under the shared benchmark lock, 32 interleaved 4 s pairs over 4 rounds:
Most of the saving is the per-frame extraction clone. Render-side work reacting to the changed textures is small.
Co-Authored-By: Dylan T. 14214667+dktapps@users.noreply.github.com
Summary by CodeRabbit