Skip to content

Fix Metal layer detection in Qt 6.10 and newer#270

Merged
SaschaWillems merged 1 commit into
SaschaWillems:masterfrom
niklaskorz:fix-macos-qt6
Mar 30, 2026
Merged

Fix Metal layer detection in Qt 6.10 and newer#270
SaschaWillems merged 1 commit into
SaschaWillems:masterfrom
niklaskorz:fix-macos-qt6

Conversation

@niklaskorz

Copy link
Copy Markdown
Contributor

As of Qt 6.10, the Metal layer is nested in an intermediary QContainerLayer:

qt/qtbase@0bdbf46

This came up while bumping vulkan-caps-viewer in nixpkgs, where Qt6 is at version 6.10.2.

Error message on launch without this fix:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[QContainerLayer naturalDrawableSizeMVK]: unrecognized selector sent to instance 0x600003c9cd80'

@niklaskorz

Copy link
Copy Markdown
Contributor Author

Of course as-is, this patch would fail to launch on Qt <6.10, so let me know if you prefer a more flexible solution.

@SaschaWillems

Copy link
Copy Markdown
Owner

As the caps viewer is also packaged with the SDK, and that isn't done by me, changes like these need to be backwards compatible. So yes, in order to take this, it needs to properly work with the current Qt version.

@niklaskorz

niklaskorz commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

The function now first checks if the view's own layer is a CAMetalLayer already, and only if it's not and the contentLayer method is supported, it retrieves the nested content layer instead.

@SaschaWillems SaschaWillems merged commit 2b2060c into SaschaWillems:master Mar 30, 2026
6 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