From 3f21e11e240ae44f1b49606d42b062eaf208a5e4 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 22 Aug 2019 19:02:06 +0000 Subject: [PATCH] Fix RenderBundleValidationTests These tests were consistently failing on MSVC Debug builds. Bug: dawn:154, dawn:213 TBR: cwallez@chromium.org Change-Id: I83a51dd3ac705ccfcc34fa6a643d499a9cbe694f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10400 Reviewed-by: Austin Eng Commit-Queue: Austin Eng --- .../RenderBundleValidationTests.cpp | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/tests/unittests/validation/RenderBundleValidationTests.cpp index 416405fb0f..3314bfc7c4 100644 --- a/src/tests/unittests/validation/RenderBundleValidationTests.cpp +++ b/src/tests/unittests/validation/RenderBundleValidationTests.cpp @@ -57,13 +57,14 @@ namespace { {1, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer}, })}; - dawn::PipelineLayoutDescriptor pipelineLayoutDesc; + dawn::PipelineLayoutDescriptor pipelineLayoutDesc = {}; pipelineLayoutDesc.bindGroupLayoutCount = 2; pipelineLayoutDesc.bindGroupLayouts = bgls; pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc); - utils::ComboRenderPipelineDescriptor descriptor = MakeRenderPipelineDescriptor(); + utils::ComboRenderPipelineDescriptor descriptor(device); + InitializeRenderPipelineDescriptor(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor); float data[4]; @@ -94,17 +95,15 @@ namespace { {1, vertexStorageBuffer, 0, sizeof(kVertices)}}); } - utils::ComboRenderPipelineDescriptor MakeRenderPipelineDescriptor() { - utils::ComboRenderPipelineDescriptor descriptor(device); - descriptor.layout = pipelineLayout; - descriptor.cVertexStage.module = vsModule; - descriptor.cFragmentStage.module = fsModule; - descriptor.cVertexInput.bufferCount = 1; - descriptor.cVertexInput.cBuffers[0].stride = 2 * sizeof(float); - descriptor.cVertexInput.cBuffers[0].attributeCount = 1; - descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float2; - - return descriptor; + void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor* descriptor) { + descriptor->layout = pipelineLayout; + descriptor->cVertexStage.module = vsModule; + descriptor->cFragmentStage.module = fsModule; + descriptor->cVertexInput.bufferCount = 1; + descriptor->cVertexInput.cBuffers[0].stride = 2 * sizeof(float); + descriptor->cVertexInput.cBuffers[0].attributeCount = 1; + descriptor->cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float2; + descriptor->cVertexInput.cAttributes[0].shaderLocation = 0; } dawn::ShaderModule vsModule; @@ -692,7 +691,8 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) { renderBundleDesc.cColorFormats[1] = dawn::TextureFormat::RG16Float; renderBundleDesc.cColorFormats[2] = dawn::TextureFormat::R16Sint; - utils::ComboRenderPipelineDescriptor renderPipelineDesc = MakeRenderPipelineDescriptor(); + utils::ComboRenderPipelineDescriptor renderPipelineDesc(device); + InitializeRenderPipelineDescriptor(&renderPipelineDesc); renderPipelineDesc.colorStateCount = 3; renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm; renderPipelineDesc.cColorStates[1]->format = dawn::TextureFormat::RG16Float; @@ -740,7 +740,8 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) { renderBundleDesc.cDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8; renderBundleDesc.depthStencilFormat = &renderBundleDesc.cDepthStencilFormat; - utils::ComboRenderPipelineDescriptor renderPipelineDesc = MakeRenderPipelineDescriptor(); + utils::ComboRenderPipelineDescriptor renderPipelineDesc(device); + InitializeRenderPipelineDescriptor(&renderPipelineDesc); renderPipelineDesc.colorStateCount = 1; renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm; renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState; @@ -788,7 +789,8 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) { renderBundleDesc.cColorFormats[0] = dawn::TextureFormat::RGBA8Unorm; renderBundleDesc.sampleCount = 4; - utils::ComboRenderPipelineDescriptor renderPipelineDesc = MakeRenderPipelineDescriptor(); + utils::ComboRenderPipelineDescriptor renderPipelineDesc(device); + InitializeRenderPipelineDescriptor(&renderPipelineDesc); renderPipelineDesc.colorStateCount = 1; renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm; renderPipelineDesc.sampleCount = 4;