Add minimum sizes to textures to prevent crash (#2300)
# Objective - Fixes #2299 ## Solution - Ensures that textures are never requested with 0 height/width.
This commit is contained in:
parent
e549f14359
commit
a40ec1c6b6
@ -67,8 +67,8 @@ impl Node for WindowTextureNode {
|
|||||||
render_resource_context.remove_texture(old_texture);
|
render_resource_context.remove_texture(old_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.descriptor.size.width = window.physical_width();
|
self.descriptor.size.width = window.physical_width().max(1);
|
||||||
self.descriptor.size.height = window.physical_height();
|
self.descriptor.size.height = window.physical_height().max(1);
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -645,8 +645,8 @@ impl WgpuFrom<&Window> for wgpu::SwapChainDescriptor {
|
|||||||
wgpu::SwapChainDescriptor {
|
wgpu::SwapChainDescriptor {
|
||||||
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
|
usage: wgpu::TextureUsage::RENDER_ATTACHMENT,
|
||||||
format: TextureFormat::default().wgpu_into(),
|
format: TextureFormat::default().wgpu_into(),
|
||||||
width: window.physical_width(),
|
width: window.physical_width().max(1),
|
||||||
height: window.physical_height(),
|
height: window.physical_height().max(1),
|
||||||
present_mode: if window.vsync() {
|
present_mode: if window.vsync() {
|
||||||
wgpu::PresentMode::Fifo
|
wgpu::PresentMode::Fifo
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user