Skip to content

Commit

Permalink
Merge pull request #437 from hannobraun/graphics
Browse files Browse the repository at this point in the history
Fix issue on my new AMD GPU
  • Loading branch information
hannobraun authored Apr 7, 2022
2 parents 7c0e0e3 + 625088d commit 054f4ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 6 additions & 6 deletions fj-app/src/graphics/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Renderer {
format: color_format,
width: window.width(),
height: window.height(),
present_mode: wgpu::PresentMode::Fifo,
present_mode: wgpu::PresentMode::Mailbox,
};
surface.configure(&device, &surface_config);

Expand Down Expand Up @@ -300,24 +300,24 @@ impl Renderer {

#[derive(Error, Debug)]
pub enum InitError {
#[error("I/O error")]
#[error("I/O error: {0}")]
Io(#[from] io::Error),

#[error("Error request adapter")]
RequestAdapter,

#[error("Error requesting device")]
#[error("Error requesting device: {0}")]
RequestDevice(#[from] wgpu::RequestDeviceError),

#[error("Error loading font")]
#[error("Error loading font: {0}")]
InvalidFont(#[from] InvalidFont),
}

#[derive(Error, Debug)]
pub enum DrawError {
#[error("Error acquiring output surface")]
#[error("Error acquiring output surface: {0}")]
Surface(#[from] wgpu::SurfaceError),

#[error("Error drawing text")]
#[error("Error drawing text: {0}")]
Text(String),
}
9 changes: 3 additions & 6 deletions fj-app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use fj_kernel::algorithms::triangulate;
use fj_math::{Aabb, Scalar, Triangle};
use fj_operations::ToShape as _;
use futures::executor::block_on;
use tracing::trace;
use tracing::{trace, warn};
use tracing_subscriber::fmt::format;
use tracing_subscriber::EnvFilter;
use winit::{
Expand Down Expand Up @@ -224,11 +224,8 @@ fn main() -> anyhow::Result<()> {
if let (Some(shape), Some(camera)) = (&shape, &mut camera) {
camera.update_planes(&shape.aabb);

match renderer.draw(camera, &draw_config) {
Ok(()) => {}
Err(err) => {
panic!("Draw error: {}", err);
}
if let Err(err) = renderer.draw(camera, &draw_config) {
warn!("Draw error: {}", err);
}
}
}
Expand Down

0 comments on commit 054f4ac

Please sign in to comment.