Skip to content

Commit

Permalink
[Fix] Webgl render pass sets up viewport even if not clearing the ren…
Browse files Browse the repository at this point in the history
…der target (#5828)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky committed Nov 15, 2023
1 parent 02238de commit 4e2e659
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/platform/graphics/webgl/webgl-graphics-device.js
Expand Up @@ -1428,24 +1428,22 @@ class WebglGraphicsDevice extends GraphicsDevice {
DebugGraphics.pushGpuMarker(this, `START-PASS`);

// set up render target
const rt = renderPass.renderTarget || this.backBuffer;
const rt = renderPass.renderTarget ?? this.backBuffer;
this.renderTarget = rt;
Debug.assert(rt);

this.updateBegin();

// the pass always start using full size of the target
const { width, height } = rt;
this.setViewport(0, 0, width, height);
this.setScissor(0, 0, width, height);

// clear the render target
const colorOps = renderPass.colorOps;
const depthStencilOps = renderPass.depthStencilOps;
if (colorOps?.clear || depthStencilOps.clearDepth || depthStencilOps.clearStencil) {

// the pass always clears full target
const rt = renderPass.renderTarget;
const width = rt ? rt.width : this.width;
const height = rt ? rt.height : this.height;
this.setViewport(0, 0, width, height);
this.setScissor(0, 0, width, height);

let clearFlags = 0;
const clearOptions = {};

Expand Down

0 comments on commit 4e2e659

Please sign in to comment.