1
0
Эх сурвалжийг харах

WebGPURenderer: Make sure default instance of `CompressedTexture` works. (#29788)

Michael Herzog 1 жил өмнө
parent
commit
8b0c9acaef

+ 11 - 3
src/renderers/common/Textures.js

@@ -300,8 +300,8 @@ class Textures extends DataMap {
 
 			if ( image.image !== undefined ) image = image.image;
 
-			target.width = image.width;
-			target.height = image.height;
+			target.width = image.width || 1;
+			target.height = image.height || 1;
 			target.depth = texture.isCubeTexture ? 6 : ( image.depth || 1 );
 
 		} else {
@@ -320,7 +320,15 @@ class Textures extends DataMap {
 
 		if ( texture.isCompressedTexture ) {
 
-			mipLevelCount = texture.mipmaps.length;
+			if ( texture.mipmaps ) {
+
+				mipLevelCount = texture.mipmaps.length;
+
+			} else {
+
+				mipLevelCount = 1;
+
+			}
 
 		} else {
 

+ 4 - 0
src/renderers/webgpu/utils/WebGPUTextureUtils.js

@@ -952,6 +952,10 @@ export function getFormat( texture, device = null ) {
 				formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC12x12UnormSRGB : GPUTextureFormat.ASTC12x12Unorm;
 				break;
 
+			case RGBAFormat:
+				formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.RGBA8UnormSRGB : GPUTextureFormat.RGBA8Unorm;
+				break;
+
 			default:
 				console.error( 'WebGPURenderer: Unsupported texture format.', format );
 

粤ICP备19079148号