Add a workaround for a Windows NVIDIA Vulkan driver bug #8221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The NVIDIA Vulkan driver bug causes swap chains to be created with incorrect dimensions for native windows created with thread-specific DPI-awareness context.
This is a pretty subtle issue, and only affects processes where the process-wide DPI-awareness context is different from the thread-specific DPI-awareness context that was used to create a given native window. The Microsoft docs on this are pretty decent, and are super clear that the DPI-awareness of a HWND is whatever the DPI-awareness of the thread that created it was. The NVIDIA driver appears to be ignoring this. I suspect other drivers do as well.
This workaround has to be submitted into Filament itself because client code has no way to call a function on the Filament renderer thread, and so there's no way for a client to implement this workaround themselves.
I filed an upstream bug report with NVIDIA, but from what I can tell from other similar reports, they are not likely to fix the issue anytime soon.
Happy to answer any questions about this one; I know it's a bit hard to understand because it took me two days of beating my head against the wall to figure out myself. :D
(If you're curious why I am the first to see this, it's because my app is unusual in that it is a plugin that runs inside other applications. This is the exact kind of weird edge case that caused Microsoft to introduce the thread-specific DPI-awareness system, because the host application may have different DPI-awareness than the plugins it hosts.)