Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/tests/text-vertical-center.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,18 @@ export default async function test({ renderer, testRoot }: ExampleSettings) {
clipping: true,
});

// Geometric center guide.
// Geometric center guide. Height is 1.35, not 1, to avoid sub-pixel
// rasterization gaps: at the default examples config (resolution=720,
// appHeight=1080) the logical→physical scale is 0.667, so a 1-logical-px
// line at certain Y positions covers no pixel center and disappears
// (e.g. the fontSize 60 row at y=430). A 2-logical-px line is always
// ≥ 1 physical pixel and guaranteed to rasterize.
renderer.createNode({
parent: box,
x: 0,
y: Math.round(BOX_H / 2),
w: BOX_W,
h: 1,
h: 1.35,
color: 0xff0000ff,
});

Expand Down
29 changes: 16 additions & 13 deletions src/core/renderers/webgl/WebGlRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,20 +530,12 @@ export class WebGlRenderer extends CoreRenderer {
return false;
}

const shader = node.props.shader as WebGlShaderNode;
const curShader = curRenderOp.shader as WebGlShaderNode;

if (curShader.shaderKey === 'default' && shader.shaderKey === 'default') {
return true;
}

// Check if the shader is the same
if (curShader !== shader) {
return false;
}
// Correctness checks first — these MUST pass regardless of shader.
// RTT mismatch and clipping rect differences can't be batched: the
// draw call applies one framebuffer / one scissor to every quad in
// the op.

// Force new render operation if rendering to texture is different
// This is the cheap check, so do it first
if (
USE_RTT &&
(curRenderOp.parentHasRenderTexture !== node.parentHasRenderTexture ||
Expand All @@ -553,11 +545,22 @@ export class WebGlRenderer extends CoreRenderer {
}

// Switching clipping rect will require a new render operation
// This involves object accessing so do it after integer/boolean checks
if (compareRect(curRenderOp.clippingRect, node.clippingRect) === false) {
return false;
}

const shader = node.props.shader as WebGlShaderNode;
const curShader = curRenderOp.shader as WebGlShaderNode;

if (curShader.shaderKey === 'default' && shader.shaderKey === 'default') {
return true;
}

// Check if the shader is the same
if (curShader !== shader) {
return false;
}

if (
USE_RTT &&
node.parentHasRenderTexture === true &&
Expand Down
Binary file modified visual-regression/certified-snapshots/chromium-ci/clipping-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified visual-regression/certified-snapshots/chromium-ci/text-alpha-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading