Dynamic Buffer Offset : Vulkan Backend

In a typical application, most draws will use different uniforms values for
things like the world position and orientation. In the current state of WebGPU
this means that a new bind group needs to be created for each draw to set the
right uniforms. Bind group creation is expected to be more expensive than
recording draws because they incur an allocation.

This feature is to reduce the number of bind groups that need to be
created.

The patch implements dynamic buffer offset on vulkan backend. But Vulkan
takes dynamic offset as uint32_t type, which is not the same size as the VkDeviceSize
used to create buffers so we cast them for now.

Bug=dawn:55

Change-Id: I6163866feb040d1a653f9a20d2ce22d80509968e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7461
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Yan, Shaobo
2019-05-27 04:35:03 +00:00
committed by Commit Bot service account
parent 7777078fb9
commit 3dd6153eb7
4 changed files with 40 additions and 17 deletions

View File

@@ -56,7 +56,6 @@ class DynamicBufferOffsetTests : public DawnTest {
}
// Create objects to use as resources inside test bind groups.
const void* mappedData = nullptr;
dawn::BindGroup mBindGroup;
dawn::BindGroupLayout mBindGroupLayout;
dawn::Buffer mUniformBuffer;
@@ -212,4 +211,4 @@ TEST_P(DynamicBufferOffsetTests, SetDynamicOffestsComputePipeline) {
kMinDynamicBufferOffsetAlignment, expectedData.size());
}
DAWN_INSTANTIATE_TEST(DynamicBufferOffsetTests, MetalBackend);
DAWN_INSTANTIATE_TEST(DynamicBufferOffsetTests, MetalBackend, VulkanBackend);