GPUSampler
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.
Note: This feature is available inWeb Workers.
TheGPUSampler interface of theWebGPU API represents an object that can control how shaders transform and filter texture resource data.
AGPUSampler object instance is created using theGPUDevice.createSampler() method.
In this article
Instance properties
Examples
The following snippet creates aGPUSampler that does trilinear filtering and repeats texture coordinates:
js
// …const sampler = device.createSampler({ addressModeU: "repeat", addressModeV: "repeat", magFilter: "linear", minFilter: "linear", mipmapFilter: "linear",});The WebGPU samplesShadow Mapping sample uses comparison samplers to sample from a depth texture to render shadows.
Specifications
| Specification |
|---|
| WebGPU> # gpusampler> |
Browser compatibility
See also
- TheWebGPU API