From 570738c9b9dcf49e734cf7cea7cb0cf925a785f9 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Sat, 23 Mar 2024 23:18:01 +0100 Subject: [PATCH] Don't warn in present() (#479) * Don't warn in present() * Make it a debug log * more better improved comment" --- wgpu/backends/wgpu_native/_api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wgpu/backends/wgpu_native/_api.py b/wgpu/backends/wgpu_native/_api.py index fb1d2746..2973a1ad 100644 --- a/wgpu/backends/wgpu_native/_api.py +++ b/wgpu/backends/wgpu_native/_api.py @@ -649,9 +649,14 @@ def _create_python_texture(self, texture_id): def present(self): if not self._texture: - # Log warning but don't raise exception - msg = "No texture to present, missing call to get_current_texture()?" - logger.warning(msg) + # This can happen when a user somehow forgot to call + # get_current_texture(). But then what was this person rendering to + # then? The thing is that this also happens when there is an + # exception in the draw function before the call to + # get_current_texture(). In this scenario our warning may + # add confusion, so provide context and make it a debug level warning. + msg = "Warning in present(): No texture to present, missing call to get_current_texture()?" + logger.debug(msg) else: # Present the texture, then destroy it # H: void f(WGPUSurface surface)