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 <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-08-22 19:02:06 +00:00 committed by Commit Bot service account
parent 9d9d76c590
commit 3f21e11e24
1 changed files with 18 additions and 16 deletions

View File

@ -57,13 +57,14 @@ namespace {
{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer}, {1, dawn::ShaderStageBit::Fragment, dawn::BindingType::StorageBuffer},
})}; })};
dawn::PipelineLayoutDescriptor pipelineLayoutDesc; dawn::PipelineLayoutDescriptor pipelineLayoutDesc = {};
pipelineLayoutDesc.bindGroupLayoutCount = 2; pipelineLayoutDesc.bindGroupLayoutCount = 2;
pipelineLayoutDesc.bindGroupLayouts = bgls; pipelineLayoutDesc.bindGroupLayouts = bgls;
pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc); pipelineLayout = device.CreatePipelineLayout(&pipelineLayoutDesc);
utils::ComboRenderPipelineDescriptor descriptor = MakeRenderPipelineDescriptor(); utils::ComboRenderPipelineDescriptor descriptor(device);
InitializeRenderPipelineDescriptor(&descriptor);
pipeline = device.CreateRenderPipeline(&descriptor); pipeline = device.CreateRenderPipeline(&descriptor);
float data[4]; float data[4];
@ -94,17 +95,15 @@ namespace {
{1, vertexStorageBuffer, 0, sizeof(kVertices)}}); {1, vertexStorageBuffer, 0, sizeof(kVertices)}});
} }
utils::ComboRenderPipelineDescriptor MakeRenderPipelineDescriptor() { void InitializeRenderPipelineDescriptor(utils::ComboRenderPipelineDescriptor* descriptor) {
utils::ComboRenderPipelineDescriptor descriptor(device); descriptor->layout = pipelineLayout;
descriptor.layout = pipelineLayout; descriptor->cVertexStage.module = vsModule;
descriptor.cVertexStage.module = vsModule; descriptor->cFragmentStage.module = fsModule;
descriptor.cFragmentStage.module = fsModule; descriptor->cVertexInput.bufferCount = 1;
descriptor.cVertexInput.bufferCount = 1; descriptor->cVertexInput.cBuffers[0].stride = 2 * sizeof(float);
descriptor.cVertexInput.cBuffers[0].stride = 2 * sizeof(float); descriptor->cVertexInput.cBuffers[0].attributeCount = 1;
descriptor.cVertexInput.cBuffers[0].attributeCount = 1; descriptor->cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float2;
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float2; descriptor->cVertexInput.cAttributes[0].shaderLocation = 0;
return descriptor;
} }
dawn::ShaderModule vsModule; dawn::ShaderModule vsModule;
@ -692,7 +691,8 @@ TEST_F(RenderBundleValidationTest, PipelineColorFormatMismatch) {
renderBundleDesc.cColorFormats[1] = dawn::TextureFormat::RG16Float; renderBundleDesc.cColorFormats[1] = dawn::TextureFormat::RG16Float;
renderBundleDesc.cColorFormats[2] = dawn::TextureFormat::R16Sint; renderBundleDesc.cColorFormats[2] = dawn::TextureFormat::R16Sint;
utils::ComboRenderPipelineDescriptor renderPipelineDesc = MakeRenderPipelineDescriptor(); utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
renderPipelineDesc.colorStateCount = 3; renderPipelineDesc.colorStateCount = 3;
renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm; renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
renderPipelineDesc.cColorStates[1]->format = dawn::TextureFormat::RG16Float; renderPipelineDesc.cColorStates[1]->format = dawn::TextureFormat::RG16Float;
@ -740,7 +740,8 @@ TEST_F(RenderBundleValidationTest, PipelineDepthStencilFormatMismatch) {
renderBundleDesc.cDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8; renderBundleDesc.cDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
renderBundleDesc.depthStencilFormat = &renderBundleDesc.cDepthStencilFormat; renderBundleDesc.depthStencilFormat = &renderBundleDesc.cDepthStencilFormat;
utils::ComboRenderPipelineDescriptor renderPipelineDesc = MakeRenderPipelineDescriptor(); utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
renderPipelineDesc.colorStateCount = 1; renderPipelineDesc.colorStateCount = 1;
renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm; renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState; renderPipelineDesc.depthStencilState = &renderPipelineDesc.cDepthStencilState;
@ -788,7 +789,8 @@ TEST_F(RenderBundleValidationTest, PipelineSampleCountMismatch) {
renderBundleDesc.cColorFormats[0] = dawn::TextureFormat::RGBA8Unorm; renderBundleDesc.cColorFormats[0] = dawn::TextureFormat::RGBA8Unorm;
renderBundleDesc.sampleCount = 4; renderBundleDesc.sampleCount = 4;
utils::ComboRenderPipelineDescriptor renderPipelineDesc = MakeRenderPipelineDescriptor(); utils::ComboRenderPipelineDescriptor renderPipelineDesc(device);
InitializeRenderPipelineDescriptor(&renderPipelineDesc);
renderPipelineDesc.colorStateCount = 1; renderPipelineDesc.colorStateCount = 1;
renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm; renderPipelineDesc.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
renderPipelineDesc.sampleCount = 4; renderPipelineDesc.sampleCount = 4;