Repository navigation
Stop uploading unused per-sprite and duplicate atlas textures (#110) - #121
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Devin Review found 2 findings. Devin fixed 1 finding; 1 finding is left for you to triage below.
Fixed by Devin (1)
- Unused sprite index after cache removal — Removed SpriteEntry.index and its counter; nothing reads it after the per-sprite material cache removal.
There was a problem hiding this comment.
🔍 Atlas reload lacks live verification
The live rendering check is missing from the PR. Repeat F3+T in game to check animated terrain and measure VRAM across reloads.
Devin left this for you to triage: The in-game check (F3+T repeated, animated terrain, VRAM per reload) needs Windows + an RTX GPU, which Devin's Linux VM doesn't have. Recommend the author run tools\rtx.bat launch and note before/after VRAM and visuals in the PR before merging.
(Refers to this code)
Was this helpful? React with 👍 or 👎 to provide feedback.
sambvfx
left a comment
There was a problem hiding this comment.
Reviewed at a8da869 and checked in game. Approving.
Code
- The removed path is dead: nothing calls
getMaterial(SpriteEntry, int), and nothing outsideBlockTextureManagerreads the per-sprite texture fields,hasPBRorindex. block_atlaswas replaced byatlas_albedoinbuildAtlasMaterialsbefore any material or the animation forwarder read it, so only the duplicate goes.hasSSSand the sprite light colours are computed from the same inputs as before.
In-game check
PR head a8da869 against its base a37b3b4, two launches each, alternating. Fabric development client on Windows, showcase world restored from the same copy before every launch, Materials pack 0.61.0, 1920x1080.
I built a small scene (glowstone, sea lantern, magma, shroomlight, a lit redstone lamp, glass, stained glass, leaves, ice, gold, prismarine, amethyst, crying obsidian, lava, water, fire, a campfire, a torch and iron bars), took screenshots from a fixed pose, reloaded resources with F3+T four times (first pair) or six times (second pair), and read the process's dedicated GPU memory 30 seconds after each reload. A night shot closed each run.
- Rendering: every block looks the same in both builds, before and after the reloads, by eye and by average colour per block. Emissive blocks light the floor and wall at night in both.
- Animation: lava, water, magma and the sea lantern keep animating after the reloads in both builds.
- Logs: no errors in any run. The atlas rebuilt on every reload with the same counts (1,686 sprites, 600 with LabPBR, 54 emissive).
GPU memory in MiB, two launches per build (reloads 5 and 6 were only run in the second pair):
| Stage | Base | PR |
|---|---|---|
| In the world | 4,287 / 4,284 | 4,243 / 4,239 |
| Scene built | 4,929 / 4,945 | 4,889 / 4,881 |
| After reload 1 | 5,106 / 5,106 | 4,729 / 4,721 |
| After reload 2 | 5,089 / 5,106 | 4,746 / 4,758 |
| After reload 3 | 5,126 / 5,122 | 4,729 / 4,725 |
| After reload 4 | 5,109 / 5,123 | 5,082 / 5,082 |
| After reload 5 | 5,126 | 5,065 |
| After reload 6 | 5,446 | 5,402 |
So the PR is about 45 MiB lower at rest. Memory moves in steps of roughly 170 to 350 MiB in both builds, and the PR's first step lands on reload 4 where the base's lands on reload 1, which is the whole of the gap after reloads 1 to 3. From the built scene to reload 6 the base grew by about 500 to 520 MiB and the PR by 521 MiB, so total growth across reloads is unchanged. The runtime-side half of #110 is still needed for that.
Not blocking, fine as follow-ups
buildSpritesstill copies every sprite's albedo and bakes AO into the copy, but the copy is now read only for sprites with_semissive data or a luminance entry.scanPBRsetshasSSSfrom the same conditionsbuildAtlasMaterialsapplies again before anything reads it.- A few comments still describe per-sprite textures: the
SpriteEntryJavadoc ("texture handles, PBR flags"), the first line of the class Javadoc, and the "Per-sprite texture extraction" and "Sprite lookup + material factory" banners. cleanupleavesatlasAlbedoandatlasEmissiveset. Harmless today, since a destroyed texture's handle is 0 andflushAnimationPatcheschecks it, but nulling them with the other atlas fields would be tidier.
Summary
Mod-side half of #110. On every atlas capture
BlockTextureManageruploaded GPU textures that nothing samples. A resource reload destroys and re-uploads them, and the runtime keeps destroyed textures in its cache, so each reload left more memory behind.What this PR removes:
captureAtlas()uploadedblock_atlas, andbuildAtlasMaterials()then replacedatlasAlbedowithatlas_albedo(after the atlas edits). Only the second upload is kept.s<i>_a,_n,_h,_r,_m,_s,_ssa,_e). Only the lazygetMaterial(SpriteEntry, int)path read them, and nothing in the repo calls it: terrain uses the atlas-level materials. That path is removed along with itsmaterialscache andforgetCachedCutoutSpriteMaterials().buildPBRbecomesscanPBR. It still computes the facts other code reads from each sprite (hasSSS, andlightColorfrom the emissive channel), but uploads nothing. The atlas-level PBR, SSS and emissive textures are unchanged. TheAGENTS.mdTextures section is updated to match.The runtime-side cache retention described in #110 still has to be fixed in dxvk-remix. This PR only stops the mod from feeding that cache.
Verification
renderer-core/srcandrtxremix-java/srcwith javac 21 and ran therenderer-core/testsuite through the JUnit console. 358 of 362 tests passed. The same 4 tests also fail onmainin that setup:CanonicalCaptureSemanticsTestneeds fixtures fromversions/.../test/resources, andDirectoryRuntimePayloadTestdepends on Windows file locking.Link to Devin session: https://nvidia-cloud.devinenterprise.com/sessions/b86e22769ec7473c926a194b84efd244
Open in Devin Desktop: https://nvidia-cloud.devinenterprise.com/desktop/session/b86e22769ec7473c926a194b84efd244?variant=devin
Requested by: @nvzkupu
👀 Devin fixed 1 finding · 1 finding for you to triage · Follow Devin's work