Fix wgpu::WholeSize not being set correctly inside BindGroup

The only test where this can matter at the moment is the OpArrayLength
test, so one of the buffers tested is repurposed to test wgpu::WholeSize
with an offset.

Bug: dawn:377
Change-Id: I43f22f614dff55e399246c46892a865ec77f13c4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19080
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-09 12:17:00 +00:00 committed by Commit Bot service account
parent 989f139ceb
commit d9c2e89ef1
2 changed files with 5 additions and 4 deletions

View File

@ -227,8 +227,9 @@ namespace dawn_native {
ASSERT(mBindingData.bindings[bindingIndex].Get() == nullptr); ASSERT(mBindingData.bindings[bindingIndex].Get() == nullptr);
mBindingData.bindings[bindingIndex] = binding.buffer; mBindingData.bindings[bindingIndex] = binding.buffer;
mBindingData.bufferData[bindingIndex].offset = binding.offset; mBindingData.bufferData[bindingIndex].offset = binding.offset;
uint64_t bufferSize = uint64_t bufferSize = (binding.size == wgpu::kWholeSize)
(binding.size == wgpu::kWholeSize) ? binding.buffer->GetSize() : binding.size; ? binding.buffer->GetSize() - binding.offset
: binding.size;
mBindingData.bufferData[bindingIndex].size = bufferSize; mBindingData.bufferData[bindingIndex].size = bufferSize;
continue; continue;
} }

View File

@ -32,7 +32,7 @@ class OpArrayLengthTest : public DawnTest {
bufferDesc.size = 256; bufferDesc.size = 256;
mStorageBuffer256 = device.CreateBuffer(&bufferDesc); mStorageBuffer256 = device.CreateBuffer(&bufferDesc);
bufferDesc.size = 512; bufferDesc.size = 512 + 256;
mStorageBuffer512 = device.CreateBuffer(&bufferDesc); mStorageBuffer512 = device.CreateBuffer(&bufferDesc);
// Put them all in a bind group for tests to bind them easily. // Put them all in a bind group for tests to bind them easily.
@ -47,7 +47,7 @@ class OpArrayLengthTest : public DawnTest {
{ {
{0, mStorageBuffer4, 0, 4}, {0, mStorageBuffer4, 0, 4},
{1, mStorageBuffer256, 0, wgpu::kWholeSize}, {1, mStorageBuffer256, 0, wgpu::kWholeSize},
{2, mStorageBuffer512, 0, 512}, {2, mStorageBuffer512, 256, wgpu::kWholeSize},
}); });
// Common shader code to use these buffers in shaders, assuming they are in bindgroup index // Common shader code to use these buffers in shaders, assuming they are in bindgroup index