mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/better_aa' into 'master'
HQX upscaling for lower internal resolutions, fixed FXAA at lower internal resolutions See merge request veloren/veloren!3611
This commit is contained in:
commit
afc33bb22e
@ -14,13 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added a setting to influence the gap between music track plays.
|
||||
- Added a Craft All button.
|
||||
- Server: Vacuum database on startup
|
||||
- SeaChapel, greek/latin inspired dungeon for ocean biome coasts
|
||||
- SeaChapel, greek/latin inspired dungeon for ocean biome coasts
|
||||
- Entity view distance setting added (shown in graphics and network tabs). This setting controls
|
||||
the distance at which entities are synced to the client and which entities are displayed in.
|
||||
This is clamped to be no more than the current overall view distance setting.
|
||||
- View distance settings that are lowered by the server limit (or other factors) now display an
|
||||
extra ghost slider cursor when set above the limit (instead of snapping back to the limit).
|
||||
Limits on the view distance by the server no longer affect the settings saved on the client.
|
||||
- HQX upscaling shader for people playing on low internal resolutions
|
||||
|
||||
### Changed
|
||||
- Use fluent for translations
|
||||
@ -49,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
first joining a server and when changing the view distance (previously this required moving to a
|
||||
new chunk for the initial setting or subsequent change to apply).
|
||||
- Moderators and admins are no longer blocked from logging in when there are too many players.
|
||||
- FXAA now behaves correctly at non-1.0x internal resolutions
|
||||
|
||||
## [0.13.0] - 2022-07-23
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
const float FXAA_SCALE = 1.25;
|
||||
|
||||
/**
|
||||
Basic FXAA implementation based on the code on geeks3d.com with the
|
||||
modification that the texture2DLod stuff was removed since it's
|
||||
@ -117,15 +115,22 @@ void texcoords(vec2 fragCoord, vec2 resolution,
|
||||
}
|
||||
|
||||
|
||||
vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
||||
vec4 aa_apply(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
vec2 fragCoord,
|
||||
vec2 resolution
|
||||
) {
|
||||
mediump vec2 v_rgbNW;
|
||||
mediump vec2 v_rgbNE;
|
||||
mediump vec2 v_rgbSW;
|
||||
mediump vec2 v_rgbSE;
|
||||
mediump vec2 v_rgbM;
|
||||
|
||||
vec2 scaled_fc = fragCoord * FXAA_SCALE;
|
||||
vec2 scaled_res = resolution * FXAA_SCALE;
|
||||
float fxaa_scale = textureSize(sampler2D(tex, smplr), 0).x * 1.25 / resolution.x;
|
||||
|
||||
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);
|
||||
|
65
assets/voxygen/shaders/antialias/hqx.glsl
Normal file
65
assets/voxygen/shaders/antialias/hqx.glsl
Normal file
@ -0,0 +1,65 @@
|
||||
const float THRESHOLD = 0.05;
|
||||
const float DEPTH_THRESHOLD = 0.05;
|
||||
|
||||
bool diag(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
const float line_thickness,
|
||||
inout vec4 sum,
|
||||
vec2 uv,
|
||||
const vec2 p1,
|
||||
const vec2 p2,
|
||||
const float aa_scale,
|
||||
const uvec2 src_sz
|
||||
) {
|
||||
vec4 v1 = texelFetch(sampler2D(tex, smplr), ivec2(uv + p1 * 0.5), 0);
|
||||
vec4 v2 = texelFetch(sampler2D(tex, smplr), ivec2(uv + p2 * 0.5), 0);
|
||||
float d1 = 1.0 / texelFetch(sampler2D(depth_tex, depth_smplr), ivec2(uv + vec2(p1.x, p1.y)), 0).x;
|
||||
float d2 = 1.0 / texelFetch(sampler2D(depth_tex, depth_smplr), ivec2(uv + vec2(p2.x, p2.y)), 0).x;
|
||||
if (length((normalize(v1) - normalize(v2)).rgb) > THRESHOLD || abs(d1 - d2) > d1 * DEPTH_THRESHOLD + 3.0) {
|
||||
return false;
|
||||
}
|
||||
vec2 dir = p2 - p1;
|
||||
vec2 lp = uv - (floor(uv + p1) + 0.5);
|
||||
dir = normalize(vec2(dir.y, -dir.x));
|
||||
float l = clamp((line_thickness - dot(lp, dir)) * aa_scale, 0.0, 1.0);
|
||||
sum = mix(sum, (v1 + v2) * 0.5, l);
|
||||
return true;
|
||||
}
|
||||
|
||||
vec4 aa_apply(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
vec2 fragCoord,
|
||||
vec2 resolution
|
||||
) {
|
||||
uvec2 src_sz = textureSize(sampler2D(tex, smplr), 0).xy;
|
||||
|
||||
vec2 upscale = resolution / src_sz;
|
||||
vec2 ip = fragCoord / upscale;
|
||||
//start with nearest pixel as 'background'
|
||||
vec4 s = texelFetch(sampler2D(tex, smplr), ivec2(ip), 0);
|
||||
//vec4 s = texture(sampler2D(tex, smplr), fragCoord / resolution);
|
||||
|
||||
float aa_scale = upscale.x * 0.5;
|
||||
|
||||
//draw anti aliased diagonal lines of surrounding pixels as 'foreground'
|
||||
if (diag(tex, smplr, depth_tex, depth_smplr, 0.4, s, ip, vec2(-1, 0), vec2(0, 1), aa_scale, src_sz)) {
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(-1, 0), vec2(1, 1), aa_scale, src_sz);
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(-1, -1), vec2(0, 1), aa_scale, src_sz);
|
||||
}
|
||||
if (diag(tex, smplr, depth_tex, depth_smplr, 0.4, s, ip, vec2(0, 1), vec2(1, 0), aa_scale, src_sz)) {
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(0, 1), vec2(1, -1), aa_scale, src_sz);
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(-1, 1), vec2(1, 0), aa_scale, src_sz);
|
||||
}
|
||||
if (diag(tex, smplr, depth_tex, depth_smplr, 0.4, s, ip, vec2(1, 0), vec2(0, -1), aa_scale, src_sz)) {
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(1, 0), vec2(-1, -1), aa_scale, src_sz);
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(1, 1), vec2(0, -1), aa_scale, src_sz);
|
||||
}
|
||||
if (diag(tex, smplr, depth_tex, depth_smplr, 0.4, s, ip, vec2(0, -1), vec2(-1, 0), aa_scale, src_sz)) {
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(0, -1), vec2(-1, 1), aa_scale, src_sz);
|
||||
diag(tex, smplr, depth_tex, depth_smplr, 0.3, s, ip, vec2(1, -1), vec2(-1, 0), aa_scale, src_sz);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
@ -1,4 +1,9 @@
|
||||
vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
||||
vec4 aa_apply(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
vec2 fragCoord,
|
||||
vec2 resolution
|
||||
) {
|
||||
ivec2 texel_coord = ivec2(fragCoord.x, fragCoord.y);
|
||||
|
||||
vec4 sample1 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 0);
|
||||
@ -20,7 +25,7 @@ vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
||||
|
||||
// Average Samples
|
||||
vec4 msaa_color = (
|
||||
sample1 + sample2 + sample3 + sample4 + sample5 + sample6 + sample7 + sample8 +
|
||||
sample1 + sample2 + sample3 + sample4 + sample5 + sample6 + sample7 + sample8 +
|
||||
sample9 + sample10 + sample11 + sample12 + sample13 + sample14 + sample15 + sample16
|
||||
) / 16.0;
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
||||
vec4 aa_apply(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
vec2 fragCoord,
|
||||
vec2 resolution
|
||||
) {
|
||||
ivec2 texel_coord = ivec2(fragCoord.x, fragCoord.y);
|
||||
|
||||
vec4 sample1 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 0);
|
||||
|
@ -1,4 +1,9 @@
|
||||
vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
||||
vec4 aa_apply(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
vec2 fragCoord,
|
||||
vec2 resolution
|
||||
) {
|
||||
ivec2 texel_coord = ivec2(fragCoord.x, fragCoord.y);
|
||||
|
||||
vec4 sample1 = texelFetch(sampler2DMS(tex, smplr), texel_coord, 0);
|
||||
|
@ -1,3 +1,8 @@
|
||||
vec4 aa_apply(texture2D tex, sampler smplr, vec2 fragCoord, vec2 resolution) {
|
||||
vec4 aa_apply(
|
||||
texture2D tex, sampler smplr,
|
||||
texture2D depth_tex, sampler depth_smplr,
|
||||
vec2 fragCoord,
|
||||
vec2 resolution
|
||||
) {
|
||||
return texture(sampler2D(tex, smplr), fragCoord / resolution);
|
||||
}
|
||||
|
@ -22,22 +22,28 @@
|
||||
#include <srgb.glsl>
|
||||
#include <cloud.glsl>
|
||||
#include <random.glsl>
|
||||
#include <lod.glsl>
|
||||
|
||||
layout(set = 1, binding = 0)
|
||||
uniform texture2D t_src_color;
|
||||
layout(set = 1, binding = 1)
|
||||
uniform sampler s_src_color;
|
||||
|
||||
layout(set = 1, binding = 2)
|
||||
uniform texture2D t_src_depth;
|
||||
layout(set = 1, binding = 3)
|
||||
uniform sampler s_src_depth;
|
||||
|
||||
layout(location = 0) in vec2 uv;
|
||||
|
||||
layout (std140, set = 1, binding = 2)
|
||||
layout (std140, set = 1, binding = 4)
|
||||
uniform u_locals {
|
||||
mat4 proj_mat_inv;
|
||||
mat4 view_mat_inv;
|
||||
};
|
||||
|
||||
#ifdef BLOOM_FACTOR
|
||||
layout(set = 1, binding = 3)
|
||||
layout(set = 1, binding = 5)
|
||||
uniform texture2D t_src_bloom;
|
||||
#endif
|
||||
|
||||
@ -156,7 +162,7 @@ vec3 _illuminate(float max_light, vec3 view_dir, /*vec3 max_light, */vec3 emitte
|
||||
|
||||
#ifdef EXPERIMENTAL_SOBEL
|
||||
vec3 aa_sample(vec2 uv, vec2 off) {
|
||||
return aa_apply(t_src_color, s_src_color, uv * screen_res.xy + off, screen_res.xy).rgb;
|
||||
return aa_apply(t_src_color, s_src_color, t_src_depth, s_src_depth, uv * screen_res.xy + off, screen_res.xy).rgb;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -209,7 +215,8 @@ void main() {
|
||||
}
|
||||
#endif
|
||||
|
||||
vec4 aa_color = aa_apply(t_src_color, s_src_color, sample_uv * screen_res.xy, screen_res.xy);
|
||||
vec4 aa_color = aa_apply(t_src_color, s_src_color, t_src_depth, s_src_depth, sample_uv * screen_res.xy, screen_res.xy);
|
||||
|
||||
|
||||
#ifdef EXPERIMENTAL_SOBEL
|
||||
vec3 s[8];
|
||||
|
@ -804,13 +804,15 @@ impl<'a> Widget for Video<'a> {
|
||||
/* AaMode::MsaaX4,
|
||||
AaMode::MsaaX8,
|
||||
AaMode::MsaaX16, */
|
||||
AaMode::Hqx,
|
||||
];
|
||||
let mode_label_list = [
|
||||
"No AA",
|
||||
"No anti-aliasing",
|
||||
"FXAA",
|
||||
/* "MSAA x4",
|
||||
"MSAA x8",
|
||||
"MSAA x16 (experimental)", */
|
||||
"HQX",
|
||||
];
|
||||
|
||||
// Get which AA mode is currently active
|
||||
@ -941,7 +943,7 @@ impl<'a> Widget for Video<'a> {
|
||||
|
||||
let upscale_factors = [
|
||||
// Upscaling
|
||||
0.15, 0.2, 0.25, 0.35, 0.5, 0.65, 0.75, 0.85, 1.0,
|
||||
0.1, 0.15, 0.2, 0.25, 0.35, 0.5, 0.65, 0.75, 0.85, 1.0,
|
||||
// Downscaling (equivalent to SSAA)
|
||||
1.25, 1.5, 1.75, 2.0,
|
||||
];
|
||||
@ -954,7 +956,7 @@ impl<'a> Widget for Video<'a> {
|
||||
if let Some(clicked) = DropDownList::new(
|
||||
&upscale_factors
|
||||
.iter()
|
||||
.map(|factor| format!("{n:.*}", 2, n = factor))
|
||||
.map(|factor| format!("{n:.*}", 3, n = factor))
|
||||
.collect::<Vec<String>>(),
|
||||
selected,
|
||||
)
|
||||
|
@ -93,10 +93,27 @@ pub enum AaMode {
|
||||
/// also struggle in the future with deferred shading, so they may be
|
||||
/// removed in the future.
|
||||
MsaaX16,
|
||||
/// Fast upscaling re-aliasing.
|
||||
///
|
||||
/// Screen-space technique that attempts to reconstruct lines and edges
|
||||
/// in the original image. Useless at internal resolutions higher than 1.0x,
|
||||
/// but potentially very effective at much lower internal resolutions.
|
||||
Hqx,
|
||||
#[serde(other)]
|
||||
None,
|
||||
}
|
||||
|
||||
impl AaMode {
|
||||
pub fn samples(&self) -> u32 {
|
||||
match self {
|
||||
AaMode::None | AaMode::Fxaa | AaMode::Hqx => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for AaMode {
|
||||
fn default() -> Self { AaMode::Fxaa }
|
||||
}
|
||||
|
@ -158,12 +158,7 @@ impl CloudsPipeline {
|
||||
],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Clouds pipeline"),
|
||||
|
@ -71,12 +71,7 @@ impl DebugPipeline {
|
||||
bind_group_layouts: &[&global_layouts.globals, &layout.locals],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Debug pipeline"),
|
||||
|
@ -190,12 +190,7 @@ impl FigurePipeline {
|
||||
],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Figure pipeline"),
|
||||
|
@ -70,12 +70,7 @@ impl FluidPipeline {
|
||||
],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Fluid pipeline"),
|
||||
|
@ -94,12 +94,7 @@ impl LodObjectPipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &global_layout.shadow_textures],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("LoD object pipeline"),
|
||||
|
@ -209,12 +209,7 @@ impl LodTerrainPipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &global_layout.shadow_textures],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Lod terrain pipeline"),
|
||||
|
@ -200,12 +200,7 @@ impl ParticlePipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &global_layout.shadow_textures],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Particle pipeline"),
|
||||
|
@ -53,9 +53,29 @@ impl PostProcessLayout {
|
||||
},
|
||||
count: None,
|
||||
},
|
||||
// Locals
|
||||
// Depth source
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Texture {
|
||||
sample_type: wgpu::TextureSampleType::Float { filterable: true },
|
||||
view_dimension: wgpu::TextureViewDimension::D2,
|
||||
multisampled: false,
|
||||
},
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 3,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler {
|
||||
filtering: true,
|
||||
comparison: false,
|
||||
},
|
||||
count: None,
|
||||
},
|
||||
// Locals
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 4,
|
||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Buffer {
|
||||
ty: wgpu::BufferBindingType::Uniform,
|
||||
@ -70,7 +90,7 @@ impl PostProcessLayout {
|
||||
bind_entries.push(
|
||||
// src bloom
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 3,
|
||||
binding: 5,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Texture {
|
||||
sample_type: wgpu::TextureSampleType::Float { filterable: true },
|
||||
@ -94,8 +114,10 @@ impl PostProcessLayout {
|
||||
&self,
|
||||
device: &wgpu::Device,
|
||||
src_color: &wgpu::TextureView,
|
||||
src_depth: &wgpu::TextureView,
|
||||
src_bloom: Option<&wgpu::TextureView>,
|
||||
sampler: &wgpu::Sampler,
|
||||
depth_sampler: &wgpu::Sampler,
|
||||
locals: &Consts<Locals>,
|
||||
) -> BindGroup {
|
||||
let mut entries = vec![
|
||||
@ -109,6 +131,14 @@ impl PostProcessLayout {
|
||||
},
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::TextureView(src_depth),
|
||||
},
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 3,
|
||||
resource: wgpu::BindingResource::Sampler(depth_sampler),
|
||||
},
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 4,
|
||||
resource: locals.buf().as_entire_binding(),
|
||||
},
|
||||
];
|
||||
@ -120,7 +150,7 @@ impl PostProcessLayout {
|
||||
// TODO: if there is no upscaling we can do the last bloom upsampling in post
|
||||
// process to save a pass and the need for the final full size bloom render target
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 3,
|
||||
binding: 5,
|
||||
resource: wgpu::BindingResource::TextureView(src_bloom),
|
||||
},
|
||||
);
|
||||
|
@ -103,12 +103,7 @@ impl RainOcclusionFigurePipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &figure_layout.locals],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Rain occlusion figure pipeline"),
|
||||
@ -176,12 +171,7 @@ impl RainOcclusionPipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &terrain_layout.locals],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Rain occlusion pipeline"),
|
||||
|
@ -145,12 +145,7 @@ impl ShadowFigurePipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &figure_layout.locals],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Directed shadow figure pipeline"),
|
||||
@ -218,12 +213,7 @@ impl ShadowPipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &terrain_layout.locals],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Directed shadow pipeline"),
|
||||
@ -293,12 +283,7 @@ impl PointShadowPipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &terrain_layout.locals],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Point shadow pipeline"),
|
||||
|
@ -48,12 +48,7 @@ impl SkyboxPipeline {
|
||||
bind_group_layouts: &[&layouts.globals, &layouts.shadow_textures],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Skybox pipeline"),
|
||||
|
@ -267,12 +267,7 @@ impl SpritePipeline {
|
||||
],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Sprite pipeline"),
|
||||
|
@ -234,12 +234,7 @@ impl TerrainPipeline {
|
||||
],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Terrain pipeline"),
|
||||
|
@ -69,12 +69,7 @@ impl TrailPipeline {
|
||||
bind_group_layouts: &[&global_layout.globals, &global_layout.shadow_textures],
|
||||
});
|
||||
|
||||
let samples = match aa_mode {
|
||||
AaMode::None | AaMode::Fxaa => 1,
|
||||
AaMode::MsaaX4 => 4,
|
||||
AaMode::MsaaX8 => 8,
|
||||
AaMode::MsaaX16 => 16,
|
||||
};
|
||||
let samples = aa_mode.samples();
|
||||
|
||||
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
label: Some("Trail pipeline"),
|
||||
|
@ -28,8 +28,8 @@ use super::{
|
||||
ui, GlobalsBindGroup, GlobalsLayouts, ShadowTexturesBindGroup,
|
||||
},
|
||||
texture::Texture,
|
||||
AaMode, AddressMode, FilterMode, OtherModes, PipelineModes, RenderError, RenderMode,
|
||||
ShadowMapMode, ShadowMode, Vertex,
|
||||
AddressMode, FilterMode, OtherModes, PipelineModes, RenderError, RenderMode, ShadowMapMode,
|
||||
ShadowMode, Vertex,
|
||||
};
|
||||
use common::assets::{self, AssetExt, AssetHandle, ReloadWatcher};
|
||||
use common_base::span;
|
||||
@ -798,12 +798,8 @@ impl Renderer {
|
||||
let upscaled = Vec2::<u32>::from(size)
|
||||
.map(|e| (e as f32 * other_modes.upscale_mode.factor) as u32)
|
||||
.into_tuple();
|
||||
let (width, height, sample_count) = match pipeline_modes.aa {
|
||||
AaMode::None | AaMode::Fxaa => (upscaled.0, upscaled.1, 1),
|
||||
AaMode::MsaaX4 => (upscaled.0, upscaled.1, 4),
|
||||
AaMode::MsaaX8 => (upscaled.0, upscaled.1, 8),
|
||||
AaMode::MsaaX16 => (upscaled.0, upscaled.1, 16),
|
||||
};
|
||||
let (width, height) = upscaled;
|
||||
let sample_count = pipeline_modes.aa.samples();
|
||||
let levels = 1;
|
||||
|
||||
let color_view = |width, height| {
|
||||
|
@ -47,8 +47,10 @@ impl Locals {
|
||||
let postprocess_bind = layouts.postprocess.bind(
|
||||
device,
|
||||
tgt_color_pp_view,
|
||||
tgt_depth_view,
|
||||
bloom.as_ref().map(|b| b.final_tgt_view),
|
||||
sampler,
|
||||
depth_sampler,
|
||||
&postprocess_locals,
|
||||
);
|
||||
|
||||
@ -92,8 +94,10 @@ impl Locals {
|
||||
self.postprocess_bind = layouts.postprocess.bind(
|
||||
device,
|
||||
tgt_color_pp_view,
|
||||
tgt_depth_view,
|
||||
bloom.as_ref().map(|b| b.final_tgt_view),
|
||||
sampler,
|
||||
depth_sampler,
|
||||
&self.postprocess,
|
||||
);
|
||||
self.bloom_binds = bloom.map(|bloom| {
|
||||
|
@ -247,6 +247,7 @@ impl ShaderModules {
|
||||
AaMode::MsaaX4 => "antialias.msaa-x4",
|
||||
AaMode::MsaaX8 => "antialias.msaa-x8",
|
||||
AaMode::MsaaX16 => "antialias.msaa-x16",
|
||||
AaMode::Hqx => "antialias.hqx",
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
@ -41,6 +41,7 @@ impl assets::Compound for Shaders {
|
||||
"antialias.msaa-x4",
|
||||
"antialias.msaa-x8",
|
||||
"antialias.msaa-x16",
|
||||
"antialias.hqx",
|
||||
"include.cloud.none",
|
||||
"include.cloud.regular",
|
||||
"figure-vert",
|
||||
|
Loading…
Reference in New Issue
Block a user