FX P1: effects runtime on the VK post chain (display injection point, BackBuffer/DepthBuffer) #544

Closed
opened 2026-10-08 06:28:03 +00:00 by sky_line · 1 comment
Owner

Part of epic #542 (from #186). Design + code citations are in the epic; read it first.

Size: L (5-8 d)

Host compiled ReShade FX effects in recordWorld's post chain. New module newview/vkgfx/llcleanfxvk.{h,cpp}, structured like the FSR3 / god-rays modules.

Scope

  • Injection: after recordAA (llcleanrenderervk.cpp:26734), before the RLVa sphere + recordFinal. Force the final pass via prepareFinal(force) (:18145) the way the sphere does, and ping-pong LDR targets. RLVa sphere stays after FX. Nothing is allocated or recorded with zero effects.
  • Resources: textures / RTs from the module (formats, mips, pooled). Mutable-format UNORM/SRGB view pairs for SRGBTexture / SRGBWriteEnable. Samplers from states. Storage images for compute. Own stencil attachment for StencilEnable passes (our depth is D32 with no stencil, .h:1026). Texture source files: png/jpg/bmp/tga via LL decoders + DDS + .cube.
  • Passes: a graphics pipeline per pass (dynamic rendering, VertexCount / topology, blend / write-mask / stencil, ≤ 8 RTs, ClearRenderTargets, GenerateMipMaps) and compute passes (DispatchSize). Pipelines go via vk_pipecache. Barriers come from per-pass read/write sets.
  • Uniforms: UBO per frame-ring slot. All source specials: timer, frametime, framecount, date, pingpong, random, key, mousebutton, mousepoint, mousedelta, mousewheel, bufready_depth, overlay_open / active / hovered, screenshot.
  • Depth: DEPTH = unjittered display depth. Run the clean_depth_up.comp mapping at scale 1 too when FX needs depth (today it only runs when mScaled, :26776). Reversed-Z matches ReShade.fxh's default. Set RESHADE_DEPTH_LINEARIZATION_FAR_PLANE from the far clip, or provide pre-linearized depth with FAR_PLANE 1; decide by testing a depth effect.
  • Compiles run on a worker with an on-disk SPIR-V cache keyed by (sources hash, defines, BUFFER size). Recompile on resize. The old modules keep running until the new ones are ready.
  • Registry: follow the target-generation registry (llcleanrenderervk.h:1063-1090, gen via Frame struct).
  • Hot reload: mtime polling of search paths.
  • Instrumentation: gpuSubMark per technique (interned names) + vkBreadcrumb per pass.
  • Temporary control: a minimal stack defined by a settings string (RenderVKFxStack = Technique@file.fx,...) until P2's UI lands.

Done when

  • SweetFX (e.g. LumaSharpen, Vibrance, Tonemap) and a depth effect (e.g. a DOF or MXAO-class effect) render correctly at render scale 1 and < 1, with TAA on: no depth shimmer, no UI / HUD / name-tag contamination.
  • Multi-technique and multi-pass effects with RTs, a stencil pass and a compute pass work.
  • Resize, render-scale change and snapshot stress (RenderVKDebugSnapshotStress) show no stale-descriptor logs.
  • With no effects: 0 extra passes / allocations. Runtime overhead ≤ 0.05 ms with a trivial effect.
Part of epic #542 (from #186). Design + code citations are in the epic; read it first. **Size:** L (5-8 d) Host compiled ReShade FX effects in `recordWorld`'s post chain. New module `newview/vkgfx/llcleanfxvk.{h,cpp}`, structured like the FSR3 / god-rays modules. **Scope** - **Injection:** after `recordAA` (`llcleanrenderervk.cpp:26734`), before the RLVa sphere + `recordFinal`. Force the final pass via `prepareFinal(force)` (:18145) the way the sphere does, and ping-pong LDR targets. RLVa sphere stays after FX. Nothing is allocated or recorded with zero effects. - **Resources:** textures / RTs from the module (formats, mips, `pooled`). Mutable-format UNORM/SRGB view pairs for `SRGBTexture` / `SRGBWriteEnable`. Samplers from states. Storage images for compute. Own stencil attachment for `StencilEnable` passes (our depth is D32 with no stencil, `.h:1026`). Texture `source` files: png/jpg/bmp/tga via LL decoders + DDS + `.cube`. - **Passes:** a graphics pipeline per pass (dynamic rendering, VertexCount / topology, blend / write-mask / stencil, ≤ 8 RTs, ClearRenderTargets, GenerateMipMaps) and compute passes (DispatchSize). Pipelines go via `vk_pipecache`. Barriers come from per-pass read/write sets. - **Uniforms:** UBO per frame-ring slot. All `source` specials: timer, frametime, framecount, date, pingpong, random, key, mousebutton, mousepoint, mousedelta, mousewheel, bufready_depth, overlay_open / active / hovered, screenshot. - **Depth:** `DEPTH` = **unjittered display depth**. Run the `clean_depth_up.comp` mapping at scale 1 too when FX needs depth (today it only runs when `mScaled`, :26776). Reversed-Z matches ReShade.fxh's default. Set `RESHADE_DEPTH_LINEARIZATION_FAR_PLANE` from the far clip, or provide pre-linearized depth with FAR_PLANE 1; decide by testing a depth effect. - **Compiles** run on a worker with an on-disk SPIR-V cache keyed by (sources hash, defines, BUFFER size). Recompile on resize. The old modules keep running until the new ones are ready. - **Registry:** follow the target-generation registry (`llcleanrenderervk.h:1063-1090`, gen via Frame struct). - **Hot reload:** mtime polling of search paths. - **Instrumentation:** `gpuSubMark` per technique (interned names) + `vkBreadcrumb` per pass. - **Temporary control:** a minimal stack defined by a settings string (`RenderVKFxStack` = `Technique@file.fx,...`) until P2's UI lands. **Done when** - [ ] SweetFX (e.g. LumaSharpen, Vibrance, Tonemap) and a depth effect (e.g. a DOF or MXAO-class effect) render correctly at render scale 1 and < 1, with TAA on: no depth shimmer, no UI / HUD / name-tag contamination. - [ ] Multi-technique and multi-pass effects with RTs, a stencil pass and a compute pass work. - [ ] Resize, render-scale change and snapshot stress (`RenderVKDebugSnapshotStress`) show no stale-descriptor logs. - [ ] With no effects: 0 extra passes / allocations. Runtime overhead ≤ 0.05 ms with a trivial effect.
sky_line added this to the Slipstream project 2026-10-08 06:28:03 +00:00
Author
Owner

Done: FX P1 (effects runtime on the VK post chain, fa04ab8f21). Shipped in 1.2.0 Beta 4/5 (ReShade effects + cel shading).

Done: FX P1 (effects runtime on the VK post chain, fa04ab8f21). Shipped in 1.2.0 Beta 4/5 (ReShade effects + cel shading).
sky_line 2026-10-09 09:25:20 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#544
No description provided.