From da82324098c9e64497c6f546e670c4e081adbefc Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Tue, 3 Dec 2019 21:30:55 +0000 Subject: [PATCH] Use GetBindGroupLayout in RenderBundleTests Bug: dawn:276 Change-Id: I07683751d4361230754e75096dd695752a9a05d1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14029 Commit-Queue: Austin Eng Reviewed-by: Kai Ninomiya Reviewed-by: Corentin Wallez --- src/tests/end2end/RenderBundleTests.cpp | 38 ++++++++++--------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/tests/end2end/RenderBundleTests.cpp b/src/tests/end2end/RenderBundleTests.cpp index 1b65a36115..9e5d1397b2 100644 --- a/src/tests/end2end/RenderBundleTests.cpp +++ b/src/tests/end2end/RenderBundleTests.cpp @@ -50,8 +50,17 @@ class RenderBundleTest : public DawnTest { fragColor = color; })"); - wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout( - device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::UniformBuffer}}); + utils::ComboRenderPipelineDescriptor descriptor(device); + 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, kColors[0].a / 255.f}; @@ -63,27 +72,10 @@ class RenderBundleTest : public DawnTest { wgpu::Buffer buffer1 = utils::CreateBufferFromData(device, colors1, 4 * sizeof(float), wgpu::BufferUsage::Uniform); - bindGroups[0] = utils::MakeBindGroup(device, bgl, {{0, buffer0, 0, 4 * sizeof(float)}}); - bindGroups[1] = utils::MakeBindGroup(device, bgl, {{0, buffer1, 0, 4 * sizeof(float)}}); - - wgpu::PipelineLayoutDescriptor pipelineLayoutDesc; - 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); + bindGroups[0] = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), + {{0, buffer0, 0, 4 * sizeof(float)}}); + bindGroups[1] = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0), + {{0, buffer1, 0, 4 * sizeof(float)}}); vertexBuffer = utils::CreateBufferFromData( device, wgpu::BufferUsage::Vertex,