Use GetBindGroupLayout in ComputeStorageBufferBarrierTests

Bug: dawn:276
Change-Id: I204226ab4535b69ea6a59be857c3a7bf4e71b47e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14025
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng 2019-12-03 21:14:55 +00:00 committed by Commit Bot service account
parent e40c87c986
commit ac89f2d619

View File

@ -41,19 +41,14 @@ TEST_P(ComputeStorageBufferBarrierTests, AddIncrement) {
}
)");
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer}});
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, bufferSize}});
wgpu::PipelineLayout layout = utils::MakeBasicPipelineLayout(device, &bgl);
wgpu::ComputePipelineDescriptor pipelineDesc = {};
pipelineDesc.layout = layout;
pipelineDesc.computeStage.module = module;
pipelineDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
wgpu::BindGroup bindGroup =
utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), {{0, buffer, 0, bufferSize}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
@ -95,17 +90,18 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
}
)");
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer}});
wgpu::ComputePipelineDescriptor pipelineDesc = {};
pipelineDesc.computeStage.module = module;
pipelineDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, bgl,
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{
{0, bufferA, 0, bufferSize},
{1, bufferB, 0, bufferSize},
});
wgpu::BindGroup bindGroupB = utils::MakeBindGroup(device, bgl,
wgpu::BindGroup bindGroupB = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{
{0, bufferB, 0, bufferSize},
{1, bufferA, 0, bufferSize},
@ -113,14 +109,6 @@ TEST_P(ComputeStorageBufferBarrierTests, AddPingPong) {
wgpu::BindGroup bindGroups[2] = {bindGroupA, bindGroupB};
wgpu::PipelineLayout layout = utils::MakeBasicPipelineLayout(device, &bgl);
wgpu::ComputePipelineDescriptor pipelineDesc = {};
pipelineDesc.layout = layout;
pipelineDesc.computeStage.module = module;
pipelineDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(pipeline);
@ -168,17 +156,18 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
}
)");
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Compute, wgpu::BindingType::UniformBuffer},
{1, wgpu::ShaderStage::Compute, wgpu::BindingType::StorageBuffer}});
wgpu::ComputePipelineDescriptor pipelineDesc = {};
pipelineDesc.computeStage.module = module;
pipelineDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, bgl,
wgpu::BindGroup bindGroupA = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{
{0, bufferA, 0, bufferSize},
{1, bufferB, 0, bufferSize},
});
wgpu::BindGroup bindGroupB = utils::MakeBindGroup(device, bgl,
wgpu::BindGroup bindGroupB = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
{
{0, bufferB, 0, bufferSize},
{1, bufferA, 0, bufferSize},
@ -186,14 +175,6 @@ TEST_P(ComputeStorageBufferBarrierTests, UniformToStorageAddPingPong) {
wgpu::BindGroup bindGroups[2] = {bindGroupA, bindGroupB};
wgpu::PipelineLayout layout = utils::MakeBasicPipelineLayout(device, &bgl);
wgpu::ComputePipelineDescriptor pipelineDesc = {};
pipelineDesc.layout = layout;
pipelineDesc.computeStage.module = module;
pipelineDesc.computeStage.entryPoint = "main";
wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&pipelineDesc);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
for (uint32_t i = 0, b = 0; i < kIterations; ++i, b = 1 - b) {