Repository navigation
refactor(core): honor canvas contexts throughout render passes - #10474
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99c2cbfdc2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| protected _render(options: LayersPassRenderOptions): RenderStats[] { | ||
| const canvasContext = this.device.canvasContext!; | ||
| const {canvasContext = this.device.canvasContext!} = options; |
There was a problem hiding this comment.
Clear views on the selected canvas framebuffer
When canvasContext is a non-default presentation context and a View has clear enabled, _render resolves that context's framebuffer here, but _drawLayers still forwards only the original target (typically null or undefined) and _drawLayersInViewport opens its clear pass with framebuffer: target. The clear consequently runs against the device's default canvas rather than the framebuffer used by the outer render pass, leaving stale color/depth in the selected canvas and potentially clearing another canvas; pass the resolved framebuffer into the per-view clear.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 0309acd. LayersPass._render now forwards its resolved framebuffer into _drawLayers, so every per-view clear pass uses the same selected-canvas framebuffer even when the original target was null or undefined.
Regression coverage: LayersPass#uses the supplied canvas context for viewport and clear passes spies on both render-pass creations and asserts that both receive the selected framebuffer. Revalidated with 14 affected rendering/picking tests passing.
There was a problem hiding this comment.
Rebased onto current master; the fix remains in rebased commit 18ee6a7ae1. The selected-canvas clear regression still passes, along with the complete 70-test rendering, picking, and viewport-layout suite.
|
|
||
| if (this.lastPostProcessEffect) { | ||
| this._resizeRenderBuffers(); | ||
| this._resizeRenderBuffers(opts.canvasContext); |
There was a problem hiding this comment.
Resolve post-process output against the selected canvas
When a non-default canvasContext is rendered with a built-in PostProcessEffect and the canvas target is null, this only sizes the intermediate buffers from the selected context. _postRender still gives the final effect opts.target, so PostProcessEffect/ScreenPass starts its final pass with a null framebuffer, which selects the device's default canvas rather than canvasContext.getCurrentFramebuffer(); the selected canvas receives no composited output while the default canvas is overwritten.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 0309acd. DeckRenderer._postRender now resolves the final output as opts.target ?? opts.canvasContext?.getCurrentFramebuffer() ?? opts.target, so the last post-processing effect renders to the selected canvas while preserving existing default-canvas behavior when no alternate context is supplied.
Regression coverage: DeckRenderer#post processing renders to the supplied canvas framebuffer exercises a two-effect chain and verifies the intermediate effect receives no target while the final effect receives the selected framebuffer. Revalidated with 14 affected rendering/picking tests passing.
There was a problem hiding this comment.
Rebased onto current master; the fix remains in rebased commit 18ee6a7ae1. The two-effect regression still confirms that only the final effect targets the selected canvas framebuffer; all 70 rendering, picking, and viewport-layout tests pass.
05f8f9f to
c15183d
Compare
Goal
Make rendering, picking, and viewport layout consistently honor the active luma canvas context while preserving existing single-canvas behavior.
Changes
CanvasContextorPresentationContextin internal rendering and picking options.Review scope
Ten core source/test files. No new public
Deckmulti-canvas props, canvas lifecycle ownership, widgets, or application examples; omitted contexts preserve existing defaults.Validation
master(dd9b4047d6)../node_modules/.bin/tsc -p modules/core/tsconfig.json --noEmit --pretty falseyarn lint— passed; existing repository lint warnings remain.Stack