Texture creation from existing GPU texture#1257
Draft
Vipitis wants to merge 5 commits intopygfx:mainpygfx/pygfx:mainfrom
Draft
Texture creation from existing GPU texture#1257Vipitis wants to merge 5 commits intopygfx:mainpygfx/pygfx:mainfrom
Vipitis wants to merge 5 commits intopygfx:mainpygfx/pygfx:mainfrom
Conversation
This was referenced Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hey, first PR here.
This mostly undoes the dependency inversion from pygfx/rendercanvas#153 by adding a classmethod that avoids the existing constructor and hopefully writes all required attributes.
Includes the same example but is much simpler as offscreen canvas context sorta works out of the box (I think it skips frames randomly as there is no managed swap chain).
I did a few tweaks to shadertoy to make it work, so this won't work with the main branch as is. Maybe it should just be the wgpu cube instead since this doesn't need the rendercanvas protocol and should just work with a manual render target. It also works if you create the texture from the
.wgpu_objectof agfx.Texturebut that is very constructed...I am still new to this codebase so I just included everything that looked relevant. I didn't try any of the resource functionality.
Open for discussion and commits into this branch (always), don't indent to make decisions as I am only tangentially using pygfx via fpl and real users might need different functionality. I also want to bring this sorta functionality to the shadertoy project, but it would be great to decide on a common interface.
connections: