src/Common/Misc/WebGl/index.js
function compileShader(gl, src, type) {
  const shader = gl.createShader(type);

  gl.shaderSource(shader, src);

  // Compile and check status
  gl.compileShader(shader);
  if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
    // Something went wrong during compilation; get the error
    const lastError = gl.getShaderInfoLog(shader);
    console.error(`Error compiling shader '${shader}': ${lastError}`);
    gl.deleteShader(shader);

    return null;
  }

  return shader;
}
function compileShader(gl, src, type) {
  const shader = gl.createShader(type);

  gl.shaderSource(shader, src);

  // Compile and check status
  gl.compileShader(shader);
  if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
    // Something went wrong during compilation; get the error
    const lastError = gl.getShaderInfoLog(shader);
    console.error(`Error compiling shader '${shader}': ${lastError}`);
    gl.deleteShader(shader);

    return null;
  }

  return shader;
}
function compileShader ( gl , src , type ) { const shader = gl . createShader ( type ) ; gl . shaderSource ( shader , src ) ; // Compile and check status gl . compileShader ( shader ) ; if ( ! gl . getShaderParameter ( shader , gl . COMPILE_STATUS ) ) { // Something went wrong during compilation; get the error const lastError = gl . getShaderInfoLog ( shader ) ; console . error ( ` ${ shader } ${ lastError } ` ) ; gl . deleteShader ( shader ) ; return null ; } return shader ; }
Compile a shader
Compile a shader