GPUCompilationMessage: offset property

Limited availability

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 offset của giao diện GPUCompilationMessage là một số đại diện cho độ lệch từ đầu mã shader đến điểm chính xác, hoặc bắt đầu của chuỗi con liên quan, mà thông báo tương ứng.

Giá trị

Một số.

Cụ thể hơn, offset là số đơn vị mã UTF-16 từ đầu mã shader đến điểm chính xác hoặc bắt đầu của chuỗi con liên quan mà thông báo tương ứng.

Nếu thông báo không tương ứng với một vị trí mã cụ thể, offset sẽ là 0.

Ví dụ

js
const shaderModule = device.createShaderModule({
  code: shaders,
});

const shaderInfo = await shaderModule.getCompilationInfo();
const firstMessage = shaderInfo.messages[0];
console.log(firstMessage.offset);

Xem trang chính GPUCompilationInfo để biết ví dụ chi tiết hơn.

Thông số kỹ thuật

Specification
WebGPU
# dom-gpucompilationmessage-offset

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

Xem thêm