GPUTexture: depthOrArrayLayers 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 depthOrArrayLayers của giao diện GPUTexture đại diện cho chiều sâu hoặc số lớp của GPUTexture.
Giá trị này được đặt dựa trên 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ố. Giá trị này đại diện cho:
- Chiều sâu tính bằng pixel, trong trường hợp kết cấu có
GPUTexture.dimensionlà"3d". - Số lớp, trong trường hợp kết cấu phân lớp có
GPUTexture.dimensionlà"2d".
Trong các trường hợp GPUTexture không có chiều sâu hoặc lớp, giá trị là 1.
Ví dụ
js
// …
const test = device.createTexture({
size: [128],
format: "r8uint",
dimension: "1d",
usage: GPUTextureUsage.COPY_SRC,
});
console.log(test.depthOrArrayLayers); // 1
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| WebGPU> # dom-gputexture-depthorarraylayers> |