Vulkan: Fix keeping overlapped updates in flushStagedUpdatesImpl() There is an existing bug in ImageHelper::flushStagedUpdatesImpl() that caused webGPU test to fail when my CL crrev.com/c/5588816 landed. The bug is that when we flush out an update, we walk through the vector updates and if the update is outside the range of requested layer range, we stash away the update to updatesToKeep list. We only flush out the updates that are intersects with the requested layer range. The bug here is that if one of the update has bigger layer range than the requested layer range, and there is an update that intersects with that update's layer range but not overlap with requested layer range, now that update may incorrectly gets moved to updatesToKeep list. Later on when that updatesToKeep list gets flushed out, you end up overwriting the image content. This CL adds a new function adjustLayerRange() that first walk the updates and calculate the actual layer range that will be flushed and then use that adjusted layer range to determine if an update should be kept or flushed. Bug: angleproject:345532371 Change-Id: I59ef4ec935354766d35e4cfbb6ce4b13d9a2e868 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5607276 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Charlie Lao <cclao@google.com>