Merge branch 'main' of codeberg.org:Caznix/Zenyx

This commit is contained in:
Chance 2025-04-03 01:02:53 -04:00 committed by BitSyndicate
commit ec74b0f93b
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 443E4198D6BBA6DE
7 changed files with 342 additions and 82 deletions

View file

@ -5,6 +5,7 @@ use std::time::Instant;
use cgmath::{Deg, Matrix4, Point3, Rad, SquareMatrix, Vector3, perspective};
use futures::executor::block_on;
use thiserror::Error;
use tracing::{debug, error, info, trace};
use wgpu::TextureUsages;
use wgpu::{Backends, InstanceDescriptor, util::DeviceExt};
@ -223,7 +224,7 @@ struct FontState {
impl<'window> Renderer<'window> {
pub async fn new(window: Arc<Window>) -> Result<Self> {
let instance = wgpu::Instance::new(&InstanceDescriptor {
backends: Backends::from_comma_list("dx12,metal,opengl,webgpu"),
backends: Backends::from_comma_list("dx12,metal,opengl,webgpu,vulkan"),
..Default::default()
});
@ -344,22 +345,31 @@ impl<'window> Renderer<'window> {
let camera = Camera::new(&device, &camera_bind_group_layout, width, height);
let surface_caps = surface.get_capabilities(&adapter);
let present_mode = [
wgpu::PresentMode::Immediate,
wgpu::PresentMode::Mailbox,
wgpu::PresentMode::AutoNoVsync,
]
.iter()
.copied()
.find(|mode| surface_caps.present_modes.contains(mode))
.unwrap_or(wgpu::PresentMode::Fifo);
debug!("Using {:#?} present mode.", present_mode);
let surface_config = wgpu::SurfaceConfiguration {
width,
height,
format: surface_caps.formats[0],
present_mode: wgpu::PresentMode::AutoNoVsync,
present_mode,
alpha_mode: wgpu::CompositeAlphaMode::Auto,
view_formats: vec![],
usage: TextureUsages::RENDER_ATTACHMENT,
desired_maximum_frame_latency: 3,
};
surface.configure(&device, &surface_config);
let (depth_texture, depth_texture_view) = create_depth_texture(
&device,
surface_config.width,
surface_config.height,
);
let (depth_texture, depth_texture_view) =
create_depth_texture(&device, surface_config.width, surface_config.height);
let font_bytes = include_bytes!("DejaVuSans.ttf");
let font = FontRef::try_from_slice(font_bytes).map_err(|e| {
@ -605,7 +615,6 @@ fn create_depth_texture(
device: &wgpu::Device,
width: u32,
height: u32,
// format: wgpu::TextureFormat,
) -> (wgpu::Texture, wgpu::TextureView) {
let size = wgpu::Extent3d {
width,