WebGPURenderer.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. import { GPUIndexFormat, GPUTextureFormat, GPUStoreOp } from './constants.js';
  2. import WebGPUObjects from './WebGPUObjects.js';
  3. import WebGPUAttributes from './WebGPUAttributes.js';
  4. import WebGPUGeometries from './WebGPUGeometries.js';
  5. import WebGPUInfo from './WebGPUInfo.js';
  6. import WebGPUProperties from './WebGPUProperties.js';
  7. import WebGPURenderPipelines from './WebGPURenderPipelines.js';
  8. import WebGPUComputePipelines from './WebGPUComputePipelines.js';
  9. import WebGPUBindings from './WebGPUBindings.js';
  10. import WebGPURenderLists from './WebGPURenderLists.js';
  11. import WebGPUTextures from './WebGPUTextures.js';
  12. import WebGPUBackground from './WebGPUBackground.js';
  13. import { Frustum, Matrix4, Vector3, Color } from '../../../../build/three.module.js';
  14. console.info( 'THREE.WebGPURenderer: Modified Matrix4.makePerspective() and Matrix4.makeOrtographic() to work with WebGPU, see https://github.com/mrdoob/three.js/issues/20276.' );
  15. Matrix4.prototype.makePerspective = function ( left, right, top, bottom, near, far ) {
  16. const te = this.elements;
  17. const x = 2 * near / ( right - left );
  18. const y = 2 * near / ( top - bottom );
  19. const a = ( right + left ) / ( right - left );
  20. const b = ( top + bottom ) / ( top - bottom );
  21. const c = - far / ( far - near );
  22. const d = - far * near / ( far - near );
  23. te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
  24. te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
  25. te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
  26. te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
  27. return this;
  28. };
  29. Matrix4.prototype.makeOrthographic = function ( left, right, top, bottom, near, far ) {
  30. const te = this.elements;
  31. const w = 1.0 / ( right - left );
  32. const h = 1.0 / ( top - bottom );
  33. const p = 1.0 / ( far - near );
  34. const x = ( right + left ) * w;
  35. const y = ( top + bottom ) * h;
  36. const z = near * p;
  37. te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
  38. te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
  39. te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = - 1 * p; te[ 14 ] = - z;
  40. te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
  41. return this;
  42. };
  43. const _frustum = new Frustum();
  44. const _projScreenMatrix = new Matrix4();
  45. const _vector3 = new Vector3();
  46. class WebGPURenderer {
  47. constructor( parameters = {} ) {
  48. // public
  49. this.domElement = ( parameters.canvas !== undefined ) ? parameters.canvas : document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
  50. this.autoClear = true;
  51. this.autoClearColor = true;
  52. this.autoClearDepth = true;
  53. this.autoClearStencil = true;
  54. this.sortObjects = true;
  55. // internals
  56. this._parameters = Object.assign( {}, parameters );
  57. this._pixelRatio = 1;
  58. this._width = this.domElement.width;
  59. this._height = this.domElement.height;
  60. this._viewport = null;
  61. this._scissor = null;
  62. this._adapter = null;
  63. this._device = null;
  64. this._context = null;
  65. this._swapChain = null;
  66. this._colorBuffer = null;
  67. this._depthBuffer = null;
  68. this._info = null;
  69. this._properties = null;
  70. this._attributes = null;
  71. this._geometries = null;
  72. this._bindings = null;
  73. this._objects = null;
  74. this._renderPipelines = null;
  75. this._computePipelines = null;
  76. this._renderLists = null;
  77. this._textures = null;
  78. this._background = null;
  79. this._renderPassDescriptor = null;
  80. this._currentRenderList = null;
  81. this._opaqueSort = null;
  82. this._transparentSort = null;
  83. this._clearAlpha = 1;
  84. this._clearColor = new Color( 0x000000 );
  85. this._clearDepth = 1;
  86. this._clearStencil = 0;
  87. this._renderTarget = null;
  88. // some parameters require default values other than "undefined"
  89. this._parameters.antialias = ( parameters.antialias === true );
  90. if ( this._parameters.antialias === true ) {
  91. this._parameters.sampleCount = ( parameters.sampleCount === undefined ) ? 4 : parameters.sampleCount;
  92. } else {
  93. this._parameters.sampleCount = 1;
  94. }
  95. this._parameters.extensions = ( parameters.extensions === undefined ) ? [] : parameters.extensions;
  96. this._parameters.limits = ( parameters.limits === undefined ) ? {} : parameters.limits;
  97. }
  98. async init() {
  99. const parameters = this._parameters;
  100. const adapterOptions = {
  101. powerPreference: parameters.powerPreference
  102. };
  103. const adapter = await navigator.gpu.requestAdapter( adapterOptions );
  104. const deviceDescriptor = {
  105. extensions: parameters.extensions,
  106. limits: parameters.limits
  107. };
  108. const device = await adapter.requestDevice( deviceDescriptor );
  109. const glslang = await import( 'https://cdn.jsdelivr.net/npm/@webgpu/[email protected]/dist/web-devel/glslang.js' );
  110. const compiler = await glslang.default();
  111. const context = ( parameters.context !== undefined ) ? parameters.context : this.domElement.getContext( 'gpupresent' );
  112. const swapChain = context.configureSwapChain( {
  113. device: device,
  114. format: GPUTextureFormat.BRGA8Unorm // this is the only valid swap chain format right now (r121)
  115. } );
  116. this._adapter = adapter;
  117. this._device = device;
  118. this._context = context;
  119. this._swapChain = swapChain;
  120. this._info = new WebGPUInfo();
  121. this._properties = new WebGPUProperties();
  122. this._attributes = new WebGPUAttributes( device );
  123. this._geometries = new WebGPUGeometries( this._attributes, this._info );
  124. this._textures = new WebGPUTextures( device, this._properties, this._info, compiler );
  125. this._objects = new WebGPUObjects( this._geometries, this._info );
  126. this._renderPipelines = new WebGPURenderPipelines( this, this._properties, device, compiler, parameters.sampleCount );
  127. this._computePipelines = new WebGPUComputePipelines( device, compiler );
  128. this._bindings = new WebGPUBindings( device, this._info, this._properties, this._textures, this._renderPipelines, this._computePipelines, this._attributes );
  129. this._renderLists = new WebGPURenderLists();
  130. this._background = new WebGPUBackground( this );
  131. //
  132. this._renderPassDescriptor = {
  133. colorAttachments: [ {
  134. attachment: null
  135. } ],
  136. depthStencilAttachment: {
  137. attachment: null,
  138. depthStoreOp: GPUStoreOp.Store,
  139. stencilStoreOp: GPUStoreOp.Store
  140. }
  141. };
  142. this._setupColorBuffer();
  143. this._setupDepthBuffer();
  144. }
  145. render( scene, camera ) {
  146. if ( scene.autoUpdate === true ) scene.updateMatrixWorld();
  147. if ( camera.parent === null ) camera.updateMatrixWorld();
  148. if ( this._info.autoReset === true ) this._info.reset();
  149. _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
  150. _frustum.setFromProjectionMatrix( _projScreenMatrix );
  151. this._currentRenderList = this._renderLists.get( scene, camera );
  152. this._currentRenderList.init();
  153. this._projectObject( scene, camera, 0 );
  154. this._currentRenderList.finish();
  155. if ( this.sortObjects === true ) {
  156. this._currentRenderList.sort( this._opaqueSort, this._transparentSort );
  157. }
  158. // prepare render pass descriptor
  159. const colorAttachment = this._renderPassDescriptor.colorAttachments[ 0 ];
  160. const depthStencilAttachment = this._renderPassDescriptor.depthStencilAttachment;
  161. const renderTarget = this._renderTarget;
  162. if ( renderTarget !== null ) {
  163. // @TODO: Support RenderTarget with antialiasing.
  164. const renderTargetProperties = this._properties.get( renderTarget );
  165. colorAttachment.attachment = renderTargetProperties.colorTextureGPU.createView();
  166. depthStencilAttachment.attachment = renderTargetProperties.depthTextureGPU.createView();
  167. } else {
  168. if ( this._parameters.antialias === true ) {
  169. colorAttachment.attachment = this._colorBuffer.createView();
  170. colorAttachment.resolveTarget = this._swapChain.getCurrentTexture().createView();
  171. } else {
  172. colorAttachment.attachment = this._swapChain.getCurrentTexture().createView();
  173. colorAttachment.resolveTarget = undefined;
  174. }
  175. depthStencilAttachment.attachment = this._depthBuffer.createView();
  176. }
  177. //
  178. this._background.update( scene );
  179. // start render pass
  180. const device = this._device;
  181. const cmdEncoder = device.createCommandEncoder( {} );
  182. const passEncoder = cmdEncoder.beginRenderPass( this._renderPassDescriptor );
  183. // global rasterization settings for all renderable objects
  184. const vp = this._viewport;
  185. if ( vp !== null ) {
  186. const width = Math.floor( vp.width * this._pixelRatio );
  187. const height = Math.floor( vp.height * this._pixelRatio );
  188. passEncoder.setViewport( vp.x, vp.y, width, height, vp.minDepth, vp.maxDepth );
  189. }
  190. const sc = this._scissor;
  191. if ( sc !== null ) {
  192. const width = Math.floor( sc.width * this._pixelRatio );
  193. const height = Math.floor( sc.height * this._pixelRatio );
  194. passEncoder.setScissorRect( sc.x, sc.y, width, height );
  195. }
  196. // process render lists
  197. const opaqueObjects = this._currentRenderList.opaque;
  198. const transparentObjects = this._currentRenderList.transparent;
  199. if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, passEncoder );
  200. if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, passEncoder );
  201. // finish render pass
  202. passEncoder.endPass();
  203. device.defaultQueue.submit( [ cmdEncoder.finish() ] );
  204. }
  205. getContext() {
  206. return this._context;
  207. }
  208. getPixelRatio() {
  209. return this._pixelRatio;
  210. }
  211. getDrawingBufferSize( target ) {
  212. return target.set( this._width * this._pixelRatio, this._height * this._pixelRatio ).floor();
  213. }
  214. getSize( target ) {
  215. return target.set( this._width, this._height );
  216. }
  217. setPixelRatio( value = 1 ) {
  218. this._pixelRatio = value;
  219. this.setSize( this._width, this._height, false );
  220. }
  221. setDrawingBufferSize( width, height, pixelRatio ) {
  222. this._width = width;
  223. this._height = height;
  224. this._pixelRatio = pixelRatio;
  225. this.domElement.width = Math.floor( width * pixelRatio );
  226. this.domElement.height = Math.floor( height * pixelRatio );
  227. this._setupColorBuffer();
  228. this._setupDepthBuffer();
  229. }
  230. setSize( width, height, updateStyle = true ) {
  231. this._width = width;
  232. this._height = height;
  233. this.domElement.width = Math.floor( width * this._pixelRatio );
  234. this.domElement.height = Math.floor( height * this._pixelRatio );
  235. if ( updateStyle === true ) {
  236. this.domElement.style.width = width + 'px';
  237. this.domElement.style.height = height + 'px';
  238. }
  239. this._setupColorBuffer();
  240. this._setupDepthBuffer();
  241. }
  242. setOpaqueSort( method ) {
  243. this._opaqueSort = method;
  244. }
  245. setTransparentSort( method ) {
  246. this._transparentSort = method;
  247. }
  248. getScissor( target ) {
  249. const scissor = this._scissor;
  250. target.x = scissor.x;
  251. target.y = scissor.y;
  252. target.width = scissor.width;
  253. target.height = scissor.height;
  254. return target;
  255. }
  256. setScissor( x, y, width, height ) {
  257. if ( x === null ) {
  258. this._scissor = null;
  259. } else {
  260. this._scissor = {
  261. x: x,
  262. y: y,
  263. width: width,
  264. height: height
  265. };
  266. }
  267. }
  268. getViewport( target ) {
  269. const viewport = this._viewport;
  270. target.x = viewport.x;
  271. target.y = viewport.y;
  272. target.width = viewport.width;
  273. target.height = viewport.height;
  274. target.minDepth = viewport.minDepth;
  275. target.maxDepth = viewport.maxDepth;
  276. return target;
  277. }
  278. setViewport( x, y, width, height, minDepth = 0, maxDepth = 1 ) {
  279. if ( x === null ) {
  280. this._viewport = null;
  281. } else {
  282. this._viewport = {
  283. x: x,
  284. y: y,
  285. width: width,
  286. height: height,
  287. minDepth: minDepth,
  288. maxDepth: maxDepth
  289. };
  290. }
  291. }
  292. getClearColor() {
  293. return this._clearColor;
  294. }
  295. setClearColor( color, alpha = 1 ) {
  296. this._clearColor.set( color );
  297. this._clearAlpha = alpha;
  298. }
  299. getClearAlpha() {
  300. return this._clearAlpha;
  301. }
  302. setClearAlpha( alpha ) {
  303. this._clearAlpha = alpha;
  304. }
  305. getClearDepth() {
  306. return this._clearDepth;
  307. }
  308. setClearDepth( depth ) {
  309. this._clearDepth = depth;
  310. }
  311. getClearStencil() {
  312. return this._clearStencil;
  313. }
  314. setClearStencil( stencil ) {
  315. this._clearStencil = stencil;
  316. }
  317. clear() {
  318. this._background.clear();
  319. }
  320. dispose() {
  321. this._objects.dispose();
  322. this._properties.dispose();
  323. this._renderPipelines.dispose();
  324. this._computePipelines.dispose();
  325. this._bindings.dispose();
  326. this._info.dispose();
  327. this._renderLists.dispose();
  328. this._textures.dispose();
  329. }
  330. setRenderTarget( renderTarget ) {
  331. this._renderTarget = renderTarget;
  332. if ( renderTarget !== null ) {
  333. this._textures.initRenderTarget( renderTarget );
  334. }
  335. }
  336. compute( computeParams ) {
  337. const device = this._device;
  338. const cmdEncoder = device.createCommandEncoder( {} );
  339. const passEncoder = cmdEncoder.beginComputePass();
  340. for ( const param of computeParams ) {
  341. // pipeline
  342. const pipeline = this._computePipelines.get( param );
  343. passEncoder.setPipeline( pipeline );
  344. // bind group
  345. const bindGroup = this._bindings.getForCompute( param ).group;
  346. this._bindings.update( param );
  347. passEncoder.setBindGroup( 0, bindGroup );
  348. passEncoder.dispatch( param.num );
  349. }
  350. passEncoder.endPass();
  351. device.defaultQueue.submit( [ cmdEncoder.finish() ] );
  352. }
  353. getRenderTarget() {
  354. return this._renderTarget;
  355. }
  356. _projectObject( object, camera, groupOrder ) {
  357. const info = this._info;
  358. const currentRenderList = this._currentRenderList;
  359. if ( object.visible === false ) return;
  360. const visible = object.layers.test( camera.layers );
  361. if ( visible ) {
  362. if ( object.isGroup ) {
  363. groupOrder = object.renderOrder;
  364. } else if ( object.isLOD ) {
  365. if ( object.autoUpdate === true ) object.update( camera );
  366. } else if ( object.isLight ) {
  367. //currentRenderState.pushLight( object );
  368. if ( object.castShadow ) {
  369. //currentRenderState.pushShadow( object );
  370. }
  371. } else if ( object.isSprite ) {
  372. if ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {
  373. if ( this.sortObjects === true ) {
  374. _vector3.setFromMatrixPosition( object.matrixWorld ).applyMatrix4( _projScreenMatrix );
  375. }
  376. const geometry = object.geometry;
  377. const material = object.material;
  378. if ( material.visible ) {
  379. currentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );
  380. }
  381. }
  382. } else if ( object.isMesh || object.isLine || object.isPoints ) {
  383. if ( object.isSkinnedMesh ) {
  384. // update skeleton only once in a frame
  385. if ( object.skeleton.frame !== info.render.frame ) {
  386. object.skeleton.update();
  387. object.skeleton.frame = info.render.frame;
  388. }
  389. }
  390. if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {
  391. if ( this.sortObjects === true ) {
  392. _vector3.setFromMatrixPosition( object.matrixWorld ).applyMatrix4( _projScreenMatrix );
  393. }
  394. const geometry = object.geometry;
  395. const material = object.material;
  396. if ( Array.isArray( material ) ) {
  397. const groups = geometry.groups;
  398. for ( let i = 0, l = groups.length; i < l; i ++ ) {
  399. const group = groups[ i ];
  400. const groupMaterial = material[ group.materialIndex ];
  401. if ( groupMaterial && groupMaterial.visible ) {
  402. currentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );
  403. }
  404. }
  405. } else if ( material.visible ) {
  406. currentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );
  407. }
  408. }
  409. }
  410. }
  411. const children = object.children;
  412. for ( let i = 0, l = children.length; i < l; i ++ ) {
  413. this._projectObject( children[ i ], camera, groupOrder );
  414. }
  415. }
  416. _renderObjects( renderList, camera, passEncoder ) {
  417. // process renderable objects
  418. for ( let i = 0, il = renderList.length; i < il; i ++ ) {
  419. const renderItem = renderList[ i ];
  420. const object = renderItem.object;
  421. object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
  422. object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
  423. this._objects.update( object );
  424. if ( camera.isArrayCamera ) {
  425. const cameras = camera.cameras;
  426. for ( let j = 0, jl = cameras.length; j < jl; j ++ ) {
  427. const camera2 = cameras[ j ];
  428. if ( object.layers.test( camera2.layers ) ) {
  429. const vp = camera2.viewport;
  430. const minDepth = ( vp.minDepth === undefined ) ? 0 : vp.minDepth;
  431. const maxDepth = ( vp.maxDepth === undefined ) ? 1 : vp.maxDepth;
  432. passEncoder.setViewport( vp.x, vp.y, vp.width, vp.height, minDepth, maxDepth );
  433. this._bindings.update( object, camera2 );
  434. this._renderObject( object, passEncoder );
  435. }
  436. }
  437. } else {
  438. this._bindings.update( object, camera );
  439. this._renderObject( object, passEncoder );
  440. }
  441. }
  442. }
  443. _renderObject( object, passEncoder ) {
  444. const info = this._info;
  445. // pipeline
  446. const pipeline = this._renderPipelines.get( object );
  447. passEncoder.setPipeline( pipeline );
  448. // bind group
  449. const bindGroup = this._bindings.get( object ).group;
  450. passEncoder.setBindGroup( 0, bindGroup );
  451. // index
  452. const geometry = object.geometry;
  453. const index = geometry.index;
  454. const hasIndex = ( index !== null );
  455. if ( hasIndex === true ) {
  456. this._setupIndexBuffer( index, passEncoder );
  457. }
  458. // vertex buffers
  459. this._setupVertexBuffers( geometry.attributes, passEncoder, pipeline );
  460. // draw
  461. const drawRange = geometry.drawRange;
  462. const firstVertex = drawRange.start;
  463. if ( hasIndex === true ) {
  464. const indexCount = ( drawRange.count !== Infinity ) ? drawRange.count : index.count;
  465. passEncoder.drawIndexed( indexCount, 1, firstVertex, 0, 0 );
  466. info.update( object, indexCount );
  467. } else {
  468. const positionAttribute = geometry.attributes.position;
  469. const vertexCount = ( drawRange.count !== Infinity ) ? drawRange.count : positionAttribute.count;
  470. passEncoder.draw( vertexCount, 1, firstVertex, 0 );
  471. info.update( object, vertexCount );
  472. }
  473. }
  474. _setupIndexBuffer( index, encoder ) {
  475. const buffer = this._attributes.get( index ).buffer;
  476. const indexFormat = ( index.array instanceof Uint16Array ) ? GPUIndexFormat.Uint16 : GPUIndexFormat.Uint32;
  477. encoder.setIndexBuffer( buffer, indexFormat );
  478. }
  479. _setupVertexBuffers( geometryAttributes, encoder, pipeline ) {
  480. const shaderAttributes = this._renderPipelines.getShaderAttributes( pipeline );
  481. for ( const shaderAttribute of shaderAttributes ) {
  482. const name = shaderAttribute.name;
  483. const slot = shaderAttribute.slot;
  484. const attribute = geometryAttributes[ name ];
  485. if ( attribute !== undefined ) {
  486. const buffer = this._attributes.get( attribute ).buffer;
  487. encoder.setVertexBuffer( slot, buffer );
  488. }
  489. }
  490. }
  491. _setupColorBuffer() {
  492. const device = this._device;
  493. if ( device ) {
  494. if ( this._colorBuffer ) this._colorBuffer.destroy();
  495. this._colorBuffer = this._device.createTexture( {
  496. size: {
  497. width: this._width * this._pixelRatio,
  498. height: this._height * this._pixelRatio,
  499. depth: 1
  500. },
  501. sampleCount: this._parameters.sampleCount,
  502. format: GPUTextureFormat.BRGA8Unorm,
  503. usage: GPUTextureUsage.OUTPUT_ATTACHMENT
  504. } );
  505. }
  506. }
  507. _setupDepthBuffer() {
  508. const device = this._device;
  509. if ( device ) {
  510. if ( this._depthBuffer ) this._depthBuffer.destroy();
  511. this._depthBuffer = this._device.createTexture( {
  512. size: {
  513. width: this._width * this._pixelRatio,
  514. height: this._height * this._pixelRatio,
  515. depth: 1
  516. },
  517. sampleCount: this._parameters.sampleCount,
  518. format: GPUTextureFormat.Depth24PlusStencil8,
  519. usage: GPUTextureUsage.OUTPUT_ATTACHMENT
  520. } );
  521. }
  522. }
  523. }
  524. export default WebGPURenderer;