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