[wgpu-core] Call flush_mapped_ranges
when unmapping write-mapped buffers
#6089
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.
Connections
-
Description
flush_mapped_ranges
needs to be called for non-coherent write-mappings so that the data becomes visible to the GPU.We also need to call it for non-coherent read-mappings in cases where the memory needs to be 0 initialized.
This is only needed for Vulkan and GL but even then, I'm not sure how things worked so far.
Vulkan says:
GL says:
Both specs seem to say that users that want to guarantee that the data is flushed should call the function. But they don't say that if users don't call the function the data won't be flushed.
So, it could be that the drivers are flushing internally?
Testing
Existing tests.