GPUQuerySet: label 屬性
注意:此功能在 Web Workers 中可用。
GPUQuerySet 介面的 label 屬性是一個字串,用於提供一個標籤來標識該物件,例如在 GPUError 訊息或控制檯警告中。
這可以透過在傳入原始的 GPUDevice.createQuerySet() 呼叫的描述符物件中提供 label 屬性來設定,也可以直接在 GPUQuerySet 物件上獲取和設定它。
值
一個字串。如果之前未按上述方式設定,則為空字串。
示例
透過 GPUQuerySet.label 設定和獲取標籤
js
const querySet = device.createQuerySet({
type: "occlusion",
count: 32,
});
querySet.label = "my_query_set";
console.log(querySet.label); // "my_query_set"
透過原始的 GPUDevice.createQuerySet() 呼叫設定標籤,然後透過 GPUQuerySet.label 獲取它
js
const querySet = device.createQuerySet({
type: "occlusion",
count: 32,
label: "my_query_set",
});
console.log(querySet.label); // "my_query_set"
規範
| 規範 |
|---|
| WebGPU # dom-gpuobjectbase-label |
瀏覽器相容性
載入中…