diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index 49f561028..225f3ea87 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -365,16 +365,17 @@ fn run( // If the user specifies a base color in the CLI we use that. Otherwise we use any // color specified by the scene. The default is black. - let aa_config = AA_CONFIGS[aa_config_ix as usize]; + let base_color = args + .args + .base_color + .or(scene_params.base_color) + .unwrap_or(Color::BLACK); + let antialiasing_method = AA_CONFIGS[aa_config_ix as usize]; let render_params = vello::RenderParams { - base_color: args - .args - .base_color - .or(scene_params.base_color) - .unwrap_or(Color::BLACK), + base_color, width, height, - antialiasing_method: aa_config, + antialiasing_method, }; let mut builder = SceneBuilder::for_scene(&mut scene); let mut transform = transform; @@ -395,7 +396,7 @@ fn run( stats.samples(), complexity_shown.then_some(scene_complexity).flatten(), vsync_on, - aa_config, + antialiasing_method, ); if let Some(profiling_result) = renderers[render_state.surface.dev_id] .as_mut() diff --git a/src/shaders.rs b/src/shaders.rs index 11c6ba2bd..3facd602d 100644 --- a/src/shaders.rs +++ b/src/shaders.rs @@ -131,13 +131,7 @@ pub fn full_shaders( )? }}; ($name:ident, $bindings:expr, $defines:expr, $cpu:expr) => {{ - add_shader!( - $name, - stringify!($name), - $bindings, - &$defines, - $cpu - ) + add_shader!($name, stringify!($name), $bindings, &$defines, $cpu) }}; ($name:ident, $bindings:expr, $defines:expr) => { add_shader!( @@ -285,28 +279,24 @@ pub fn full_shaders( let [fine_area, fine_msaa8, fine_msaa16] = { let aa_support = &options.antialiasing_support; let aa_modes = [ - (aa_support.area, None), - (aa_support.msaa8, Some(("fine_msaa8", "msaa8"))), - (aa_support.msaa16, Some(("fine_msaa16", "msaa16"))), + (aa_support.area, 1, "fine_area", None), + (aa_support.msaa8, 0, "fine_msaa8", Some("msaa8")), + (aa_support.msaa16, 0, "fine_msaa16", Some("msaa16")), ]; let mut pipelines = [None, None, None]; - for (i, (enabled, msaa_info)) in aa_modes.iter().enumerate() { + for (i, (enabled, offset, label, aa_config)) in aa_modes.iter().enumerate() { if !enabled { continue; } - let (range_end_offset, label, aa_config) = match *msaa_info { - Some((label, config)) => (0, label, Some(config)), - None => (1, "fine_area", None), - }; let mut config = full_config.clone(); - if let Some(aa_config) = aa_config { + if let Some(aa_config) = *aa_config { config.insert("msaa".into()); config.insert(aa_config.into()); } pipelines[i] = Some(add_shader!( fine, label, - fine_resources[..fine_resources.len() - range_end_offset], + fine_resources[..fine_resources.len() - offset], config, CpuShaderType::Missing ));