VRAM: RT mask Grad / HistGrad as RG16F gradients + R32UI flags/timers (follow-up to #1433) #1665

Open
opened 2026-11-21 19:29:00 +00:00 by sky_line · 0 comments
Owner

What

mRtMaskGrad and mRtMaskHistGrad are RGBA32F (32 B/px together): xy the view depth's d/dx, d/dy, z the caster flags, w two packed 12-bit timers. #1433 ruled out RGBA16F for the whole word because w needs 24-bit exact integers. This proposes splitting the word instead: RG16F gradients plus an R32UI word for the flags and timers.

Saving

16 B/px at mask scale 1.0: 4K 127 MB, 1440p 56 MB. Default scale 0.5: 32 / 14 MB.

Why it is not a quick change

  • Not pixel-identical. The plane test (clean_rt_mask_common.glsl, the mask's plane-aware upsample and history acceptance) uses the gradients. fp16 gradients change which history samples pass the plane test at grazing angles and far depths. That is a quality A/B, not a refactor.
  • Four images instead of two, so new bindings in sets 0 / 1 (21 / 22) and in the lit FS's set 0 b34 array ([depth 0, depth 1, grad 0, grad 1]). Every rtPackTimers / rtUnpackTimers reader changes.

Proposed design

Grad -> RG16F (xy) plus GradW -> R32UI (z flags | w timers), and the same for the history slot. Readers take vec2 gradients and a uint word. A/B on grazing ground, far terrain and thin geometry under RT sun with the mask path (merged off).

Risks

  • Plane-test regressions (shimmer or ghosting at grazing angles).
  • Small payoff on the merged path, where the mask is idle anyway (see the mask release ticket).
## What `mRtMaskGrad` and `mRtMaskHistGrad` are RGBA32F (32 B/px together): xy the view depth's d/dx, d/dy, z the caster flags, w two packed 12-bit timers. #1433 ruled out RGBA16F for the whole word because w needs 24-bit exact integers. This proposes splitting the word instead: RG16F gradients plus an R32UI word for the flags and timers. ## Saving 16 B/px at mask scale 1.0: 4K 127 MB, 1440p 56 MB. Default scale 0.5: 32 / 14 MB. ## Why it is not a quick change * **Not pixel-identical.** The plane test (`clean_rt_mask_common.glsl`, the mask's plane-aware upsample and history acceptance) uses the gradients. fp16 gradients change which history samples pass the plane test at grazing angles and far depths. That is a quality A/B, not a refactor. * Four images instead of two, so new bindings in sets 0 / 1 (21 / 22) and in the lit FS's set 0 b34 array (`[depth 0, depth 1, grad 0, grad 1]`). Every `rtPackTimers` / `rtUnpackTimers` reader changes. ## Proposed design `Grad -> RG16F (xy)` plus `GradW -> R32UI (z flags | w timers)`, and the same for the history slot. Readers take `vec2` gradients and a `uint` word. A/B on grazing ground, far terrain and thin geometry under RT sun with the mask path (merged off). ## Risks * Plane-test regressions (shimmer or ghosting at grazing angles). * Small payoff on the merged path, where the mask is idle anyway (see the mask release ticket).
sky_line added this to the Slipstream project 2026-11-21 19:29:00 +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#1665
No description provided.