Skip to content
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

GPU: recreate swapchain on window pixel size change event #10985

Merged
merged 6 commits into from
Sep 29, 2024

Conversation

thatcosmonaut
Copy link
Collaborator

This avoids querying window size in a relatively hot function, SDL_AcquireGPUSwapchainTexture.

Also removes a pointless Vulkan surface extent check, the limits are guaranteed by the spec.

@slouken
Copy link
Collaborator

slouken commented Sep 28, 2024

This seems good to me. We might need some locking in case something is recreating the swap chain while this event comes in on the main thread.

I assume this PR obsoletes #10984?

@thatcosmonaut
Copy link
Collaborator Author

This seems good to me. We might need some locking in case something is recreating the swap chain while this event comes in on the main thread.

I assume this PR obsoletes #10984?

It actually complements that PR - they should both go in. You're right, we should lock on the window data.

@slouken
Copy link
Collaborator

slouken commented Sep 28, 2024

This seems good to me. We might need some locking in case something is recreating the swap chain while this event comes in on the main thread.
I assume this PR obsoletes #10984?

It actually complements that PR - they should both go in. You're right, we should lock on the window data.

Okay, then @Akaricchi's comment on that PR is valid, and that shouldn't be merged until it's resolved.

@thatcosmonaut
Copy link
Collaborator Author

@slouken do the mutexes in the latest commit look good to you? If so this can go in before the other PR.

@thatcosmonaut
Copy link
Collaborator Author

This is good to go once CI passes

Copy link
Collaborator

@flibitijibibo flibitijibibo left a comment

Choose a reason for hiding this comment

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

Latest looks good - we could maybe put the watcher in gpu.c and make a driver function to be sure all drivers are always aware of resizes but that could be done later if needed.

@thatcosmonaut
Copy link
Collaborator Author

Yeah a NotifyResize function on sysgpu.h could be nice, but we can do that later.

@thatcosmonaut thatcosmonaut merged commit fc242ab into libsdl-org:main Sep 29, 2024
38 checks passed
@thatcosmonaut thatcosmonaut deleted the gpu_swapchain_rework branch September 29, 2024 01:10
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.

3 participants