Draw distinction between bilinear filtering and nearest neighbour

This commit is contained in:
Joshua Barretto 2023-05-31 18:26:53 +01:00
parent b2051767ff
commit 2a9e43b847
6 changed files with 24 additions and 3 deletions

View File

@ -0,0 +1,8 @@
vec4 aa_apply(
texture2D tex, sampler smplr,
texture2D depth_tex, sampler depth_smplr,
vec2 fragCoord,
vec2 resolution
) {
return texture(sampler2D(tex, smplr), fragCoord / resolution);
}

View File

@ -4,5 +4,5 @@ vec4 aa_apply(
vec2 fragCoord,
vec2 resolution
) {
return texture(sampler2D(tex, smplr), fragCoord / resolution);
return texelFetch(sampler2D(tex, smplr), ivec2(fragCoord * textureSize(sampler2D(tex, smplr), 0).xy / resolution), 0);
}

View File

@ -879,6 +879,7 @@ impl<'a> Widget for Video<'a> {
// interaction with greedy meshing, and may eventually be removed.
let mode_list = [
AaMode::None,
AaMode::Bilinear,
AaMode::Fxaa,
/* AaMode::MsaaX4,
AaMode::MsaaX8,
@ -887,7 +888,8 @@ impl<'a> Widget for Video<'a> {
AaMode::Hqx,
];
let mode_label_list = [
"No anti-aliasing",
"None",
"Bilinear",
"FXAA",
/* "MSAA x4",
"MSAA x8",

View File

@ -108,6 +108,15 @@ pub enum AaMode {
/// Screen-space technique that uses a combination of FXAA and
/// nearest-neighbour sample retargeting to produce crisp, clean upscaling.
FxUpscale,
/// Bilinear filtering.
///
/// Linear interpolation of the color buffer in each axis to determine the
/// pixel.
Bilinear,
/// Nearest-neighbour filtering.
///
/// The colour of each pixel is determined by the colour of the spatially
/// closest texel in the color buffer.
#[serde(other)]
None,
}
@ -115,7 +124,7 @@ pub enum AaMode {
impl AaMode {
pub fn samples(&self) -> u32 {
match self {
AaMode::None | AaMode::Fxaa | AaMode::Hqx | AaMode::FxUpscale => 1,
AaMode::None | AaMode::Bilinear | AaMode::Fxaa | AaMode::Hqx | AaMode::FxUpscale => 1,
AaMode::MsaaX4 => 4,
AaMode::MsaaX8 => 8,
AaMode::MsaaX16 => 16,

View File

@ -258,6 +258,7 @@ impl ShaderModules {
let anti_alias = shaders
.get(match pipeline_modes.aa {
AaMode::None => "antialias.none",
AaMode::Bilinear => "antialias.bilinear",
AaMode::Fxaa => "antialias.fxaa",
AaMode::MsaaX4 => "antialias.msaa-x4",
AaMode::MsaaX8 => "antialias.msaa-x8",

View File

@ -38,6 +38,7 @@ impl assets::Compound for Shaders {
"include.point_glow",
"include.fxaa",
"antialias.none",
"antialias.bilinear",
"antialias.fxaa",
"antialias.msaa-x4",
"antialias.msaa-x8",