WebGLRenderingContext: getShaderInfoLog() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

WebGLRenderingContext.getShaderInfoLog は、指定された WebGLShader オブジェクトの情報ログを返します。これには、警告、デバッグ、およびコンパイル情報が含まれます。

構文

js
getShaderInfoLog(shader)

引数

shader

問い合わせ先の WebGLShader です。

返値

最後のコンパイル操作に関する診断メッセージ、警告メッセージ、その他の情報を含む文字列です。最初に WebGLShader オブジェクトが作成されたとき、その情報ログは長さ 0 の文字列になります。

コンパイルメッセージの確認

js
/* シェーダーのソースコードを読み取る */
gl.shaderSource(shader, shaderCode);

/* シェーダーのソースコードをコンパイル */
gl.compileShader(shader);

const message = gl.getShaderInfoLog(shader);

if (message.length > 0) {
  /* メッセージはエラーまたは警告 */
  throw message;
}

仕様書

Specification
WebGL Specification
# 5.14.9

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getShaderInfoLog

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報