diff --git a/src/dawn_native/BindGroup.cpp b/src/dawn_native/BindGroup.cpp index c81a2cca11..421cc2a5ff 100644 --- a/src/dawn_native/BindGroup.cpp +++ b/src/dawn_native/BindGroup.cpp @@ -227,8 +227,9 @@ namespace dawn_native { ASSERT(mBindingData.bindings[bindingIndex].Get() == nullptr); mBindingData.bindings[bindingIndex] = binding.buffer; mBindingData.bufferData[bindingIndex].offset = binding.offset; - uint64_t bufferSize = - (binding.size == wgpu::kWholeSize) ? binding.buffer->GetSize() : binding.size; + uint64_t bufferSize = (binding.size == wgpu::kWholeSize) + ? binding.buffer->GetSize() - binding.offset + : binding.size; mBindingData.bufferData[bindingIndex].size = bufferSize; continue; } diff --git a/src/tests/end2end/OpArrayLengthTests.cpp b/src/tests/end2end/OpArrayLengthTests.cpp index fcd60efd21..fa795bfb87 100644 --- a/src/tests/end2end/OpArrayLengthTests.cpp +++ b/src/tests/end2end/OpArrayLengthTests.cpp @@ -32,7 +32,7 @@ class OpArrayLengthTest : public DawnTest { bufferDesc.size = 256; mStorageBuffer256 = device.CreateBuffer(&bufferDesc); - bufferDesc.size = 512; + bufferDesc.size = 512 + 256; mStorageBuffer512 = device.CreateBuffer(&bufferDesc); // 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}, {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