Files
test2/source/blender/compositor/shaders/compositor_pixelate.glsl
Aras Pranckevicius a401089a9d Cleanup: move compositor files out of realtime_compositor folder
By now it is just a "compositor", so move the files one folder up.
Things that were under realtime_compositor/intern move into
already existing intern folder.

Pull Request: https://projects.blender.org/blender/blender/pulls/132004
2024-12-17 10:34:24 +01:00

25 lines
685 B
GLSL

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "gpu_shader_compositor_texture_utilities.glsl"
void main()
{
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
ivec2 start = (texel / ivec2(pixel_size)) * ivec2(pixel_size);
ivec2 end = min(start + ivec2(pixel_size), texture_size(input_tx));
vec4 accumulated_color = vec4(0.0);
for (int y = start.y; y < end.y; y++) {
for (int x = start.x; x < end.x; x++) {
accumulated_color += texture_load_unbound(input_tx, ivec2(x, y));
}
}
ivec2 size = end - start;
int count = size.x * size.y;
imageStore(output_img, texel, accumulated_color / count);
}