Skip to content

Hiding a GLFW window causes surface error #819

Description

@almarklein
  • Run any wgpu-based example in the glfw canvas backend.
  • Hide the window, as in selecting your IDE or something so the glfw window gets behind it.
  • Errrors are raised.

This is present on MacOS on main. The latest release (v0.31.1) is fine.

The qt backend is fine, since that default to bitmap present-method. When using present_method='screen', it raises a similar error, but only on startup. With the WIP native osx backend it raises both on startup and when hidden.

I suppose that something changed upstream, that causes invisible windows not to have a valid surface? Maybe to prevent spending CPU and GPU cycles when its not visible anyway?

@Vipitis are you aware of any changed related to the surface texture?

Draw error
Traceback (most recent call last):
  File "/Users/almar/dev/py/rendercanvas/rendercanvas/core/coreutils.py", line 51, in log_exception
    yield
  File "/Users/almar/dev/py/rendercanvas/rendercanvas/base.py", line 589, in _draw_and_present
    self._draw_frame()
    ~~~~~~~~~~~~~~~~^^
  File "/Users/almar/dev/py/wgpu-py/examples/cube.py", line 345, in draw_func
    draw_frame()
    ~~~~~~~~~~^^
  File "/Users/almar/dev/py/wgpu-py/examples/cube.py", line 308, in draw_frame
    context.get_current_texture().create_view(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/almar/dev/py/rendercanvas/rendercanvas/contexts/wgpucontext.py", line 127, in get_current_texture
    return self._get_current_texture()
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/almar/dev/py/rendercanvas/rendercanvas/contexts/wgpucontext.py", line 165, in _get_current_texture
    return self._wgpu_context.get_current_texture()
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/almar/dev/py/wgpu-py/wgpu/_classes.py", line 447, in get_current_texture
    self._texture = self._create_texture_screen()
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/almar/dev/py/wgpu-py/wgpu/backends/wgpu_native/_api.py", line 1002, in _create_texture_screen
    raise RuntimeError(
        f"Cannot get surface texture: {status_str} ({status_int})."
    )
RuntimeError: Cannot get surface texture: Unknown (196609).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions