Skip to content

Commit

Permalink
Don't warn in present() (#479)
Browse files Browse the repository at this point in the history
* Don't warn in present()

* Make it a debug log

* more better improved comment"
  • Loading branch information
almarklein authored Mar 23, 2024
1 parent e813541 commit 570738c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions wgpu/backends/wgpu_native/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 570738c

Please sign in to comment.