<commit_before>#version 440

in vec2 vertexTexCoord;

uniform sampler3D layers;
uniform sampler2D layer1;
uniform sampler2D layer2;
uniform sampler2D layer3;
uniform sampler2D layer4;
uniform int layerCount;
uniform vec4 backgroundColor = vec4(1, 1, 1, 1);

out vec4 outputColor;

// Blending equation for in-order traversal
vec4 blend(vec4 clr, vec4 srf)
{
  return clr + (1.0 - clr.a) * srf;
}

void main()
{
  vec2 texCoord = vec2(vertexTexCoord.x, 1.0 - vertexTexCoord.y);
  /*
  vec4 color = texture(layer1, texCoord);
  for (int layerIndex = 1; layerIndex < layerCount; ++layerIndex)
    color = blend(color, texture(layer))
    */

  vec4 color1 = texture(layers, vec3(texCoord, 0));
  vec4 color2 = texture(layers, vec3(texCoord, 0.33333333));
  vec4 color3 = texture(layers, vec3(texCoord, 0.6666666));
  vec4 color4 = texture(layers, vec3(texCoord, 1));

  outputColor = blend(blend(blend(blend(color1, color2), color3), color4),
                      backgroundColor);
  //outputColor = blend(color1, backgroundColor);
}
<commit_msg>Switch to use texelFetch in combineLayers.frag.<commit_after>#version 440

in vec2 vertexTexCoord;

uniform sampler3D layers;
uniform int layerCount;
uniform vec4 backgroundColor = vec4(1, 1, 1, 1);

out vec4 outputColor;

// Blending equation for in-order traversal
vec4 blend(vec4 clr, vec4 srf)
{
  return clr + (1.0 - clr.a) * srf;
}

void main()
{
  vec2 texCoord = vec2(vertexTexCoord.x, 1.0 - vertexTexCoord.y) *
    textureSize(layers, 0).xy;
  /*
  vec4 color = texture(layer1, texCoord);
  for (int layerIndex = 1; layerIndex < layerCount; ++layerIndex)
    color = blend(color, texture(layer))
    */

  vec4 color1 = texelFetch(layers, ivec3(texCoord, 0), 0);
  vec4 color2 = texelFetch(layers, ivec3(texCoord, 1), 0);
  vec4 color3 = texelFetch(layers, ivec3(texCoord, 2), 0);
  vec4 color4 = texelFetch(layers, ivec3(texCoord, 3), 0);

  outputColor = blend(blend(blend(blend(color1, color2), color3), color4),
                      backgroundColor);
  //outputColor = blend(color4, backgroundColor);
}

{'fraction_non_alphanumeric': 0.12469674915089762, 'fraction_numerical': 0.05725376031052887, 'mean_word_length': 4.180904522613066, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7223152', 'n_tokens_mistral': 783, 'n_tokens_neox': 735, 'n_words': 195}