Compare commits

..
5 Commits
4 changed files with 7 additions and 9 deletions

No files matched your search

Generated
-1
View File
@@ -1070,7 +1070,6 @@ dependencies = [
"fxhash",
"image",
"wgpu",
"winit",
]
[[package]]
-1
View File
@@ -4,7 +4,6 @@ version.workspace = true
edition.workspace = true
[dependencies]
winit = { workspace = true }
wgpu = { workspace = true }
bytemuck ={ workspace = true }
image = { workspace = true }
+5 -5
View File
@@ -3,14 +3,13 @@ use std::num::NonZero;
use crate::{
UiData, UiRenderState,
render::{data::PrimitiveInstance, texture::GpuTextures, util::ArrBuf},
util::HashMap,
util::{HashMap, Vec2},
};
use data::WindowUniform;
use wgpu::{
util::{BufferInitDescriptor, DeviceExt},
*,
};
use winit::dpi::PhysicalSize;
mod data;
mod primitive;
@@ -118,10 +117,11 @@ impl UiRenderNode {
}
}
pub fn resize(&mut self, size: &PhysicalSize<u32>, queue: &Queue) {
pub fn resize(&mut self, size: impl Into<Vec2>, queue: &Queue) {
let size = size.into();
let slice = &[WindowUniform {
width: size.width as f32,
height: size.height as f32,
width: size.x,
height: size.y,
}];
queue.write_buffer(&self.window_buffer, 0, bytemuck::cast_slice(slice));
}
+2 -2
View File
@@ -52,7 +52,7 @@ impl UiRenderer {
self.config.width = size.width;
self.config.height = size.height;
self.surface.configure(&self.device, &self.config);
self.ui.resize(size, &self.queue);
self.ui.resize((size.width, size.height), &self.queue);
}
fn create_encoder(device: &Device) -> CommandEncoder {
@@ -115,7 +115,7 @@ impl UiRenderer {
format: surface_format,
width: size.width,
height: size.height,
present_mode: PresentMode::AutoNoVsync,
present_mode: PresentMode::AutoVsync,
alpha_mode: surface_caps.alpha_modes[0],
desired_maximum_frame_latency: 2,
view_formats: vec![],