GPUTexture: sampleCount property
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.
ThesampleCount read-only property of theGPUTexture interface represents the sample count of theGPUTexture.
This is set via thesampleCount property in the descriptor object passed into the originatingGPUDevice.createTexture() call. If omitted, this defaults to 1.
In this article
Value
A number. Possible values are:
- 1
- 4, which indicates a multi-sampled texture.
Examples
js
// …const depthTexture = device.createTexture({ size: [canvas.width, canvas.height], format: "depth24plus", usage: GPUTextureUsage.RENDER_ATTACHMENT,});console.log(depthTexture.sampleCount); // 1Specifications
| Specification |
|---|
| WebGPU> # dom-gputexture-samplecount> |
Browser compatibility
See also
- TheWebGPU API