|
@@ -129,8 +129,39 @@ class WebGPURenderer {
|
|
|
const opaqueObjects = this._currentRenderList.opaque;
|
|
|
const transparentObjects = this._currentRenderList.transparent;
|
|
|
|
|
|
- if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera );
|
|
|
- if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera );
|
|
|
+ const device = this._device;
|
|
|
+ const cmdEncoder = device.createCommandEncoder( {} );
|
|
|
+ const passEncoder = cmdEncoder.beginRenderPass( this._renderPassDescriptor );
|
|
|
+
|
|
|
+ // global rasterization settings for all renderable objects
|
|
|
+
|
|
|
+ const vp = this._viewport;
|
|
|
+
|
|
|
+ if ( vp !== null ) {
|
|
|
+
|
|
|
+ const width = Math.floor( vp.width * this._pixelRatio );
|
|
|
+ const height = Math.floor( vp.height * this._pixelRatio );
|
|
|
+
|
|
|
+ passEncoder.setViewport( vp.x, vp.y, width, height, vp.minDepth, vp.maxDepth );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ const sc = this._scissor;
|
|
|
+
|
|
|
+ if ( sc !== null ) {
|
|
|
+
|
|
|
+ const width = Math.floor( sc.width * this._pixelRatio );
|
|
|
+ const height = Math.floor( sc.height * this._pixelRatio );
|
|
|
+
|
|
|
+ passEncoder.setScissorRect( sc.x, sc.y, width, height );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, passEncoder );
|
|
|
+ if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, passEncoder );
|
|
|
+
|
|
|
+ passEncoder.endPass();
|
|
|
+ device.defaultQueue.submit( [ cmdEncoder.finish() ] );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -472,36 +503,7 @@ class WebGPURenderer {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _renderObjects( renderList, camera ) {
|
|
|
-
|
|
|
- const device = this._device;
|
|
|
-
|
|
|
- const cmdEncoder = device.createCommandEncoder( {} );
|
|
|
- const passEncoder = cmdEncoder.beginRenderPass( this._renderPassDescriptor );
|
|
|
-
|
|
|
- // global rasterization settings for all renderable objects
|
|
|
-
|
|
|
- const vp = this._viewport;
|
|
|
-
|
|
|
- if ( vp !== null ) {
|
|
|
-
|
|
|
- const width = Math.floor( vp.width * this._pixelRatio );
|
|
|
- const height = Math.floor( vp.height * this._pixelRatio );
|
|
|
-
|
|
|
- passEncoder.setViewport( vp.x, vp.y, width, height, vp.minDepth, vp.maxDepth );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const sc = this._scissor;
|
|
|
-
|
|
|
- if ( sc !== null ) {
|
|
|
-
|
|
|
- const width = Math.floor( sc.width * this._pixelRatio );
|
|
|
- const height = Math.floor( sc.height * this._pixelRatio );
|
|
|
-
|
|
|
- passEncoder.setScissorRect( sc.x, sc.y, width, height );
|
|
|
-
|
|
|
- }
|
|
|
+ _renderObjects( renderList, camera, passEncoder ) {
|
|
|
|
|
|
// process renderable objects
|
|
|
|
|
@@ -521,9 +523,6 @@ class WebGPURenderer {
|
|
|
|
|
|
}
|
|
|
|
|
|
- passEncoder.endPass();
|
|
|
- device.defaultQueue.submit( [ cmdEncoder.finish() ] );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
_renderObject( object, passEncoder ) {
|