<commit_before>#version 120

struct light
{
    vec4 pos;
	float radius;
};

uniform mat4 viewproj;
uniform vec3 view_pos;

uniform int max_lights;
uniform light lights[8];

uniform sampler2D render;

varying vec3 total_occlusion;

int compute_lod(vec4 light_pos, float light_radius)
{
    return 32;
}

void main()
{
	gl_Position = gl_Vertex;

	int lid = int((gl_Vertex.x + 1.0) / 2.0 * max_lights);

    int lod = compute_lod(lights[lid].pos, lights[lid].radius);

    int x_res = lod;
    int y_res = lod;

    vec3 total = vec3(0.0);

    for (int y = 0; y < y_res; ++y) {
        float theta = y / float(y_res) * 3.14159265;

        for (int x = 0; x < x_res; ++x) {
            float phi = x / float(x_res) * 3.14159265 * 2.0;

            vec4 pos = lights[lid].pos + vec4(sin(theta) * cos(phi),
                                              cos(theta),
                                              sin(theta) * sin(phi),
                                              0.0) * lights[lid].radius;

            vec4 projected = viewproj * pos;
            projected.xy /= projected.w;

            vec2 sample_pos = (projected.xy + 1.0) / 2.0;

            if ((sample_pos.x >= 0) && (sample_pos.y >= 0)
		     && (sample_pos.x <= 1) && (sample_pos.y <= 1)) {
			    total += texture2D(render, sample_pos).rgb;
		    }
        }
    }

	total_occlusion = total / (x_res * y_res * 2.0);
}<commit_msg>Some comments, simplified shader<commit_after>#version 120

struct light
{
    vec4 pos;
	float radius;
};

uniform mat4 viewproj;
uniform vec3 view_pos;

uniform int max_lights;
uniform light lights[8];

uniform sampler2D render;

varying vec3 total_occlusion;

int compute_lod(vec4 light_pos, float light_radius)
{
    return 32;
}

void main()
{
	gl_Position = gl_Vertex;

	int lid = int((gl_Vertex.x + 1.0) / 2.0 * max_lights);

    int lod = compute_lod(lights[lid].pos, lights[lid].radius);

    vec3 total = vec3(0.0);

    for (int y = 0; y < lod; ++y) {
        float theta = y / float(lod) * 3.14159265;

        for (int x = 0; x < lod; ++x) {
            float phi = x / float(lod) * 3.14159265 * 2.0;

            vec4 pos = lights[lid].pos + vec4(sin(theta) * cos(phi),
                                              cos(theta),
                                              sin(theta) * sin(phi),
                                              0.0) * lights[lid].radius;

            vec4 projected = viewproj * pos;
            projected.xy /= projected.w;

            vec2 sample_pos = (projected.xy + 1.0) / 2.0;

            if ((sample_pos.x >= 0) && (sample_pos.y >= 0)
		     && (sample_pos.x <= 1) && (sample_pos.y <= 1)) {
			    total += texture2D(render, sample_pos).rgb;
		    }
        }
    }

    // About 50% of samples will be back-facing
	total_occlusion = total / (lod * lod * 2.0);
}
{'fraction_non_alphanumeric': 0.13288447909284196, 'fraction_numerical': 0.042523033309709427, 'mean_word_length': 1.7622309197651664, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6523185', 'n_tokens_mistral': 1063, 'n_tokens_neox': 948, 'n_words': 242}