Use GetBindGroupLayout in RenderBundleTests

Bug: dawn:276
Change-Id: I07683751d4361230754e75096dd695752a9a05d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14029
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:30:55 +00:00 committed by Commit Bot service account
parent 016f3060a3
commit da82324098
1 changed files with 15 additions and 23 deletions

View File

@ -50,8 +50,17 @@ class RenderBundleTest : public DawnTest {
fragColor = color; fragColor = color;
})"); })");
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout( utils::ComboRenderPipelineDescriptor descriptor(device);
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}}); descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip;
descriptor.cVertexState.vertexBufferCount = 1;
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);
float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f, float colors0[] = {kColors[0].r / 255.f, kColors[0].g / 255.f, kColors[0].b / 255.f,
kColors[0].a / 255.f}; kColors[0].a / 255.f};
@ -63,27 +72,10 @@ class RenderBundleTest : public DawnTest {
wgpu::Buffer buffer1 = utils::CreateBufferFromData(device, colors1, 4 * sizeof(float), wgpu::Buffer buffer1 = utils::CreateBufferFromData(device, colors1, 4 * sizeof(float),
wgpu::BufferUsage::Uniform); wgpu::BufferUsage::Uniform);
bindGroups[0] = utils::MakeBindGroup(device, bgl, {{0, buffer0, 0, 4 * sizeof(float)}}); bindGroups[0] = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
bindGroups[1] = utils::MakeBindGroup(device, bgl, {{0, buffer1, 0, 4 * sizeof(float)}}); {{0, buffer0, 0, 4 * sizeof(float)}});
bindGroups[1] = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
wgpu::PipelineLayoutDescriptor pipelineLayoutDesc; {{0, buffer1, 0, 4 * sizeof(float)}});
pipelineLayoutDesc.bindGroupLayoutCount = 1;
pipelineLayoutDesc.bindGroupLayouts = &bgl;
wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.layout = pipelineLayout;
descriptor.vertexStage.module = vsModule;
descriptor.cFragmentStage.module = fsModule;
descriptor.primitiveTopology = wgpu::PrimitiveTopology::TriangleStrip;
descriptor.cVertexState.vertexBufferCount = 1;
descriptor.cVertexState.cVertexBuffers[0].arrayStride = 4 * sizeof(float);
descriptor.cVertexState.cVertexBuffers[0].attributeCount = 1;
descriptor.cVertexState.cAttributes[0].format = wgpu::VertexFormat::Float4;
descriptor.cColorStates[0].format = renderPass.colorFormat;
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>( vertexBuffer = utils::CreateBufferFromData<float>(
device, wgpu::BufferUsage::Vertex, device, wgpu::BufferUsage::Vertex,