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 |
浏览器兼容性
加载中…