Descriptorize BindGroups.

This commit adds utils::MakeBindGroup to make code craeting bind groups
nicer to read. Additional tests are added that give 100% coverage of
ValidateBindGroupDescriptor.

BUG=dawn:3

Change-Id: I56e1da8c2952306ad233845b0ec3ec32aef793d9
Reviewed-on: https://dawn-review.googlesource.com/c/2802
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2018-12-05 07:18:30 +00:00
committed by Commit Bot service account
parent 006f218392
commit 6f9d21e805
35 changed files with 687 additions and 416 deletions

View File

@@ -75,10 +75,7 @@ TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
0, dawn::ShaderStageBit::Vertex, dawn::BindingType::StorageBuffer
}});
dawn::BufferView view = buffer.CreateBufferViewBuilder().SetExtent(0, 4).GetResult();
dawn::BindGroup bg = device.CreateBindGroupBuilder()
.SetLayout(bgl)
.SetBufferViews(0, 1, &view)
.GetResult();
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
// Use the buffer as both index and storage in the same pass
dawn::CommandBufferBuilder builder = AssertWillBeError(device.CreateCommandBufferBuilder());
@@ -107,10 +104,7 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(device, {{
0, dawn::ShaderStageBit::Vertex, dawn::BindingType::SampledTexture
}});
dawn::BindGroup bg = device.CreateBindGroupBuilder()
.SetLayout(bgl)
.SetTextureViews(0, 1, &view)
.GetResult();
dawn::BindGroup bg = utils::MakeBindGroup(device, bgl, {{0, view}});
// Create the render pass that will use the texture as an output attachment
dawn::RenderPassDescriptor renderPass = device.CreateRenderPassDescriptorBuilder()