diff --git a/src/platform/graphics/graphics-device.js b/src/platform/graphics/graphics-device.js index 0977649dbc6..41aefc192e8 100644 --- a/src/platform/graphics/graphics-device.js +++ b/src/platform/graphics/graphics-device.js @@ -271,6 +271,14 @@ class GraphicsDevice extends EventHandler { */ textureHalfFloatRenderable; + /** + * True if filtering can be applied when sampling float textures. + * + * @type {boolean} + * @readonly + */ + textureFloatFilterable = true; + /** * A vertex buffer representing a quad. * diff --git a/src/platform/graphics/webgpu/webgpu-graphics-device.js b/src/platform/graphics/webgpu/webgpu-graphics-device.js index b0c858c6b52..407138b60b6 100644 --- a/src/platform/graphics/webgpu/webgpu-graphics-device.js +++ b/src/platform/graphics/webgpu/webgpu-graphics-device.js @@ -147,7 +147,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice { this.supportsImageBitmap = true; this.extStandardDerivatives = true; this.extBlendMinmax = true; - this.areaLightLutFormat = this.floatFilterable ? PIXELFORMAT_RGBA32F : PIXELFORMAT_RGBA8; + this.areaLightLutFormat = this.textureFloatFilterable ? PIXELFORMAT_RGBA32F : PIXELFORMAT_RGBA8; this.supportsTextureFetch = true; // WebGPU currently only supports 1 and 4 samples @@ -215,7 +215,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice { } return supported; }; - this.floatFilterable = requireFeature('float32-filterable'); + this.textureFloatFilterable = requireFeature('float32-filterable'); this.extCompressedTextureS3TC = requireFeature('texture-compression-bc'); this.extCompressedTextureETC = requireFeature('texture-compression-etc2'); this.extCompressedTextureASTC = requireFeature('texture-compression-astc'); diff --git a/src/scene/light.js b/src/scene/light.js index ceeba907105..c41d402d104 100644 --- a/src/scene/light.js +++ b/src/scene/light.js @@ -363,10 +363,12 @@ class Light { value = SHADOW_PCF3; // fallback from HW PCF to old PCF } - if (value === SHADOW_VSM32 && !device.textureFloatRenderable) // fallback from vsm32 to vsm16 + // fallback from vsm32 to vsm16 + if (value === SHADOW_VSM32 && (!device.textureFloatRenderable || !device.textureFloatFilterable)) value = SHADOW_VSM16; - if (value === SHADOW_VSM16 && !device.textureHalfFloatRenderable) // fallback from vsm16 to vsm8 + // fallback from vsm16 to vsm8 + if (value === SHADOW_VSM16 && !device.textureHalfFloatRenderable) value = SHADOW_VSM8; this._isVsm = value >= SHADOW_VSM8 && value <= SHADOW_VSM32;