From e0eeef4b34ffce4570a01e47e4445289c6a5615c Mon Sep 17 00:00:00 2001 From: Yunchao He Date: Mon, 18 Nov 2019 03:27:44 +0000 Subject: [PATCH] code refactoring: const color values BUG= Change-Id: I6f394fd8ae45d30e1e3846b9a7a03f51efb8a475 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13660 Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng Commit-Queue: Yunchao He --- src/tests/DawnTest.h | 7 ++++ src/tests/end2end/ClipSpaceTests.cpp | 4 +-- .../end2end/CompressedTextureFormatTests.cpp | 3 -- src/tests/end2end/CullingTests.cpp | 4 +-- src/tests/end2end/IndexFormatTests.cpp | 18 +++++------ src/tests/end2end/PrimitiveTopologyTests.cpp | 2 +- src/tests/end2end/RenderBundleTests.cpp | 2 +- src/tests/end2end/RenderPassLoadOpTests.cpp | 9 ++---- src/tests/end2end/RenderPassTests.cpp | 6 ---- src/tests/end2end/SamplerTests.cpp | 16 ++++------ src/tests/end2end/ScissorTests.cpp | 32 +++++++++---------- src/tests/end2end/VertexFormatTests.cpp | 2 +- src/tests/end2end/VertexStateTests.cpp | 6 ++-- .../end2end/ViewportOrientationTests.cpp | 8 ++--- src/tests/end2end/ViewportTests.cpp | 6 ++-- 15 files changed, 58 insertions(+), 67 deletions(-) diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index 91d64d1406..bada502204 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -77,6 +77,13 @@ struct RGBA8 { }; std::ostream& operator<<(std::ostream& stream, const RGBA8& color); +constexpr RGBA8 kZero(0, 0, 0, 0); +constexpr RGBA8 kBlack(0, 0, 0, 255); +constexpr RGBA8 kRed(255, 0, 0, 255); +constexpr RGBA8 kGreen(0, 255, 0, 255); +constexpr RGBA8 kBlue(0, 0, 255, 255); +constexpr RGBA8 kWhite(255, 255, 255, 255); + struct DawnTestParam { explicit DawnTestParam(dawn_native::BackendType backendType) : backendType(backendType) { } diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp index 5354330553..e00c4a116b 100644 --- a/src/tests/end2end/ClipSpaceTests.cpp +++ b/src/tests/end2end/ClipSpaceTests.cpp @@ -95,8 +95,8 @@ TEST_P(ClipSpaceTest, ClipSpace) { wgpu::Queue queue = device.CreateQueue(); queue.Submit(1, &commandBuffer); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(255, 0, 0, 255), colorTexture, kSize - 1, kSize - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), colorTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kRed, colorTexture, kSize - 1, kSize - 1); + EXPECT_PIXEL_RGBA8_EQ(kGreen, colorTexture, 0, 0); } DAWN_INSTANTIATE_TEST(ClipSpaceTest, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend); diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp index e632883fb3..e7510298aa 100644 --- a/src/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/tests/end2end/CompressedTextureFormatTests.cpp @@ -356,9 +356,6 @@ class CompressedTextureBCFormatTest : public DawnTest { // RGBA8 formats. static std::vector GetExpectedData(wgpu::TextureFormat bcFormat, const wgpu::Extent3D& testRegion) { - constexpr RGBA8 kRed(255, 0, 0, 255); - constexpr RGBA8 kGreen(0, 255, 0, 255); - constexpr RGBA8 kBlack(0, 0, 0, 255); constexpr RGBA8 kDarkRed(198, 0, 0, 255); constexpr RGBA8 kDarkGreen(0, 207, 0, 255); constexpr RGBA8 kDarkRedSRGB(144, 0, 0, 255); diff --git a/src/tests/end2end/CullingTests.cpp b/src/tests/end2end/CullingTests.cpp index a0ce761245..a61e900069 100644 --- a/src/tests/end2end/CullingTests.cpp +++ b/src/tests/end2end/CullingTests.cpp @@ -90,9 +90,9 @@ class CullingTest : public DawnTest { wgpu::Queue queue = device.CreateQueue(); queue.Submit(1, &commandBuffer); - constexpr RGBA8 kTopLeftColor = RGBA8(0, 0, 0, 255); + constexpr RGBA8 kTopLeftColor = kBlack; constexpr RGBA8 kBottomRightColor = RGBA8(3, 3, 0, 255); - constexpr RGBA8 kBackgroundColor = RGBA8(0, 0, 255, 255); + constexpr RGBA8 kBackgroundColor = kBlue; RGBA8 kCCWTriangleTopLeftColor = isCCWTriangleCulled ? kBackgroundColor : kTopLeftColor; EXPECT_PIXEL_RGBA8_EQ(kCCWTriangleTopLeftColor, colorTexture, 0, 0); diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp index 7bf118d214..0404cf79cc 100644 --- a/src/tests/end2end/IndexFormatTests.cpp +++ b/src/tests/end2end/IndexFormatTests.cpp @@ -87,7 +87,7 @@ TEST_P(IndexFormatTest, Uint32) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 100, 300); } // Test that the Uint16 index format is correctly interpreted @@ -114,7 +114,7 @@ TEST_P(IndexFormatTest, Uint16) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 100, 300); } // Test for primitive restart use vertices like in the drawing and draw the following @@ -164,9 +164,9 @@ TEST_P(IndexFormatTest, Uint32PrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 190, 190); // A - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 210, 210); // B - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, 210, 190); // C + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 190, 190); // A + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 210, 210); // B + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, 210, 190); // C } // Test use of primitive restart with an Uint16 index format @@ -206,9 +206,9 @@ TEST_P(IndexFormatTest, Uint16PrimitiveRestart) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 190, 190); // A - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 210, 210); // B - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, 210, 190); // C + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 190, 190); // A + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 210, 210); // B + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, 210, 190); // C } // Test that the index format used is the format of the last set pipeline. This is to @@ -242,7 +242,7 @@ TEST_P(IndexFormatTest, ChangePipelineAfterSetIndexBuffer) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 100, 300); } // Test that setting the index buffer before the pipeline works, this is important diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp index 81b79d0332..6f888a3b75 100644 --- a/src/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/tests/end2end/PrimitiveTopologyTests.cpp @@ -210,7 +210,7 @@ class PrimitiveTopologyTest : public DawnTest { for (auto& locationSpec : locationSpecs) { for (size_t i = 0; i < locationSpec.count; ++i) { // If this pixel is included, check that it is green. Otherwise, check that it is black - RGBA8 color = locationSpec.include ? RGBA8(0, 255, 0, 255) : RGBA8(0, 0, 0, 0); + RGBA8 color = locationSpec.include ? kGreen : kZero; EXPECT_PIXEL_RGBA8_EQ(color, renderPass.color, locationSpec.locations[i].x, locationSpec.locations[i].y) << "Expected (" << locationSpec.locations[i].x << ", " << locationSpec.locations[i].y << ") to be " << color; } diff --git a/src/tests/end2end/RenderBundleTests.cpp b/src/tests/end2end/RenderBundleTests.cpp index e101038278..9eec1083e3 100644 --- a/src/tests/end2end/RenderBundleTests.cpp +++ b/src/tests/end2end/RenderBundleTests.cpp @@ -19,7 +19,7 @@ #include "utils/WGPUHelpers.h" constexpr uint32_t kRTSize = 4; -constexpr RGBA8 kColors[2] = {RGBA8(0, 255, 0, 255), RGBA8(0, 0, 255, 255)}; +constexpr RGBA8 kColors[2] = {kGreen, kBlue}; // RenderBundleTest tests simple usage of RenderBundles to draw. The implementaiton // of RenderBundle is shared significantly with render pass execution which is diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index 1847521347..7a51e28246 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -71,14 +71,11 @@ class RenderPassLoadOpTests : public DawnTest { renderTargetView = renderTarget.CreateView(); - RGBA8 zero(0, 0, 0, 0); - std::fill(expectZero.begin(), expectZero.end(), zero); + std::fill(expectZero.begin(), expectZero.end(), kZero); - RGBA8 green(0, 255, 0, 255); - std::fill(expectGreen.begin(), expectGreen.end(), green); + std::fill(expectGreen.begin(), expectGreen.end(), kGreen); - RGBA8 blue(0, 0, 255, 255); - std::fill(expectBlue.begin(), expectBlue.end(), blue); + std::fill(expectBlue.begin(), expectBlue.end(), kBlue); // draws a blue quad on the right half of the screen const char* vsSource = R"( diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp index 6d7660fbe0..8ea5b2262e 100644 --- a/src/tests/end2end/RenderPassTests.cpp +++ b/src/tests/end2end/RenderPassTests.cpp @@ -76,10 +76,6 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) { // This test is consistently failing on OpenGL and flaky on Metal. return; } - constexpr RGBA8 kRed(255, 0, 0, 255); - constexpr RGBA8 kGreen(0, 255, 0, 255); - - constexpr RGBA8 kBlue(0, 0, 255, 255); wgpu::Texture renderTarget1 = CreateDefault2DTexture(); wgpu::Texture renderTarget2 = CreateDefault2DTexture(); @@ -165,8 +161,6 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - constexpr RGBA8 kRed(255, 0, 0, 255); - constexpr RGBA8 kBlue(0, 0, 255, 255); EXPECT_PIXEL_RGBA8_EQ(kBlue, renderTarget, 2, kRTSize - 1); EXPECT_PIXEL_RGBA8_EQ(kRed, renderTarget, kRTSize - 1, 1); } diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index bfcc1e7c32..1d5fa842fb 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -108,10 +108,8 @@ protected: // Create a 2x2 checkerboard texture, with black in the top left and bottom right corners. const uint32_t rowPixels = kTextureRowPitchAlignment / sizeof(RGBA8); RGBA8 data[rowPixels * 2]; - RGBA8 black(0, 0, 0, 255); - RGBA8 white(255, 255, 255, 255); - data[0] = data[rowPixels + 1] = black; - data[1] = data[rowPixels] = white; + data[0] = data[rowPixels + 1] = kBlack; + data[1] = data[rowPixels] = kWhite; wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), wgpu::BufferUsage::CopySrc); @@ -164,12 +162,10 @@ protected: RGBA8 expectedU3(u.mExpected3, u.mExpected3, u.mExpected3, 255); RGBA8 expectedV2(v.mExpected2, v.mExpected2, v.mExpected2, 255); RGBA8 expectedV3(v.mExpected3, v.mExpected3, v.mExpected3, 255); - RGBA8 black(0, 0, 0, 255); - RGBA8 white(255, 255, 255, 255); - EXPECT_PIXEL_RGBA8_EQ(black, mRenderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(white, mRenderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_EQ(white, mRenderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_EQ(black, mRenderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(kBlack, mRenderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kWhite, mRenderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(kWhite, mRenderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(kBlack, mRenderPass.color, 1, 1); EXPECT_PIXEL_RGBA8_EQ(expectedU2, mRenderPass.color, 2, 0); EXPECT_PIXEL_RGBA8_EQ(expectedU3, mRenderPass.color, 3, 0); EXPECT_PIXEL_RGBA8_EQ(expectedV2, mRenderPass.color, 0, 2); diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp index b2c00c0282..ebcf2e37e3 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -64,10 +64,10 @@ TEST_P(ScissorTest, DefaultsToWholeRenderTarget) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 99); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 99, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 99, 99); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 99, 99); } // Test setting the scissor to something larger than the attachments. @@ -87,10 +87,10 @@ TEST_P(ScissorTest, LargerThanAttachment) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 99); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 99, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 99, 99); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 99, 99); } // Test setting a partial scissor (not empty, not full attachment) @@ -116,11 +116,11 @@ TEST_P(ScissorTest, PartialRect) { queue.Submit(1, &commands); // Test the two opposite corners of the scissor box. With one pixel inside and on outside - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, kX - 1, kY - 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, kX, kY); + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, kX - 1, kY - 1); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, kX, kY); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, kX + kW, kY + kH); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, kX + kW - 1, kY + kH - 1); + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, kX + kW, kY + kH); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, kX + kW - 1, kY + kH - 1); } // Test that the scissor setting doesn't get inherited between renderpasses @@ -146,10 +146,10 @@ TEST_P(ScissorTest, NoInheritanceBetweenRenderPass) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 99); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 99, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 99, 99); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 99, 99); } DAWN_INSTANTIATE_TEST(ScissorTest, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend); diff --git a/src/tests/end2end/VertexFormatTests.cpp b/src/tests/end2end/VertexFormatTests.cpp index 0286c97876..f82c8086d7 100644 --- a/src/tests/end2end/VertexFormatTests.cpp +++ b/src/tests/end2end/VertexFormatTests.cpp @@ -390,7 +390,7 @@ class VertexFormatTest : public DawnTest { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 0); } }; diff --git a/src/tests/end2end/VertexStateTests.cpp b/src/tests/end2end/VertexStateTests.cpp index a2edad4a66..8b8051d0ca 100644 --- a/src/tests/end2end/VertexStateTests.cpp +++ b/src/tests/end2end/VertexStateTests.cpp @@ -221,9 +221,9 @@ class VertexStateTest : public DawnTest { unsigned int x = kRTCellOffset + kRTCellSize * triangle; unsigned int y = kRTCellOffset + kRTCellSize * instance; if (triangle < triangles && instance < instances) { - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, x, y); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, x, y); } else { - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, x, y); + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, x, y); } } } @@ -572,7 +572,7 @@ TEST_P(OptionalVertexStateTest, Basic) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 1, 1); } DAWN_INSTANTIATE_TEST(OptionalVertexStateTest, diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp index 95357da3aa..3a764bf60b 100644 --- a/src/tests/end2end/ViewportOrientationTests.cpp +++ b/src/tests/end2end/ViewportOrientationTests.cpp @@ -58,10 +58,10 @@ TEST_P(ViewportOrientationTests, OriginAt0x0) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderPass.color, 0, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, 0, 1); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, 1, 0); - EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 0, 0, 0), renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, 1, 1); } DAWN_INSTANTIATE_TEST(ViewportOrientationTests, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend); diff --git a/src/tests/end2end/ViewportTests.cpp b/src/tests/end2end/ViewportTests.cpp index 35c201cfe7..ed13f54697 100644 --- a/src/tests/end2end/ViewportTests.cpp +++ b/src/tests/end2end/ViewportTests.cpp @@ -156,9 +156,9 @@ class ViewportTest : public DawnTest { queue.Submit(1, &commandBuffer); constexpr RGBA8 kColor[ColorTypeCount] = { - RGBA8(255, 0, 0, 255), // top-left triangle is red - RGBA8(0, 255, 0, 255), // bottom-right triangle is green - RGBA8(0, 0, 255, 255), // background is blue + kRed, // top-left triangle is red + kGreen, // bottom-right triangle is green + kBlue, // background is blue }; EXPECT_PIXEL_RGBA8_EQ(kColor[info.topLeftPoint], colorTexture1, 0, 0);