Skip to content

Commit 59240bf

Browse files
authored
Guard create_render_texture (#184)
Getting a *lot* of crashes in Sentry that seem to be this function allocating invalid render textures? So let's add a guard so we maybe can catch it in the act.
1 parent a41a0fb commit 59240bf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/webgpu/gpu.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ TextureWithSampler create_render_texture(uint32_t width, uint32_t height, bool m
113113
if (multisampled) {
114114
sampleCount = g_graphicsConfig.msaaSamples;
115115
}
116+
if (width == 0 || height == 0) {
117+
Log.fatal("Invalid render texture size! {}x{}, multisampled {}, format {}", width, height, static_cast<uint32_t>(format), multisampled);
118+
}
116119
const wgpu::TextureDescriptor textureDescriptor{
117120
.label = "Render texture",
118121
.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |

0 commit comments

Comments
 (0)