forked from TrustNo1/Darner
[pr-diagnostics][shaders] Opt-in external shader override and targeted DXIL dump loader #3
Loading…
Reference in a new issue
No description provided.
Delete branch "nyutt/shader-overrides"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What it changes
rebar: investigating or prototyping per-shader GPU optimizations and visual fixes (roadmap step 7) currently requires modifying the translator and invalidating the entire shader cache on every iteration.This adds an opt-in, off-by-default external shader override and targeted dump loader strictly outside the repository (
ensure_outside_reporejects any path inside a Darner checkout):DARNER_SHADER_OVERRIDE_DIR=<dir>: replacesHostShader::dxilafter the normal shader-cache lookup (never polluting or invalidating the standard cache) from<hash16>.dxil,<hash16>.cso, or<hash16>.hlsl(compiled viadxcompiler.dllwith SM 6.6,-enable-16bit-types,#includesupport in<dir>, optional// darner-entry:/// darner-target:/// darner-args:directives, cached in<dir>/.compiled/). Optional<hash16>.viewssidecar overridesray_queries.tlas_srvsandroot_srvson Darner'st230..=t241slots.DARNER_SHADER_DUMP_DIR=<dir>(+ optionalDARNER_SHADER_DUMP_ONLY=<hash16,...>): dumps translated<hash16>.dxil,<hash16>.txt(binding metadata), and<hash16>.views(TLAS bindings) once per matching shader.How it was tested
540f024(rebased ontolucid/rebar48b9f9a)cargo test --locked --offline -p darner-gpu --lib shader_override: 7 passed, 0 failed (covers repo-path rejection,.dxiloverride keeping metadata, invalid-bytes fallback, HLSL header directives, targeted dump filtering,.viewsTLAS sidecar, and live DXC.hlsl+#includecompilation with.compiled/caching).cargo clippy --locked --offline -p darner-gpu --lib --tests -- -D warnings: 0 warnings in all 4 touched files (15 pre-existing clippy errors onlucid/rebarin untouched files).cargo xtask policy:asset policy: 576 files ok.darner.exe, ThinLTO) succeeded cleanly.darner-gpushader_overrideunit tests +cargo xtask policy..hlslcompilation is Windows-only;.dxil/.csoworks everywhere).lucid/rebar).Checklist
lucid/rebar.docs/asset-policy.md.Checked for overlap
End-to-end live in-game verification on
cam-city60(-Flight InGame, RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, Series X, 1080p->1440p, DLSS Quality, Frame Gen 2x,DARNER_HW_RT=1,540f024):PR3D) withDARNER_SHADER_DUMP_DIR=D:\darner-pr3-test+DARNER_SHADER_DUMP_ONLY=534b3645dd344ab2;fb515ca95d694c18;a55058c53fbc6406;7b2c3c1db2298f44;bd67937a6a9d342f—BENCH OK:DARNER_SHADER_DUMP_DIR active dir=\\?\D:\darner-pr3-test only=Some(5)dumped translated shader shader="7b2c3c1db2298f44" path=\\?\D:\darner-pr3-test\7b2c3c1db2298f44.dxil bytes=58172(+.txtbinding summary).PR3O) withDARNER_SHADER_OVERRIDE_DIR=D:\darner-pr3-test—BENCH OK:DARNER_SHADER_OVERRIDE_DIR active dir=\\?\D:\darner-pr3-testshader override applied shader="7b2c3c1db2298f44" source=\\?\D:\darner-pr3-test\7b2c3c1db2298f44.dxil bytes=58172dropped_pf = 0.0,fps_med = 16.8.PR30) on the same540f024build —BENCH OK,dropped_pf = 0.0,fps_med = 13.2.Test report: external HLSL overrides, live in game (not a CI result)
Commit tested:
540f024(feat/shader-overrides, onlucid/rebar48b9f9a), release build. Hardware: RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 31 GB RAM. Series X mode, 1080p→1440p DLSS Quality,DARNER_HW_RT=1, benchcam-city60 -Flight InGame, warm pipeline library.What I did: used
DARNER_SHADER_DUMP_DIRto dump translated programs, then usedDARNER_SHADER_OVERRIDE_DIRto replace 15 hand-written compute programs with HLSL compiled live throughdxcompiler.dll. The HLSL stays local and outside the repo (asset policy); nothing derived from the title is committed or attached here.Results (one run per arm, not an AB/BA, so treat as indicative):
card_lists_ms, median)ab.py)0x80070057shader override appliedx15), 0 failed pipelines, 0 GPU errors.worked_ms(CPU) is about 28–30 ms in this scene, so the route is CPU-bound and the 4 ms GPU saving only shows partly in fps. It should matter more when GPU-bound.Overrides are opt-in and off by default; nothing changes for anyone who doesn't set the variables. Happy to run an AB/BA if wanted.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.