sdf-2d/src/graphics/graphics-library/compiling/check-program.ts
2020-09-16 14:45:08 +02:00

13 lines
389 B
TypeScript

import { checkShader } from './check-shader';
export const checkProgram = (gl: WebGL2RenderingContext, program: WebGLProgram) => {
const success = gl.getProgramParameter(program, gl.LINK_STATUS);
if (!success && !gl.isContextLost()) {
gl.getAttachedShaders(program)?.forEach((s) => {
checkShader(gl, s);
});
throw new Error(gl.getProgramInfoLog(program)!);
}
};