mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Fix Vulkan buffer barriers to use VK_WHOLE_SIZE
Buffers are padded to be at least 4 bytes. Dawn would produce invalid barriers for buffers that were "zero" bytes large. The size for the barrier must be either non-zero or VK_WHOLE_SIZE. Since we always intend to transition the entire buffer, simply use VK_WHOLE_SIZE instead of GetSize() as the size. Fixed: dawn:969 Change-Id: Ifed4e8f9164bafa3c44917074fcf214e72919c56 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57940 Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
@@ -243,7 +243,10 @@ namespace dawn_native { namespace vulkan {
|
||||
barrier->dstQueueFamilyIndex = 0;
|
||||
barrier->buffer = mHandle;
|
||||
barrier->offset = 0;
|
||||
barrier->size = GetSize();
|
||||
// Size must be non-zero or VK_WHOLE_SIZE. Use WHOLE_SIZE
|
||||
// instead of GetSize() because the buffer allocation may
|
||||
// be padded.
|
||||
barrier->size = VK_WHOLE_SIZE;
|
||||
|
||||
mLastUsage = usage;
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace dawn_native { namespace vulkan {
|
||||
private:
|
||||
~Buffer() override;
|
||||
using BufferBase::BufferBase;
|
||||
|
||||
MaybeError Initialize(bool mappedAtCreation);
|
||||
void InitializeToZero(CommandRecordingContext* recordingContext);
|
||||
void ClearBuffer(CommandRecordingContext* recordingContext, uint32_t clearValue);
|
||||
|
||||
Reference in New Issue
Block a user