Skip to content

fix: round up compressed texture dimensions to block size on WebGPU#8540

Merged
mvaligursky merged 1 commit intomainfrom
mv-compressed-texture-block-align
Mar 20, 2026
Merged

fix: round up compressed texture dimensions to block size on WebGPU#8540
mvaligursky merged 1 commit intomainfrom
mv-compressed-texture-block-align

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

@mvaligursky mvaligursky commented Mar 20, 2026

WebGPU requires compressed texture dimensions to be multiples of the block size (4x4 for BC, ETC2, ASTC 4x4). Textures with smaller dimensions (e.g. 2x2) cause a GPU validation error and crash, particularly on iOS/Safari. This is not an issue on WebGL which handles sub-block sizes internally.

Changes:

  • Detect compressed textures with non-block-aligned dimensions in the WebGPU backend and round up to the nearest multiple of 4
  • Log a Debug.error explaining the issue and the automatic fix
  • Prevents GPU crash while accepting minor rendering artifacts at those tiny sizes

Related to: https://forum.playcanvas.com/t/webgpu-fails-on-ios-safari/42070

WebGPU requires compressed texture dimensions to be multiples of the
block size (4 for BC, ETC2, ASTC 4x4). Textures with non-aligned
dimensions (e.g. 2x2) cause a GPU validation error and crash,
particularly on iOS/Safari. Round up dimensions automatically and
log a Debug.error to inform the developer.

Made-with: Cursor
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a WebGPU validation/crash issue by ensuring GPU texture creation complies with WebGPU’s requirement that compressed texture dimensions be block-aligned (4x4 for the currently supported compressed formats).

Changes:

  • Detects WebGPU compressed textures whose dimensions are not multiples of 4 and rounds them up.
  • Emits a Debug.error describing the issue and the auto-fix being applied.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/platform/graphics/webgpu/webgpu-texture.js
@mvaligursky mvaligursky merged commit 235449d into main Mar 20, 2026
12 checks passed
@mvaligursky mvaligursky deleted the mv-compressed-texture-block-align branch March 20, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants