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
4 changes: 2 additions & 2 deletions src/core/renderers/webgl/WebGlRenderOp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class WebGlRenderOp extends CoreRenderOp {
readonly clippingRect: RectWithValid;
readonly rtt: boolean;
readonly parentHasRenderTexture: boolean;
readonly framebufferDimensions?: Dimensions | null;
readonly framebufferDimensions: Dimensions | null;
readonly alpha: number;
readonly pixelRatio: number;
readonly time?: number | null;
Expand All @@ -80,7 +80,7 @@ export class WebGlRenderOp extends CoreRenderOp {
this.height = quad.height;
this.clippingRect = quad.clippingRect;
this.parentHasRenderTexture = quad.parentHasRenderTexture;
this.framebufferDimensions = quad.framebufferDimensions;
this.framebufferDimensions = quad.framebufferDimensions || null;
this.rtt = quad.rtt;
this.alpha = quad.alpha;
this.pixelRatio =
Expand Down
32 changes: 22 additions & 10 deletions src/core/renderers/webgl/WebGlRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,9 @@ export class WebGlRenderer extends CoreRenderer {
const u = this.uiQuadBuffer;
let i = this.curBufferIdx;

let ro = this.curRenderOp!;
const reuse = this.reuseRenderOp(params) === false;
if (reuse) {
const reuse = this.reuseRenderOp(params);
if (reuse === false) {
this.newRenderOp(params, i);
ro = this.curRenderOp!;
}

let tx = params.texture!;
Expand Down Expand Up @@ -320,7 +318,7 @@ export class WebGlRenderer extends CoreRenderer {
f[i + 30] = 1;
f[i + 31] = 1;

ro.numQuads++;
this.curRenderOp!.numQuads++;
this.curBufferIdx = i + 32;
}

Expand Down Expand Up @@ -387,16 +385,30 @@ export class WebGlRenderer extends CoreRenderer {
return false;
}

// Force new render operation if rendering to texture
// @todo: This needs to be improved, render operations could also be reused
// for rendering to texture
// Force new render operation if rendering to texture is different
if (
params.parentHasRenderTexture !== undefined ||
params.rtt !== undefined
this.curRenderOp.parentHasRenderTexture !==
params.parentHasRenderTexture ||
this.curRenderOp.rtt !== params.rtt
) {
return false;
}

if (
params.parentHasRenderTexture === true &&
this.curRenderOp.framebufferDimensions !== null &&
params.framebufferDimensions !== null
) {
if (
this.curRenderOp.framebufferDimensions.w !==
params.framebufferDimensions.w ||
this.curRenderOp.framebufferDimensions.h !==
params.framebufferDimensions.h
) {
return false;
}
}

if (
this.curRenderOp.shader.shaderKey === 'default' &&
params.shader?.shaderKey === 'default'
Expand Down