Skip to content

add SurfaceCapabilities to PixelsContext#424

Merged
parasyte merged 2 commits intoparasyte:mainfrom
alago1:main
Jun 7, 2025
Merged

add SurfaceCapabilities to PixelsContext#424
parasyte merged 2 commits intoparasyte:mainfrom
alago1:main

Conversation

@alago1
Copy link
Copy Markdown
Contributor

@alago1 alago1 commented Jun 1, 2025

Small change to expose the SurfaceCapabilities struct used when building the Pixels instance through the PixelsContext.

This should allow conditionally setting wgpu PresentMode based on the available options for the Pixels surface (Issue #423).

Copy link
Copy Markdown
Owner

@parasyte parasyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@parasyte
Copy link
Copy Markdown
Owner

parasyte commented Jun 1, 2025

It looks like this will technically allow the developer to "fix up" PresentMode after the surface has already been configured.

Another option is to do the obvious thing when creating the surface: If the chosen PresentMode is not already in the list of capabilities, replace it with the first one available. Any other complex fallback logic can be delegated to user code with the new PixelsContext::surface_capabilities field. WDYT? I'm ok with having that as a separate PR, too.

@alago1
Copy link
Copy Markdown
Contributor Author

alago1 commented Jun 2, 2025

That makes sense. I added another commit to this PR which handles this and clarifies the language in the PixelsBuilder::present_mode to be an 'optimistic setter' rather than providing any guarantees about the state once the surface is actually built.

Also, I used AutoVsync as the default case since it's always supported (wgpu docs) and is what's currently set by Pixels anyway.

@alago1 alago1 requested a review from parasyte June 7, 2025 19:17
@parasyte
Copy link
Copy Markdown
Owner

parasyte commented Jun 7, 2025

Sorry for the delay. I’m returning home from vacation right now. The change looks good and I’ll get this merged as I find time.

@parasyte parasyte merged commit 3d3b318 into parasyte:main Jun 7, 2025
9 checks passed
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