-
-
Notifications
You must be signed in to change notification settings - Fork 44
Improve get_current_texture for window resizing #705
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
Conversation
@ezorzin this is an attempt to avoid the resize errors you are having. Could you please help me test this? In this case that means installing wgpu-py from the repo and checking out this branch:
Then run the triangle example, forcing glfw and using rendercanvas: if __name__ == "__main__":
from rendercanvas.glfw import RenderCanvas, loop
canvas = RenderCanvas(size=(640, 480), title="wgpu triangle example")
canvas.testflag = 0
draw_frame = setup_drawing_sync(canvas)
canvas.request_draw(draw_frame)
loop.run() Could you try with setting the |
Actually, let's use |
Awesome! I realize that I made an oversight for the case that |
testflag = 1:
this time there is no redrawing artefact, no "printouts by itself". |
A bit of background on the With So I cleaned this up. @ezorzin Can I ask you one more time to:
If all is well, things should run smooth, without warnings, errors, or segfaults. |
I upgraded
Then I run triangle.py by using this code snippet:
and cube.py with this code snippet:
I run both programs testing them with the The results are good! No error printouts, no segmentation faults, no resizing artefacts. I tried resizing, "crazy fast" resizing, window minimizing, window maximizing: it looks this time it works! These are the text outputs of the programs when running:
cube.py:
|
Thank you for sticking with us! |
Woohoo! 🚀 @ezorzin I really appreciate the many times you ran my tests. It has made it possible to find the proper way to deal with the problem(s), while not being able to reproduce it. Grazie mille! |
It's my pleasure! Wgpu made Vulkan easy, you made Wgpu easy in Python: easy^2 :) Thanks! |
Ref pygfx/pygfx#642
This PR improves the logic for
canvas_context.get_current_texture()
, especially with regard to window resizing. This covers a use-case where on some Linux systems the texture status is 'outdated`.One problem is that we can get in a situation where we cannot successfully obtain a texture for the surface. There are a few options:
get_current_texture()
must catch. The downside is that it changes the API of the method compared to the WebGPU spec.