Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Use renderAsync() as fallback #27894

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Changes from all 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
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