GPUTexture: mipLevelCount 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 mipLevelCount của giao diện GPUTexture đại diện cho số lượng mip level của GPUTexture.

Giá trị này được đặt thông qua thuộc tính mipLevelCount 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ố.

Ví dụ

js
// …

const depthTexture = device.createTexture({
  size: [canvas.width, canvas.height],
  format: "depth24plus",
  usage: GPUTextureUsage.RENDER_ATTACHMENT,
});

console.log(depthTexture.mipLevelCount); // 1

Thông số kỹ thuật

Specification
WebGPU
# dom-gputexture-miplevelcount

Tương thích trình duyệt

Xem thêm