Commit 1b450b92c561735d4ed6c24b7b0fdfa529de2bbc

Charlie Lao 2023-09-15T11:07:25

Vulkan: Fix buffer storage reuse bug when robustAccess is enabled There is an optimization in vulkan backend that when the bufferData is called and current storage size is big enough for new bufferData call, we just reuse the storage. Mean while, when hasRobustAccess() is true, we must use the VkBuffer with the exact user size that glBufferData call provides so that driver can set proper access boundary. In order to satisfy both requirement, if robust resource access is enabled, we create a separate VkBuffer with the exact user provided size but bind to the same memory. There is a bug here that if robustAccess is true, this buffer of user provided size is not been recreated when storage is reused but with different user size (both has same allocation size). This causes we keep using the smaller VkBuffer and subsequently causes missing triangles. This CL clears mBufferWithUserSize when size changes and storage is reused. The other bug here is that previously we are checking isRobustResourceInitEnabled, which is incorrect. We should check hasRobustAccess. This appears works for chrome possibly due to both are enabled. This CL switches it to check hasRobustAccess. This CL also renames mBufferForVertexArray to mBufferWithUserSize to reflect what its true meaning. Bug: chromium:1476475 Change-Id: I843cc3a705f8a582a97bc0307f03aa1eb9fad3ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4864003 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>