From d2b97e3fb781c189d5f9cf306c47d40a61927597 Mon Sep 17 00:00:00 2001 From: Martin Valigursky Date: Fri, 13 Feb 2026 12:56:20 +0000 Subject: [PATCH] feat: expose WebGPU texture format tier capabilities Add GraphicsDevice capability flags for texture-format-tier1/tier2 and ensure tier1 is reported when tier2 is available, so feature checks are consistent with WebGPU capability tiers. Co-authored-by: Cursor --- src/platform/graphics/graphics-device.js | 18 ++++++++++++++++++ .../graphics/webgpu/webgpu-graphics-device.js | 1 + 2 files changed, 19 insertions(+) diff --git a/src/platform/graphics/graphics-device.js b/src/platform/graphics/graphics-device.js index 283dc5d5727..5a18ca1741c 100644 --- a/src/platform/graphics/graphics-device.js +++ b/src/platform/graphics/graphics-device.js @@ -359,6 +359,24 @@ class GraphicsDevice extends EventHandler { */ supportsClipDistances = false; + /** + * True if the device supports WebGPU texture format tier 1 capabilities. When enabled, a wider + * set of normalized texture formats can be used as render targets and storage textures. + * + * @type {boolean} + * @readonly + */ + supportsTextureFormatTier1 = false; + + /** + * True if the device supports WebGPU texture format tier 2 capabilities. This extends tier 1 + * and enables read-write storage access for selected texture formats. + * + * @type {boolean} + * @readonly + */ + supportsTextureFormatTier2 = false; + /** * True if the device supports primitive index in fragment shaders (WebGPU only). When * supported, fragment shaders can access the `pcPrimitiveIndex` built-in variable which diff --git a/src/platform/graphics/webgpu/webgpu-graphics-device.js b/src/platform/graphics/webgpu/webgpu-graphics-device.js index e05a6283289..8730ad4c93a 100644 --- a/src/platform/graphics/webgpu/webgpu-graphics-device.js +++ b/src/platform/graphics/webgpu/webgpu-graphics-device.js @@ -317,6 +317,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice { this.supportsClipDistances = requireFeature('clip-distances'); this.supportsTextureFormatTier1 = requireFeature('texture-format-tier1'); this.supportsTextureFormatTier2 = requireFeature('texture-format-tier2'); + this.supportsTextureFormatTier1 ||= this.supportsTextureFormatTier2; this.supportsPrimitiveIndex = requireFeature('primitive-index'); Debug.log(`WEBGPU features: ${requiredFeatures.join(', ')}`);