Debian Codegraph @

Data/Sys/Load/GraphicMods/All Games Blurred DOF/blur.ps.glsl

raw
1 void process_fragment(in DolphinFragmentInput frag_input, out DolphinFragmentOutput frag_output)
2 {
3 int layer = int(frag_input.tex0.z);
4 int r = int(efb_scale) * int(SPREAD_MULTIPLIER);
5 int coord;
6 int length;
7 int2 initial_coords = int2(frag_input.tex0.xy * source_resolution.xy);
8 vec4 brightness = float4(1.0, 1.0, 1.0, 1.0);
9 if (HORIZONTAL)
10 {
11 length = int(source_resolution.x);
12 coord = initial_coords.x;
13 brightness = BRIGHTNESS_MULTIPLIER * brightness;
14 }
15 else
16 {
17 length = int(source_resolution.y);
18 coord = initial_coords.y;
19 }
20
21 int offset;
22 vec4 count = vec4(0.0,0.0,0.0,0.0);
23 vec4 col = vec4(0.0,0.0,0.0,0.0);
24 for (offset = -r; offset <= r; offset++)
25 {
26 int pos = coord + offset;
27 if (pos <= length && pos >= 0)
28 {
29 int3 sample_coords;
30 if (HORIZONTAL)
31 {
32 sample_coords = int3(int2(pos, initial_coords.y), layer);
33 }
34 else
35 {
36 sample_coords = int3(int2(initial_coords.x, pos), layer);
37 }
38
39 col += texelFetch(samp0, sample_coords, 0);
40 count += vec4(1.0,1.0,1.0,1.0);
41 }
42 }
43 frag_output.main = col / count * brightness;
44
45 }