GPUCompilationMessage: length 屬性
注意:此功能在 Web Workers 中可用。
GPUCompilationMessage 介面的 length 只讀屬性是一個數字,表示訊息對應的子字串的長度。
值
一個數字。
準確地說,length 是著色器程式碼子字串中 UTF-16 程式碼單元的數量,該子字串對應於此訊息。如果訊息對應於單個點而不是子字串,則 length 將為 0。
示例
js
const shaderModule = device.createShaderModule({
code: shaders,
});
const shaderInfo = await shaderModule.getCompilationInfo();
const firstMessage = shaderInfo.messages[0];
console.log(firstMessage.length);
有關更詳細的示例,請參閱主要的 GPUCompilationInfo 頁面。
規範
| 規範 |
|---|
| WebGPU # dom-gpucompilationmessage-length |
瀏覽器相容性
載入中…