Skip to content

Make the bitmap present_method faster #66

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

Open
almarklein opened this issue Mar 19, 2025 · 1 comment
Open

Make the bitmap present_method faster #66

almarklein opened this issue Mar 19, 2025 · 1 comment

Comments

@almarklein
Copy link
Member

It would be great if we can improve the bitmap present_mode. Improving it's support and performance.

There's multiple reasons:

The main problem right now is that when downloading the texture, we wait for it to arrive in CPU-land. A more asynchronous approach would allow this to happen while we start processing stuff for the next draw. Which means that the performance loss can become much smaller or even negligible. For this to happen we need to do things in multiple libraries:

  • Rendercanvas would need to adjust its scheduling to make this possible.
  • wgpu-py should get support for async callbacks.
  • rendercavas' scheduling loop should regularly ping the wgpu instance.
  • Pygfx probably also needs some changes.

Other possible improvements:

  • For Qt, using a QGLWidget may improve the speed of presenting the image. But we should probably test this first, since Qt may have optimized its painter.drawImage() so much that it does not matter.
  • For glfw, we could enter GL mode and present the bitmap that way. Would be nice if we can do that without adding extra dependencies. Loading the GL lib is not that hard, we can take some code from vispy
  • Maybe we can pass the data pointer to OpenGL before unmapping the buffer, avoiding a data-copy.
@drlukeparry
Copy link

@almarklein - sounds a nice alternative to not requiring to obtain the raw_handle wgpu, this can be achieved in a future development of the rendercanvas. If you can find a method to transfer or render to a specific surface without needing to rely on QPainter class this would be helpful but also improve performance. This would open up a lot of opportunities, previously mentioned to integrate with other frameworks, including Qt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants