fn render_window(&mut self, window_id: WindowId) -> Result<(), InvalidWindowId> {
		let window = self
			.windows
			.iter_mut()
			.find(|w| w.id() == window_id)
			.ok_or(InvalidWindowId { window_id })?;

		let image = match &window.image {
			Some(x) => x,
			None => return Ok(()),
		};

		let frame = window
			.swap_chain
			.get_current_frame()
			.expect("Failed to acquire next swap chain texture");

		let mut encoder = self.device.create_command_encoder(&Default::default());

		if window.uniforms.is_dirty() {
			window
				.uniforms
				.update_from(&self.device, &mut encoder, &window.calculate_uniforms());
		}

		render_pass(
			&mut encoder,
			&self.window_pipeline,
			&window.uniforms,
			image,
			Some(window.options.background_color),
			&frame.output.view,
		);
		if window.options.show_overlays {
			for overlay in &window.overlays {
				render_pass(
					&mut encoder,
					&self.window_pipeline,
					&window.uniforms,
					overlay,
					None,
					&frame.output.view,
				);
			}
		}
		self.queue.submit(std::iter::once(encoder.finish()));
		Ok(())
	}
/// Render the contents of a window.
Render the contents of a window.
Render the contents of a window .
fn render_window(&mut self, window_id: WindowId) -> Result<(), InvalidWindowId> {
		let window = self
			.windows
			.iter_mut()
			.find(|w| w.id() == window_id)
			.ok_or(InvalidWindowId { window_id })?;
		let image = match &window.image {
			Some(x) => x,
			None => return Ok(()),
		};
		let frame = window
			.swap_chain
			.get_current_frame()
			.expect("Failed to acquire next swap chain texture");
		let mut encoder = self.device.create_command_encoder(&Default::default());
		if window.uniforms.is_dirty() {
			window
				.uniforms
				.update_from(&self.device, &mut encoder, &window.calculate_uniforms());
		}
		render_pass(
			&mut encoder,
			&self.window_pipeline,
			&window.uniforms,
			image,
			Some(window.options.background_color),
			&frame.output.view,
		);
		if window.options.show_overlays {
			for overlay in &window.overlays {
				render_pass(
					&mut encoder,
					&self.window_pipeline,
					&window.uniforms,
					overlay,
					None,
					&frame.output.view,
				);
			}
		}
		self.queue.submit(std::iter::once(encoder.finish()));
		Ok(())
	}
fn render_window ( & mut self , window_id : WindowId ) -> Result < ( ) , InvalidWindowId > { let window = self . windows . iter_mut ( ) . find ( | w | w . id ( ) == window_id ) . ok_or ( InvalidWindowId { window_id } ) ? ; let image = match & window . image { Some ( x ) => x , None => return Ok ( ( ) ) , } ; let frame = window . swap_chain . get_current_frame ( ) . expect ( " " ) ; let mut encoder = self . device . create_command_encoder ( & Default :: default ( ) ) ; if window . uniforms . is_dirty ( ) { window . uniforms . update_from ( & self . device , & mut encoder , & window . calculate_uniforms ( ) ) ; } render_pass ( & mut encoder , & self . window_pipeline , & window . uniforms , image , Some ( window . options . background_color ) , & frame . output . view , ) ; if window . options . show_overlays { for overlay in & window . overlays { render_pass ( & mut encoder , & self . window_pipeline , & window . uniforms , overlay , None , & frame . output . view , ) ; } } self . queue . submit ( std :: iter :: once ( encoder . finish ( ) ) ) ; Ok ( ( ) ) }
Render the contents of a window.
Render the contents of a window .
&mut self
window_id
WindowId