GPUTexture: width property
Khả dụng hạn chế
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 width của giao diện GPUTexture đại diện cho chiều rộng của GPUTexture.
Giá trị này được đặt dựa trên giá trị của thuộc tính size trong đối tượng descriptor truyền vào lời gọi GPUDevice.createTexture() ban đầu.
Giá trị
Một số.
Ví dụ
js
// …
const depthTexture = device.createTexture({
size: [640, 480],
format: "depth24plus",
usage: GPUTextureUsage.RENDER_ATTACHMENT,
});
console.log(depthTexture.width); // 640
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| WebGPU> # dom-gputexture-width> |