Skip to content

Commit

Permalink
WebGPURenderer: WebGL fallback - fix scissor with MSAA (#29148)
Browse files Browse the repository at this point in the history
* scissor msaa resolve and invalidation

* update screenshot

* exclude screenshot from tests

---------

Co-authored-by: aardgoose <[email protected]>
  • Loading branch information
aardgoose and aardgoose authored Aug 16, 2024
1 parent 17d60f6 commit 769a82d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Binary file modified examples/screenshots/webgpu_textures_anisotropy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/webgpu_textures_anisotropy.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
renderer.setScissor( SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT );
renderer.render( scene2, camera );

// renderer.setScissorTest( false );
renderer.setScissorTest( false );

}

Expand Down
15 changes: 13 additions & 2 deletions src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,20 @@ class WebGLBackend extends Backend {

// TODO Add support for MRT

gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
if ( renderContext.scissor ) {

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

gl.blitFramebuffer( x, y, x + width, y + height, x, y, x + width, y + height, mask, gl.NEAREST );
gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, y, width, height );

} else {

gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );

}

gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );

}

Expand Down
1 change: 1 addition & 0 deletions test/e2e/puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const exceptionList = [
'webgpu_tsl_vfx_flames',
'webgpu_tsl_halftone',
'webgpu_tsl_vfx_tornado',
'webgpu_textures_anisotropy',

// WebGPU idleTime and parseTime too low
'webgpu_compute_particles',
Expand Down

0 comments on commit 769a82d

Please sign in to comment.