You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
989 B
54 lines
989 B
import WebGPU from '../../capabilities/WebGPU.js';
|
|
|
|
import Renderer from '../common/Renderer.js';
|
|
import WebGLBackend from '../webgl/WebGLBackend.js';
|
|
import WebGPUBackend from './WebGPUBackend.js';
|
|
/*
|
|
const debugHandler = {
|
|
|
|
get: function ( target, name ) {
|
|
|
|
// Add |update
|
|
if ( /^(create|destroy)/.test( name ) ) console.log( 'WebGPUBackend.' + name );
|
|
|
|
return target[ name ];
|
|
|
|
}
|
|
|
|
};
|
|
*/
|
|
class WebGPURenderer extends Renderer {
|
|
|
|
constructor( parameters = {} ) {
|
|
|
|
let BackendClass;
|
|
|
|
if ( parameters.forceWebGL ) {
|
|
|
|
BackendClass = WebGLBackend;
|
|
|
|
} else if ( WebGPU.isAvailable() ) {
|
|
|
|
BackendClass = WebGPUBackend;
|
|
|
|
} else {
|
|
|
|
BackendClass = WebGLBackend;
|
|
|
|
console.warn( 'THREE.WebGPURenderer: WebGPU is not available, running under WebGL2 backend.' );
|
|
|
|
}
|
|
|
|
const backend = new BackendClass( parameters );
|
|
|
|
//super( new Proxy( backend, debugHandler ) );
|
|
super( backend, parameters );
|
|
|
|
this.isWebGPURenderer = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default WebGPURenderer;
|