Skip to content

Commit cde2d20

Browse files
authored
WebGPURenderer: Fix scissor value bound check (#31782)
1 parent 5271d63 commit cde2d20

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/renderers/common/Renderer.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,20 +1399,6 @@ class Renderer {
13991399
renderContext.scissorValue.width >>= activeMipmapLevel;
14001400
renderContext.scissorValue.height >>= activeMipmapLevel;
14011401

1402-
renderContext.scissorValue.max( _vector4.set( 0, 0, 0, 0 ) );
1403-
1404-
if ( renderContext.scissorValue.x + renderContext.scissorValue.width > _drawingBufferSize.width ) {
1405-
1406-
renderContext.scissorValue.width = _drawingBufferSize.width - renderContext.scissorValue.x;
1407-
1408-
}
1409-
1410-
if ( renderContext.scissorValue.y + renderContext.scissorValue.height > _drawingBufferSize.height ) {
1411-
1412-
renderContext.scissorValue.height = _drawingBufferSize.height - renderContext.scissorValue.y;
1413-
1414-
}
1415-
14161402
if ( ! renderContext.clippingContext ) renderContext.clippingContext = new ClippingContext();
14171403
renderContext.clippingContext.updateGlobal( sceneRef, camera );
14181404

@@ -1464,8 +1450,8 @@ class Renderer {
14641450

14651451
renderContext.textures = null;
14661452
renderContext.depthTexture = null;
1467-
renderContext.width = this.domElement.width;
1468-
renderContext.height = this.domElement.height;
1453+
renderContext.width = _drawingBufferSize.width;
1454+
renderContext.height = _drawingBufferSize.height;
14691455
renderContext.depth = this.depth;
14701456
renderContext.stencil = this.stencil;
14711457

@@ -1479,6 +1465,22 @@ class Renderer {
14791465

14801466
//
14811467

1468+
renderContext.scissorValue.max( _vector4.set( 0, 0, 0, 0 ) );
1469+
1470+
if ( renderContext.scissorValue.x + renderContext.scissorValue.width > renderContext.width ) {
1471+
1472+
renderContext.scissorValue.width = Math.max( renderContext.width - renderContext.scissorValue.x, 0 );
1473+
1474+
}
1475+
1476+
if ( renderContext.scissorValue.y + renderContext.scissorValue.height > renderContext.height ) {
1477+
1478+
renderContext.scissorValue.height = Math.max( renderContext.height - renderContext.scissorValue.y, 0 );
1479+
1480+
}
1481+
1482+
//
1483+
14821484
this._background.update( sceneRef, renderList, renderContext );
14831485

14841486
//

0 commit comments

Comments
 (0)