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 in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
Thuộc tính chỉ đọc sampleCount của giao diện GPUTexture đại diện cho số mẫu (sample count) của GPUTexture.
Giá trị này được đặt thông qua thuộc tính sampleCount trong đối tượng descriptor truyền vào lời gọi GPUDevice.createTexture() ban đầu. Nếu bị bỏ qua, mặc định là 1.
Giá trị
Một số. Các giá trị có thể là:
- 1
- 4, biểu thị kết cấu đa mẫu (multi-sampled texture).
Ví dụ
js
// …
const depthTexture = device.createTexture({
size: [canvas.width, canvas.height],
format: "depth24plus",
usage: GPUTextureUsage.RENDER_ATTACHMENT,
});
console.log(depthTexture.sampleCount); // 1
Thông số kỹ thuật
| Specification |
|---|
| WebGPU> # dom-gputexture-samplecount> |