Fix trying to create a zero sized shadow texture when resizing window down to a small size

This commit is contained in:
Imbris 2021-06-15 01:53:00 -04:00
parent 109d87bf81
commit cbf0a6baf1

View File

@ -188,7 +188,9 @@ impl ShadowMap {
let diag_two_size = u32::checked_next_power_of_two(diag_size)
.filter(|&e| e <= max_texture_size)
// Limit to max texture resolution rather than error.
.unwrap_or(max_texture_size);
.unwrap_or(max_texture_size)
// Make sure we don't try to create a zero sized texture (divided by 4 below)
.max(4);
let point_shadow_tex = wgpu::TextureDescriptor {
label: None,