Skip to content

handle the Occluded case directly within TryGetCurrentTexture#1

Merged
oliverbestmann merged 1 commit into
oliverbestmann:mainfrom
rcoreilly:main
May 11, 2026
Merged

handle the Occluded case directly within TryGetCurrentTexture#1
oliverbestmann merged 1 commit into
oliverbestmann:mainfrom
rcoreilly:main

Conversation

@rcoreilly
Copy link
Copy Markdown

Occluded status does NOT require reconfiguring the surface, and it DOES require calling glfw.PollEvents, while other status situations (Lost, Outdated, Suboptimal, etc) DO require reconfiguring.

And the Occluded case is (currently) effectively unavoidable on mac, so this allows most code to work fine without specifically doing anything for the more complicated case of having to reconfigure.

In any case, adding the SurfaceTexture with the status is a nice addition for those other cases.

…e it does NOT require reconfiguring the surface, and it DOES require calling glfw.PollEvents -- which others would not presumably.
@rcoreilly
Copy link
Copy Markdown
Author

ps. this is referencing the discussion in: cogentcore#13 and the upstream change that added the Occluded status in the first place, in v29 of wgpu: gfx-rs/wgpu#9430

@rcoreilly
Copy link
Copy Markdown
Author

@oliverbestmann any chance you could take a look at this soon? resolving this would allow me to move forward with using this in cogentcore.

@oliverbestmann
Copy link
Copy Markdown
Owner

Sorry, I'll have a look in a second. I didn't see this here at all

@oliverbestmann
Copy link
Copy Markdown
Owner

I'll merge this for now, but I think I might be reworking this in the future. I don't like that this forces you to use glfw for your windowing/input library.

@oliverbestmann oliverbestmann merged commit df49f50 into oliverbestmann:main May 11, 2026
4 checks passed
@rcoreilly
Copy link
Copy Markdown
Author

Yeah, it would be best if somehow the critical underlying fuction(s) that PollEvents is calling that allow things to proceed could be called directly. But who knows what those are? And in general, this is what the metal driver in the rust wgpu code should be doing on its own, without bothering us with this level of management. Probably makes sense to wait and see what they end up deciding to do with this all, before trying to do something else.

@rcoreilly
Copy link
Copy Markdown
Author

ps. @oliverbestmann are you going to commit a tag for this version? :)

@rcoreilly
Copy link
Copy Markdown
Author

@oliverbestmann actually there is a real problem with this version -- you should undo it! Sorry!

The problem is that the glfw.PollEvents can only be called from the main thread, but this is not a restriction for the parent TryGetCurrentTexture function, so indeed one has to handle it separately!

@rcoreilly
Copy link
Copy Markdown
Author

I only discovered this in my more complex live cogentcore code, where unlike the simple examples, there are multiple goroutines handing everything.

@oliverbestmann
Copy link
Copy Markdown
Owner

Haha, yea okay, I've reverted your commit and tagged v1.33.2.

@rcoreilly
Copy link
Copy Markdown
Author

Looks like that tag didn't make it up to github?

@oliverbestmann
Copy link
Copy Markdown
Owner

Sorry, should be there now. I'll try to add some automation soon.

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

Successfully merging this pull request may close these issues.

2 participants