GPU: thuộc tính wgslLanguageFeatures

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 wgslLanguageFeatures của giao diện GPU trả về một đối tượng WGSLLanguageFeatures báo cáo các tiện ích ngôn ngữ WGSL được triển khai WebGPU hỗ trợ.

Note: Không phải tất cả tiện ích ngôn ngữ WGSL đều có sẵn cho WebGPU trong mọi trình duyệt hỗ trợ API này. Chúng tôi khuyến nghị bạn kiểm thử kỹ mọi tiện ích mà bạn chọn dùng.

Giá trị

Một thể hiện đối tượng WGSLLanguageFeatures. Đây là một đối tượng setlike.

Ví dụ

js
if (!navigator.gpu) {
  throw Error("WebGPU not supported.");
}

const wgslFeatures = navigator.gpu.wgslLanguageFeatures;

// Trả về kích thước của tập hợp
console.log(wgslFeatures.size);

// Duyệt qua tất cả các giá trị của tập hợp bằng values()
const valueIterator = wgslFeatures.values();
for (const value of valueIterator) {
  console.log(value);
}

// …

Đặc tả

Thông số kỹ thuật
WebGPU
# dom-gpu-wgsllanguagefeatures

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

Xem thêm