Vulkan: Partially workaround MoltenVK InvalidResource error #4880
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.
There's a bug with MoltenVK where binding a storage buffer more than once with different stage flags causes resource usage to register incorrectly, which causes the command buffer to fail. There's more information here: KhronosGroup/MoltenVK#1870
This PR partially works around this issue by setting the storage buffer usage flags to all active stages when running under MVK. This means that it will always register the buffer with all possible stages it can be used on.
This can still break if there are non-rasterizing draws, which generally happens with TFB games. Working around that is a lot more involved, and it's probably not worth it when we don't have TFB emulation anyways.
This should be removed when the issue is fixed in MoltenVK.