Skip to content

Commit

Permalink
WebGPURenderer: Make sure default instance of CompressedTexture wor…
Browse files Browse the repository at this point in the history
…ks. (#29788)
  • Loading branch information
Mugen87 authored Nov 2, 2024
1 parent f692cfb commit 8b0c9ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/renderers/common/Textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {

Expand Down
4 changes: 4 additions & 0 deletions src/renderers/webgpu/utils/WebGPUTextureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 8b0c9ac

Please sign in to comment.