浏览代码

WebGPUTextures: Clarify descriptors.

Mugen87 4 年之前
父节点
当前提交
e22c4ff635
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      examples/jsm/renderers/webgpu/WebGPUTextures.js

+ 8 - 5
examples/jsm/renderers/webgpu/WebGPUTextures.js

@@ -290,7 +290,7 @@ class WebGPUTextures {
 		const format = this._getFormat( texture );
 		const needsMipmaps = this._needsMipmaps( texture );
 
-		let mipLevelCount;
+		let mipLevelCount = 1;
 		let usage = GPUTextureUsage.SAMPLED | GPUTextureUsage.COPY_DST;
 
 		if ( texture.isCompressedTexture ) {
@@ -319,9 +319,10 @@ class WebGPUTextures {
 				height: height,
 				depth: 1,
 			},
+			mipLevelCount: mipLevelCount,
+			sampleCount: 1,
 			format: format,
-			usage: usage,
-			mipLevelCount: mipLevelCount
+			usage: usage
 		};
 		const textureGPU = device.createTexture( textureGPUDescriptor );
 
@@ -389,7 +390,8 @@ class WebGPUTextures {
 
 		this.device.defaultQueue.writeTexture(
 			{
-				texture: textureGPU
+				texture: textureGPU,
+				mipLevel: 0
 			},
 			data,
 			{
@@ -410,7 +412,8 @@ class WebGPUTextures {
 			{
 				imageBitmap: image
 			}, {
-				texture: textureGPU
+				texture: textureGPU,
+				mipLevel: 0
 			}, {
 				width: image.width,
 				height: image.height,