Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate warning in test suite #621

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions wgpu/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,6 @@ def __init__(self, canvas):
self._ot.increase(self.__class__.__name__)
self._canvas_ref = weakref.ref(canvas)

# The configuration from the canvas, obtained with canvas.get_present_info()
self._present_info = canvas.get_present_info()
if self._present_info.get("method", None) not in ("screen", "image"):
raise RuntimeError(
"canvas.get_present_info() must produce a dict with a field 'method' that is either 'screen' or 'image'."
)

# Surface capabilities. Stored the first time it is obtained
self._capabilities = None

Expand All @@ -234,6 +227,13 @@ def __init__(self, canvas):
# The last used texture
self._texture = None

# The configuration from the canvas, obtained with canvas.get_present_info()
self._present_info = canvas.get_present_info()
if self._present_info.get("method", None) not in ("screen", "image"):
raise RuntimeError(
"canvas.get_present_info() must produce a dict with a field 'method' that is either 'screen' or 'image'."
)

def _get_canvas(self):
"""Getter method for internal use."""
return self._canvas_ref()
Expand Down