<commit_before>function WebGL2DScreen(canvas) {
  var gl = null;

  var oldGetContext = (function(func) {
    return function(type) {
      gl = null;
      return func.call(canvas, type);
    };
  })(canvas.getContext);

  canvas.getContext = function(type) {
    if (type !== '2d') return oldGetContext(type);

    gl = oldGetContext("webgl") || oldGetContext("experimental-webgl");
    if (!gl) return oldGetContext('2d');

    var vertexShaderString = 
    'attribute vec2 vertexPosition;                                \n\
      varying vec2 texCoord;                                       \n\
      void main(void) {                                            \n\
        texCoord = vec2(vertexPosition.x, 1.0 - vertexPosition.y); \n\
        gl_Position = vec4(2.0 * vertexPosition - 1.0, 0.0, 1.0);  \n\
      }                                                            \n';

    var fragmentShaderString =
    'precision mediump float;                                 \n\
      uniform sampler2D texSampler;                           \n\
      varying vec2 texCoord;                                  \n\
      void main(void) {                                       \n\
        /* the rasterizer writes out data in bgra format */   \n\
        gl_FragColor = texture2D(texSampler, texCoord).bgra;  \n\
      }                                                       \n';

    var texarray, program;
    var texUnit = 0; // we will use texture unit 0 only

    var vertexShader = gl.createShader(gl.VERTEX_SHADER);
    gl.shaderSource(vertexShader, vertexShaderString);
    gl.compileShader(vertexShader);
    if (gl.getError() !== gl.NO_ERROR) return oldGetContext('2d');

    var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
    gl.shaderSource(fragmentShader, fragmentShaderString);
    gl.compileShader(fragmentShader);
    if (gl.getError() !== gl.NO_ERROR) return oldGetContext('2d');

    program = gl.createProgram();
    gl.attachShader(program, vertexShader);
    gl.attachShader(program, fragmentShader);
    gl.linkProgram(program);
    gl.useProgram(program);
    if (gl.getError() !== gl.NO_ERROR) return oldGetContext('2d');

    var vertexPositionAttrLoc = gl.getAttribLocation(program, "vertexPosition");<commit_msg>2d canvas pixels are in rgba format<commit_after>function WebGL2DScreen(canvas) {
  var gl = null;

  var oldGetContext = (function(func) {
    return function(type) {
      gl = null;
      return func.call(canvas, type);
    };
  })(canvas.getContext);

  canvas.getContext = function(type) {
    if (type !== '2d') return oldGetContext(type);

    gl = oldGetContext("webgl") || oldGetContext("experimental-webgl");
    if (!gl) return oldGetContext('2d');

    var vertexShaderString = 
    'attribute vec2 vertexPosition;                                \n\
      varying vec2 texCoord;                                       \n\
      void main(void) {                                            \n\
        texCoord = vec2(vertexPosition.x, 1.0 - vertexPosition.y); \n\
        gl_Position = vec4(2.0 * vertexPosition - 1.0, 0.0, 1.0);  \n\
      }                                                            \n';

    var fragmentShaderString =
    'precision mediump float;                                 \n\
      uniform sampler2D texSampler;                           \n\
      varying vec2 texCoord;                                  \n\
      void main(void) {                                       \n\
        gl_FragColor = texture2D(texSampler, texCoord).rgba;  \n\
      }                                                       \n';

    var texarray, program;
    var texUnit = 0; // we will use texture unit 0 only

    var vertexShader = gl.createShader(gl.VERTEX_SHADER);
    gl.shaderSource(vertexShader, vertexShaderString);
    gl.compileShader(vertexShader);
    if (gl.getError() !== gl.NO_ERROR) return oldGetContext('2d');

    var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
    gl.shaderSource(fragmentShader, fragmentShaderString);
    gl.compileShader(fragmentShader);
    if (gl.getError() !== gl.NO_ERROR) return oldGetContext('2d');

    program = gl.createProgram();
    gl.attachShader(program, vertexShader);
    gl.attachShader(program, fragmentShader);
    gl.linkProgram(program);
    gl.useProgram(program);
    if (gl.getError() !== gl.NO_ERROR) return oldGetContext('2d');

    var vertexPositionAttrLoc = gl.getAttribLocation(program, "vertexPosition");
{'fraction_non_alphanumeric': 0.11180960933991918, 'fraction_numerical': 0.011450381679389313, 'mean_word_length': 1.808953341740227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4582211', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1228, 'n_words': 274}