enhance(frontend): シェーダーコンパイルに失敗した場合詳細なエラー内容を出力できるように (MisskeyIO#221)

This commit is contained in:
まっちゃとーにゅ 2023-11-07 22:51:46 +09:00 committed by GitHub
parent 510c2b6808
commit 0ff83829ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,8 +24,16 @@ const props = withDefaults(defineProps<{
function loadShader(gl, type, source) {
const shader = gl.createShader(type);
try {
gl.shaderSource(shader, source);
gl.compileShader(shader);
} catch (error) {
alert(
`failed to compile shader: ${error} ${gl.getShaderInfoLog(shader)}`,
);
gl.deleteShader(shader);
return null;
}
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
alert(