Repository navigation
fix(webgpu): Let image sampling use the mip chain - #25584
Conversation
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 240241 found UI Test snapshots differences: Details
|
|
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 240354 found UI Test snapshots differences: Details
|
8ddb343 to
b23959b
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241275 found UI Test snapshots differences: Details
|
|
|
The image sampler was built from a zero-initialised descriptor that never set LodMaxClamp, so it clamped every lookup to level 0. Images upload a full mip chain, but a downscaled one was always read from its full-size level: it aliased, and on a large photo every pixel strode across the whole texture, so the draw cost tracked the texture size instead of the pixels it covered. The clamps are now WebGPU's defaults. On the Chefs home page (1050 px photos shown at about 330 px; UHD 620, fixed clock, 120 Hz) the image draws' GPU time drops by about half, and the page in the browser goes from 104.5 to 115.5 fps. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
When_Parent_Has_BorderThickness draws a 500x200 image of colour bands into 60x60 and pinned each band's exact pixel bounds. With the WebGPU sampler now using the mip chain, the pixel on an edge between two bands blends them, so a band can lose a pixel on each side it shares with another colour (native WinUI shifts them the same way). Each edge is now checked within one pixel; the 20px border offset the test is about is still verified. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
b23959b to
ea7d522
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
The build 241454 found UI Test snapshots differences: Details
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
GitHub Issue: closes #25583
PR Type:
🐞 Bugfix
What changed? 🚀
The WebGPU image sampler was created from a zero-initialised
WGPUSamplerDescriptorthat never setLodMaxClamp, so every lookup was clamped to mip level 0. Images do upload a full mip chain, but a downscaled image was always read from its full-resolution level. It aliased, and its GPU cost tracked the texture size instead of the pixels it covered: a 1050² photo cost the same at 23k pixels as at 47k.This sets
LodMinClamp = 0andLodMaxClamp = 32(WebGPU's defaults) on that descriptor. The 16 tiled-image samplers copy it, so every image draw is covered. The present-blit sampler inUno.UI.Composition.WebGpu.Initsamples a single-level texture and is unaffected.Validation
Runtime, desktop: a 256×256 image of 1 px black/white columns shown at 30×30.
That check isn't included as a test: the Skia backend aliases the same way (it samples images with
SKFilterMode.Linearand no mipmap mode), which is a separate change.RenderDoc, desktop Vulkan, Chefs home page:
Browser, Chefs home page (UHD 620, Chrome, fixed CPU clock, 120 Hz, full repaint): 104.5 → 115.5 fps.
Downscaled images now look different: properly filtered instead of aliased.
PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code