13 lines
389 B
TypeScript
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)!);
|
|
}
|
|
};
|