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

Calling Surface::get_current_texture is not idempotent #5140

Open
udoprog opened this issue Jan 24, 2024 · 0 comments
Open

Calling Surface::get_current_texture is not idempotent #5140

udoprog opened this issue Jan 24, 2024 · 0 comments
Labels
type: bug Something isn't working

Comments

@udoprog
Copy link
Contributor

udoprog commented Jan 24, 2024

Relates to the question posed in: #4967
Relates to #5138

Description

When using native backends, Surface::get_current_texture currently calls directly into the backend to return a surface texture, this call is not idempotent in wgpu-core.

A handle to the same texture should instead be returned until it has "expired". Which happens through (among other things) it being presented or the underlying surface being reconfigured.

While calling Surface::get_current_texture multiple times would be atypical, the API does not prevent a user from doing so. @grovesNL noted on matrix that the specified behavior is to return the same texture until it is expired.

Platform

Vulkan: This would allow the caller to exhaust the available wait semaphores before they have been used correctly (by presenting the surface). This might cause strange synchronization issues - the exact behavior would depend on timing, the state of the semaphores, and the Vulkan implementation in question.

I have not looked into the behavior of other backends.

@nical nical added the type: bug Something isn't working label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants