Skip to content

Conversation

@dzaima
Copy link
Contributor

@dzaima dzaima commented Jan 10, 2026

From what I can tell, fully reinitializing DirectContext is generally undesirable outside of extraordinary situations, and indeed the Metal and D3D12 backends do not do so. Doing that also kills all offscreen Surfaces, forcing unnecessarily discarding & recreating them.

Marking this PR as a draft for now as I don't particularly know how sane the _directContext.resetGLAll(); is (without it there are some graphical glitches), but it does work for the dashboard example and my programs on linux, and allows for me to preserve Surfaces across resizing; will report tomorrow on Windows, don't have macos to test on.

(this whole thing was brought on by me using "is current surface equal to previous surface" as a test for whether I should recreate my offscreen surfaces, which I needed to do for Linux/GL, but the D3D12 backend creates a new surface on every frame not just resizes, making my programs unnecessarily-slow from recreating & redrawing everything on every frame)

@dzaima
Copy link
Contributor Author

dzaima commented Jan 14, 2026

finally got to testing on Windows - works better than before! Without this patch, LayerGLSkija on Windows had extremely-slow resizing, but this fixes that! Testing both on the JWM dashboard example, and in my programs.

@dzaima dzaima marked this pull request as ready for review January 14, 2026 19:10
@tonsky
Copy link
Collaborator

tonsky commented Jan 14, 2026

Thanks! I’ll take a look this weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants