Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions examples/jsm/renderers/common/RenderContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class RenderContext {
this.activeCubeFace = 0;
this.sampleCount = 1;

this.width = 0;
this.height = 0;

}

}
Expand Down
13 changes: 10 additions & 3 deletions examples/jsm/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class WebGPUBackend extends Backend {
const device = this.device;
const occlusionQueryCount = renderContext.occlusionQueryCount;

let bufferHeight;
let occlusionQuerySet;

if ( occlusionQueryCount > 0 ) {
Expand Down Expand Up @@ -231,6 +232,9 @@ class WebGPUBackend extends Backend {

}

renderContext.height = Math.floor( textures[ 0 ].source.data.height );
renderContext.width = Math.floor( textures[ 0 ].source.data.width );

} else {

if ( antialias === true ) {
Expand All @@ -247,6 +251,9 @@ class WebGPUBackend extends Backend {

depthStencilAttachment.view = this._getDepthBufferGPU( renderContext ).createView();

renderContext.height = this.colorBuffer.height;
renderContext.width = this.colorBuffer.width;

}

if ( renderContext.textures !== null ) {
Expand Down Expand Up @@ -350,7 +357,7 @@ class WebGPUBackend extends Backend {

const { x, y, width, height } = renderContext.scissorValue;

currentPass.setScissorRect( x, y, width, height );
currentPass.setScissorRect( x, renderContext.height - height - y, width, height );

}

Expand Down Expand Up @@ -484,9 +491,9 @@ class WebGPUBackend extends Backend {
updateViewport( renderContext ) {

const { currentPass } = this.get( renderContext );
const { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue;
let { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue;

currentPass.setViewport( x, y, width, height, minDepth, maxDepth );
currentPass.setViewport( x, renderContext.height - height - y, width, height, minDepth, maxDepth );

}

Expand Down
4 changes: 2 additions & 2 deletions examples/webgpu_lines_fat.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@

renderer.setScissorTest( true );

renderer.setScissor( 20, window.innerHeight - insetHeight - 20, insetWidth, insetHeight );
renderer.setScissor( 20, 20, insetWidth, insetHeight );

renderer.setViewport( 20, window.innerHeight - insetHeight - 20, insetWidth, insetHeight );
renderer.setViewport( 20, 20, insetWidth, insetHeight );

camera2.position.copy( camera.position );
camera2.quaternion.copy( camera.quaternion );
Expand Down