parent
b5ffab7135
commit
c05c1dc119
@ -68,8 +68,8 @@ impl Node for WindowTextureNode {
|
|||||||
render_resource_context.remove_texture(old_texture);
|
render_resource_context.remove_texture(old_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.descriptor.size.width = window.width();
|
self.descriptor.size.width = window.scaled_width();
|
||||||
self.descriptor.size.height = window.height();
|
self.descriptor.size.height = window.scaled_height();
|
||||||
let texture_resource = render_resource_context.create_texture(self.descriptor);
|
let texture_resource = render_resource_context.create_texture(self.descriptor);
|
||||||
output.set(WINDOW_TEXTURE, RenderResourceId::Texture(texture_resource));
|
output.set(WINDOW_TEXTURE, RenderResourceId::Texture(texture_resource));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -564,8 +564,8 @@ impl WgpuFrom<&Window> for wgpu::SwapChainDescriptor {
|
|||||||
wgpu::SwapChainDescriptor {
|
wgpu::SwapChainDescriptor {
|
||||||
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
|
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
|
||||||
format: TextureFormat::default().wgpu_into(),
|
format: TextureFormat::default().wgpu_into(),
|
||||||
width: window.width(),
|
width: window.scaled_width(),
|
||||||
height: window.height(),
|
height: window.scaled_height(),
|
||||||
present_mode: if window.vsync() {
|
present_mode: if window.vsync() {
|
||||||
wgpu::PresentMode::Mailbox
|
wgpu::PresentMode::Mailbox
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -125,6 +125,14 @@ impl Window {
|
|||||||
self.width
|
self.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn scaled_width(&self) -> u32 {
|
||||||
|
(self.width as f64 * self.scale_factor) as u32
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn scaled_height(&self) -> u32 {
|
||||||
|
(self.height as f64 * self.scale_factor) as u32
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn height(&self) -> u32 {
|
pub fn height(&self) -> u32 {
|
||||||
self.height
|
self.height
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user