Tiny fixes for BindGroup/BindGroupLayout tests

This patch sets proper value in a few end2end tests for BindGroup/BindGroupLayout.
It also removes unused variables in unittest test for BindGroup/BindGroupLayout.

Bug=dawn:180
Change-Id: Ie5c8b2fd8265fe90b7b54c48af48106c356564b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13300
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Yunchao He 2019-11-11 19:11:08 +00:00 committed by Commit Bot service account
parent 59b2987b20
commit 5aa7458db6
2 changed files with 9 additions and 6 deletions

View File

@ -113,6 +113,9 @@ protected:
pipelineDescriptor.cColorStates[0].colorBlend.operation = wgpu::BlendOperation::Add;
pipelineDescriptor.cColorStates[0].colorBlend.srcFactor = wgpu::BlendFactor::One;
pipelineDescriptor.cColorStates[0].colorBlend.dstFactor = wgpu::BlendFactor::One;
pipelineDescriptor.cColorStates[0].alphaBlend.operation = wgpu::BlendOperation::Add;
pipelineDescriptor.cColorStates[0].alphaBlend.srcFactor = wgpu::BlendFactor::One;
pipelineDescriptor.cColorStates[0].alphaBlend.dstFactor = wgpu::BlendFactor::One;
return device.CreateRenderPipeline(&pipelineDescriptor);
}
@ -466,7 +469,9 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets) {
pass.SetPipeline(pipeline);
std::array<float, 4> color = {0.25, 0, 0, 0.25};
// The color will be added 8 times, so the value should be 0.125. But we choose 0.126
// because of precision issues on some devices (for example NVIDIA bots).
std::array<float, 4> color = {0.126, 0, 0, 0.126};
wgpu::Buffer uniformBuffer =
utils::CreateBufferFromData(device, &color, sizeof(color), wgpu::BufferUsage::Uniform);
wgpu::BindGroup bindGroup =
@ -704,11 +709,11 @@ TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) {
// Prepare color data.
// The first draw will use { color0, color1, color2 }.
// The second draw will use { color0, color3, color2 }.
// The pipeline uses additive color blending so the result of two draws should be
// { 2 * color0 + color1 + color2 + color3} = RGBAunorm(1, 1, 1, 1)
// The pipeline uses additive color and alpha blending so the result of two draws should be
// { 2 * color0 + color1 + 2 * color2 + color3} = RGBAunorm(1, 1, 1, 1)
std::array<float, 4> color0 = {0.501, 0, 0, 0};
std::array<float, 4> color1 = {0, 1, 0, 0};
std::array<float, 4> color2 = {0, 0, 0, 1};
std::array<float, 4> color2 = {0, 0, 0, 0.501};
std::array<float, 4> color3 = {0, 0, 1, 0};
size_t color1Offset = Align(sizeof(color0), kMinDynamicBufferOffsetAlignment);

View File

@ -693,8 +693,6 @@ class SetBindGroupValidationTest : public ValidationTest {
}
wgpu::BindGroupLayout mBindGroupLayout;
wgpu::Buffer mUniformBuffer;
wgpu::Buffer mStorageBuffer;
wgpu::RenderPipeline CreateRenderPipeline() {
wgpu::ShaderModule vsModule =