Skip to content

Commit a86409a

Browse files
Spruill-1Copilot
andcommitted
Revert MapOutputRectToInputRects sub-rect propagation
Earlier today (1ea4365) I changed CustomPixelShaderEffect::Map- OutputRectToInputRects to honor the queried output sub-rect, hoping it would unlock leaf-side preview-resolution scaling and per-input-rect routing for Split. The Split-pivot regression check passed at full- canvas preview, but the broader sub-rect propagation breaks thumbnail- sized preview panes: D2D queries a small output sub-rect to fill the thumbnail, our chain dutifully renders only that sub-rect, and the preview pane shows a small rendered region in the upper-left of an otherwise-black canvas. User-reported via Gamut Highlight thumbnail. Going back to the safe baseline -- always return m_lastOutputRect from MapOutputRectToInputRects regardless of queried sub-rect. This guarantees the intermediate textures match the full effect output rect (the with- TRIVIAL_SAMPLING contract) and keeps thumbnail / preview-pane rendering correct. Trade-off: D2Ds lazy-eval cant propagate sub-rect demand through our chain, so leaf-side approaches to preview-resolution scaling cant rely on this mechanism. The Scale catalog node ships the explicit- insertion model instead -- which is what we landed on anyway after the B/C architecture options were abandoned. Tier 2 (per-input-rect routing for Split) would still need this mechanism but it was already deferred indefinitely. 154/154 tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bcd89d8 commit a86409a

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

Effects/CustomPixelShaderEffect.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -252,31 +252,28 @@ namespace ShaderLab::Effects
252252
}
253253

254254
IFACEMETHODIMP CustomPixelShaderEffect::MapOutputRectToInputRects(
255-
const D2D1_RECT_L* outputRect,
255+
const D2D1_RECT_L* /*outputRect*/,
256256
D2D1_RECT_L* inputRects,
257257
UINT32 inputRectCount) const
258258
{
259-
// Pass the queried output sub-rect through as the input demand. With
260-
// D2D1_PIXEL_OPTIONS_TRIVIAL_SAMPLING set, our shaders read input
261-
// pixel (x,y) for output pixel (x,y) -- so the input rect needed is
262-
// exactly the output rect being requested.
259+
// Always return the FULL output rect as the input demand, ignoring
260+
// the queried sub-rect. This is the safe-with-TRIVIAL_SAMPLING
261+
// baseline: it ensures the intermediate textures match the full
262+
// effect output rect so TEXCOORD maps 1:1 with GetDimensions()-
263+
// normalized math, and so thumbnail / sub-rect previews show the
264+
// *whole* effect output rather than just the queried region.
263265
//
264-
// Honoring the sub-rect (rather than returning m_lastOutputRect for
265-
// every input) is the linchpin of D2Ds lazy-evaluation propagation:
266-
// if a downstream consumer (e.g. the swap-chain present at a small
267-
// canvas size) requests only a sub-rect of our output, that demand
268-
// cascades upward and every upstream effect renders only what's
269-
// actually needed. For preview-resolution scaling on heavy 4K HDR
270-
// graphs this can reduce upstream pixel-shader work by 4x or more.
271-
//
272-
// Split Comparison and other effects that need the full output rect
273-
// for math (pivot recentering, etc.) read the full dimensions from
274-
// host-injected OutputW/OutputH cbuffer fields, not from the per-
275-
// dispatch rect -- so this change is transparent to them.
276-
const D2D1_RECT_L safe = outputRect ? *outputRect : m_lastOutputRect;
266+
// An earlier attempt at honoring the queried sub-rect to enable
267+
// D2Ds lazy-eval propagation (for preview-resolution scaling and
268+
// per-input-rect routing) caused the symptom that thumbnail-
269+
// sized preview panes rendered only a small sub-rect of the
270+
// chain into the upper-left of the canvas. Reverted; preview-
271+
// resolution scaling is shipped as the explicit Scale catalog
272+
// node instead, which constrains the source-side rect rather
273+
// than relying on leaf-side sub-rect demand propagation.
277274
for (UINT32 i = 0; i < inputRectCount; ++i)
278275
{
279-
inputRects[i] = safe;
276+
inputRects[i] = m_lastOutputRect;
280277
}
281278
return S_OK;
282279
}

0 commit comments

Comments
 (0)