From 59240bf3875b4263b0c562a2e007483e486d73b2 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 14 May 2026 23:41:08 +0200 Subject: [PATCH] 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. --- lib/webgpu/gpu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/webgpu/gpu.cpp b/lib/webgpu/gpu.cpp index d42a2eb..f67e98d 100644 --- a/lib/webgpu/gpu.cpp +++ b/lib/webgpu/gpu.cpp @@ -113,6 +113,9 @@ TextureWithSampler create_render_texture(uint32_t width, uint32_t height, bool m if (multisampled) { sampleCount = g_graphicsConfig.msaaSamples; } + if (width == 0 || height == 0) { + Log.fatal("Invalid render texture size! {}x{}, multisampled {}, format {}", width, height, static_cast(format), multisampled); + } const wgpu::TextureDescriptor textureDescriptor{ .label = "Render texture", .usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |