未验证 提交 c97a3e55 编写于 作者: M Michael Herzog 提交者: GitHub

WebGPURenderer: Fix broken resize. (#22128)

上级 8b00c0f5
......@@ -360,6 +360,7 @@ class WebGPURenderer {
this.domElement.width = Math.floor( width * pixelRatio );
this.domElement.height = Math.floor( height * pixelRatio );
this._configureContext();
this._setupColorBuffer();
this._setupDepthBuffer();
......@@ -380,6 +381,7 @@ class WebGPURenderer {
}
this._configureContext();
this._setupColorBuffer();
this._setupDepthBuffer();
......@@ -901,8 +903,8 @@ class WebGPURenderer {
this._colorBuffer = this._device.createTexture( {
size: {
width: this._width * this._pixelRatio,
height: this._height * this._pixelRatio,
width: Math.floor( this._width * this._pixelRatio ),
height: Math.floor( this._height * this._pixelRatio ),
depthOrArrayLayers: 1
},
sampleCount: this._parameters.sampleCount,
......@@ -924,8 +926,8 @@ class WebGPURenderer {
this._depthBuffer = this._device.createTexture( {
size: {
width: this._width * this._pixelRatio,
height: this._height * this._pixelRatio,
width: Math.floor( this._width * this._pixelRatio ),
height: Math.floor( this._height * this._pixelRatio ),
depthOrArrayLayers: 1
},
sampleCount: this._parameters.sampleCount,
......@@ -937,6 +939,27 @@ class WebGPURenderer {
}
_configureContext() {
const device = this._device;
if ( device ) {
this._context.configure( {
device: device,
format: GPUTextureFormat.BRGA8Unorm,
usage: GPUTextureUsage.RENDER_ATTACHMENT,
size: {
width: Math.floor( this._width * this._pixelRatio ),
height: Math.floor( this._height * this._pixelRatio ),
depthOrArrayLayers: 1
},
} );
}
}
_createCanvasElement() {
const canvas = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'canvas' );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册