Skip to content

Commit

Permalink
WebGPURenderer: Use renderAsync() as fallback (#27894)
Browse files Browse the repository at this point in the history
* WebGPURenderer: Use renderAsync() as fallback

* WebGPURenderer: Use clearAsync() as fallback
  • Loading branch information
sunag authored Mar 10, 2024
1 parent 22a285a commit b077de1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions examples/jsm/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class Renderer {

if ( this._initialized === false ) await this.init();

const renderContext = this._renderContext( scene, camera );
const renderContext = this._renderScene( scene, camera );

await this.backend.resolveTimestampAsync( renderContext, 'render' );

Expand All @@ -322,16 +322,17 @@ class Renderer {

if ( this._initialized === false ) {

console.error( 'THREE.Renderer: .render() called before the backend is initialized. Try using .renderAsync() instead.' );
return;
console.warn( 'THREE.Renderer: .render() called before the backend is initialized. Try using .renderAsync() instead.' );

return this.renderAsync( scene, camera );

}

this._renderContext( scene, camera );
this._renderScene( scene, camera );

}

_renderContext( scene, camera ) {
_renderScene( scene, camera ) {

// preserve render tree

Expand Down Expand Up @@ -761,6 +762,14 @@ class Renderer {

clear( color = true, depth = true, stencil = true ) {

if ( this._initialized === false ) {

console.warn( 'THREE.Renderer: .clear() called before the backend is initialized. Try using .clearAsync() instead.' );

return this.clearAsync( color, depth, stencil );

}

let renderTargetData = null;
const renderTarget = this._renderTarget;

Expand Down

0 comments on commit b077de1

Please sign in to comment.