Переглянути джерело

WebGPUTextures: Prepare 2DArray and 3D texture support.

Mugen87 4 роки тому
батько
коміт
66b9fa344c

+ 29 - 1
examples/jsm/renderers/webgpu/WebGPUSampledTexture.js

@@ -21,6 +21,34 @@ class WebGPUSampledTexture extends WebGPUBinding {
 
 }
 
+class WebGPUSampledArrayTexture extends WebGPUSampledTexture {
+
+	constructor( name ) {
+
+		super( name );
+
+		this.dimension = GPUTextureViewDimension.TwoDArray;
+
+		Object.defineProperty( this, 'isSampledArrayTexture', { value: true } );
+
+	}
+
+}
+
+class WebGPUSampled3DTexture extends WebGPUSampledTexture {
+
+	constructor( name ) {
+
+		super( name );
+
+		this.dimension = GPUTextureViewDimension.ThreeD;
+
+		Object.defineProperty( this, 'isSampled3DTexture', { value: true } );
+
+	}
+
+}
+
 class WebGPUSampledCubeTexture extends WebGPUSampledTexture {
 
 	constructor( name ) {
@@ -35,4 +63,4 @@ class WebGPUSampledCubeTexture extends WebGPUSampledTexture {
 
 }
 
-export { WebGPUSampledTexture, WebGPUSampledCubeTexture };
+export { WebGPUSampledTexture, WebGPUSampledArrayTexture, WebGPUSampled3DTexture, WebGPUSampledCubeTexture };

+ 1 - 1
examples/jsm/renderers/webgpu/WebGPUTextures.js

@@ -344,7 +344,7 @@ class WebGPUTextures {
 
 		// transfer texture data
 
-		if ( texture.isDataTexture ) {
+		if ( texture.isDataTexture || texture.isDataTexture2DArray || texture.isDataTexture3D ) {
 
 			this._copyBufferToTexture( image, format, textureGPU );