webgpu improvements

This commit is contained in:
Jorijn van der Graaf 2026-05-24 13:32:08 +02:00
commit 8347467e1e
18 changed files with 1932 additions and 153 deletions

View file

@ -191,5 +191,13 @@ export namespace Crafter {
heap.samplerTable[r.firstElement] = WebGPU::wgpuCreateLinearClampSampler();
return SamplerSlot(&heap, r.firstElement);
}
// Same as AllocateLinearClampSampler but the address modes are
// `repeat` instead of `clamp-to-edge`. Mip filtering is also linear.
inline SamplerSlot AllocateLinearRepeatSampler(DescriptorHeapWebGPU& heap) {
DescriptorRange r = heap.AllocateSamplerSlots(1);
heap.samplerTable[r.firstElement] = WebGPU::wgpuCreateLinearRepeatSampler();
return SamplerSlot(&heap, r.firstElement);
}
}
#endif // CRAFTER_GRAPHICS_WINDOW_DOM