Aller au contenu

GPUCompilationMessage

A GPUCompilationMessage is an informational, warning, or error message generated by the GPUShaderModule compiler. The messages are intended to be human readable to help developers diagnose issues with their shader code. Each message may correspond to a single point or range of the shader source, or may be unassociated with any specific part of the code.

Properties

length

abstract val length: ULong
The number of UTF-16 code units in the substring that message corresponds to. If the message does not correspond with a substring then length must be 0.

lineNum

abstract val lineNum: ULong
The line number in the shader code the message corresponds to. Value is one-based, such that a lineNum of 1 indicates the first line of the shader code. Lines are delimited by line breaks. If the message corresponds to a substring this points to the line on which the substring begins. Must be 0 if the message does not correspond to any specific point in the shader code.

linePos

abstract val linePos: ULong
The offset, in UTF-16 code units, from the beginning of line lineNum of the shader code to the point or beginning of the substring that the message corresponds to. Value is one-based, such that a linePos of 1 indicates the first code unit of the line. If message corresponds to a substring this points to the first UTF-16 code unit of the substring. Must be 0 if the message does not correspond to any specific point in the shader code.

message

abstract val message: String
The human-readable, localizable text for this compilation message. Note: The message should follow the best practices for language and direction information. This includes making use of any future standards which may emerge regarding the reporting of string language and direction metadata.

offset

abstract val offset: ULong
The offset from the beginning of the shader code in UTF-16 code units to the point or beginning of the substring that message corresponds to. Must reference the same position as lineNum and linePos. Must be 0 if the message does not correspond to any specific point in the shader code.

type

The severity level of the message. If the type is "error", it corresponds to a shader-creation error.