2022-09-10 09:56:22 +00:00
|
|
|
vec4 aa_apply(
|
|
|
|
texture2D tex, sampler smplr,
|
|
|
|
texture2D depth_tex, sampler depth_smplr,
|
|
|
|
vec2 fragCoord,
|
|
|
|
vec2 resolution
|
|
|
|
) {
|
2020-10-21 21:05:25 +00:00
|
|
|
ivec2 texel_coord = ivec2(fragCoord.x, fragCoord.y);
|
2019-09-26 07:28:40 +00:00
|
|
|
|
2020-11-29 21:38:03 +00:00
|
|
|
vec4 sample1 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 0);
|
|
|
|
vec4 sample2 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 1);
|
|
|
|
vec4 sample3 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 2);
|
|
|
|
vec4 sample4 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 3);
|
2019-09-26 07:28:40 +00:00
|
|
|
|
2020-10-21 21:05:25 +00:00
|
|
|
// Average Samples
|
|
|
|
vec4 msaa_color = (sample1 + sample2 + sample3 + sample4) / 4.0;
|
2019-09-26 07:28:40 +00:00
|
|
|
|
2020-10-21 21:05:25 +00:00
|
|
|
return msaa_color;
|
2020-11-29 21:38:03 +00:00
|
|
|
}
|