Skip to content

Ignore released shaders when inhibiting frame elision - #109

Open
hkf57 wants to merge 1 commit into
PathOfBuildingCommunity:masterfrom
hkf57:agent/stabilize-frame-elision-hash
Open

Ignore released shaders when inhibiting frame elision#109
hkf57 wants to merge 1 commit into
PathOfBuildingCommunity:masterfrom
hkf57:agent/stabilize-frame-elision-hash

Conversation

@hkf57

@hkf57 hkf57 commented Aug 3, 2026

Copy link
Copy Markdown

What changed

Ignore released shader slots when checking whether an incomplete texture must inhibit frame elision.

if (auto* sh = shaderList[idx]; sh && sh->refCount > 0)

Why

When an asynchronous texture is released before upload completes, r_shaderHnd_c aborts the load at reference count zero. Depending on its loading phase, the cancelled texture can remain INIT or PENDING_UPLOAD; PurgeShaders() deliberately retains shader slots until their texture is DONE.

PumpShaders() scans those released slots and currently sets inhibitElision for any non-DONE texture. Since the cancelled texture will never finish, EndFrame() clears lastFrameHash every frame and permanently defeats identical-frame elision.

Released shaders cannot participate in rendering. Restricting the loading check to positive-reference slots preserves elision inhibition for every active loading texture while excluding abandoned slots.

Closes #108.

Live evidence

On the reproducing PoB build, SimpleGraphic's Layers panel reported:

  • 122 out of 122 frames drawn
  • Elide identical frames enabled
  • Elision inhibited continuously true

The affected focused 3840x1600 window used roughly 80% of an RTX 3080 Ti. The same instance at 1296x759 used 1.26%, and another maximized build using the same executable/runtime used 2.57%. DWM, refresh rate, NVIDIA profile matching, and overlays were excluded as the primary discriminator.

Validation

  • git diff --check: passed
  • Fork Windows 2022 build workflow: passed (run 30789884304)
  • Runtime version: 2.5-dad6573
  • Portable test foreground PID verified before and after the performance sample
  • Patched focused/maximized GPU 3D: 6.27% average / 8.82% maximum, down from 80.7% average with stock/first candidate (about 92% lower)
  • Renderer Layers panel after fix: 22 out of 1020 frames drawn, frame elision enabled, Elision inhibited false

The portable process was closed after the sample and the original focus/cursor were restored. No installed PoB files or persistent settings were changed.

@hkf57
hkf57 force-pushed the agent/stabilize-frame-elision-hash branch from 66e4af1 to dad6573 Compare August 3, 2026 06:20
@hkf57 hkf57 changed the title Stabilize frame elision command hashes Ignore released shaders when inhibiting frame elision Aug 3, 2026
@hkf57
hkf57 marked this pull request as ready for review August 3, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Released async shader can permanently inhibit frame elision

1 participant