Skip to content

Commit

Permalink
WebGPURenderer: Not crash if texture is not supported (#26423)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Jul 14, 2023
1 parent 8160b0a commit e47e4c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ class WebGPUTextureUtils {

} else {

if ( format === undefined ) {

console.warn( 'WebGPURenderer: Texture format not supported.' );

return this.createDefaultTexture( texture );

}

textureData.texture = backend.device.createTexture( textureDescriptorGPU );

}
Expand Down Expand Up @@ -201,6 +209,9 @@ class WebGPUTextureUtils {

const { needsMipmaps, textureDescriptorGPU } = textureData;

if ( textureDescriptorGPU === undefined ) // unsupported texture format
return;

// transfer texture data

if ( texture.isDataTexture || texture.isDataArrayTexture || texture.isData3DTexture ) {
Expand Down

0 comments on commit e47e4c6

Please sign in to comment.