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

Guard against CAMetalDrawable with invalid pixel format. #2012

Merged

Conversation

billhollings
Copy link
Contributor

  • Calling nextDrawable may result in a nil drawable, or a drawable with no pixel format. Attempt several times to retrieve a drawable with a valid pixel format, and if unsuccessful, return an error from vkQueuePresentKHR() and vkAcquireNextImageKHR(), to force swapchain to be re-created.
  • Reorganize MVKQueuePresentSurfaceSubmission::execute() to detect drawable with invalid format, attach MTLCommandBuffer completion handler just before commit, and delay enqueuing MTLCommandBuffer until commit.
  • Refactor mvkOSVersionIsAtLeast() for clarity (unrelated).

Possible fix for #1990.

- Calling nextDrawable may result in a nil drawable, or a drawable with no
  pixel format. Attempt several times to retrieve a drawable with a valid
  pixel format, and if unsuccessful, return an error from vkQueuePresentKHR()
  and vkAcquireNextImageKHR(), to force swapchain to be re-created.
- Reorganize MVKQueuePresentSurfaceSubmission::execute() to detect drawable
  with invalid format, attach MTLCommandBuffer completion handler just before
  commit, and delay enqueuing MTLCommandBuffer until commit.
- Refactor mvkOSVersionIsAtLeast() for clarity (unrelated).
Common/MVKOSExtensions.h Outdated Show resolved Hide resolved
Co-authored-by: Chip Davis <cdavis5x@gmail.com>
@billhollings billhollings merged commit ea5bf37 into KhronosGroup:main Sep 7, 2023
5 checks passed
@billhollings billhollings deleted the fix-drwbl-invalid-format branch September 7, 2023 14:37
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