Revert "Added experimental BetterAA shader"

This reverts commit 03e8eb42ad.
This commit is contained in:
Ben Wallis 2022-09-15 10:05:12 +01:00
parent 8308598512
commit 15197c3040
3 changed files with 3 additions and 45 deletions

View File

@ -124,14 +124,8 @@ vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
mediump vec2 v_rgbSE;
mediump vec2 v_rgbM;
#ifdef EXPERIMENTAL_BETTERAA
float fxaa_scale = textureSize(sampler2D(tex, smplr), 0).x / 900.0;
#else
float fxaa_scale = FXAA_SCALE;
#endif
vec2 scaled_fc = fragCoord * fxaa_scale;
vec2 scaled_res = resolution * fxaa_scale;
vec2 scaled_fc = fragCoord * FXAA_SCALE;
vec2 scaled_res = resolution * FXAA_SCALE;
//compute the texture coords
texcoords(scaled_fc, scaled_res, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);

View File

@ -22,7 +22,6 @@
#include <srgb.glsl>
#include <cloud.glsl>
#include <random.glsl>
#include <lod.glsl>
layout(set = 1, binding = 0)
uniform texture2D t_src_color;
@ -44,34 +43,6 @@ uniform texture2D t_src_bloom;
layout(location = 0) out vec4 tgt_color;
#ifdef EXPERIMENTAL_BETTERAA
vec4 clever_aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
uvec2 src_sz = textureSize(sampler2D(tex, smplr), 0).xy;
/* vec4 interp = texture(sampler2D(tex, smplr), fragCoord / resolution); */
/* vec4 interp = textureBicubic(tex, smplr, fragCoord * src_sz / resolution); */
vec4 interp = aa_apply(tex, smplr, fragCoord, resolution);
vec4 original = texelFetch(sampler2D(tex, smplr), ivec2(fragCoord / resolution * src_sz), 0);
vec4 closest = vec4(0.0);
float closest_dist = 100000.0;
for (int i = -1; i < 2; i ++) {
for (int j = -1; j < 2; j ++) {
ivec2 rpos = ivec2(i, j);
vec4 texel = texelFetch(sampler2D(tex, smplr), ivec2(fragCoord / resolution * src_sz) + rpos, 0);
float dist = distance(interp.rgb, texel.rgb);
if (dist < closest_dist) {
closest = texel;
closest_dist = dist;
}
}
}
return mix(closest, interp, 0.0);
}
#endif
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
@ -238,12 +209,7 @@ void main() {
}
#endif
#ifdef EXPERIMENTAL_BETTERAA
vec4 aa_color = clever_aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy);
#else
vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy);
#endif
vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy);
#ifdef EXPERIMENTAL_SOBEL
vec3 s[8];

View File

@ -482,6 +482,4 @@ pub enum ExperimentalShader {
NoRainbows,
/// Make objects appear wet when appropriate.
Wetness,
/// An attempt at better anti-aliasing (requires FXAA).
BetterAA,
}