diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index fd27395d88..934015c367 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -80,6 +80,14 @@ namespace { } // namespace +const RGBA8 RGBA8::kZero = RGBA8(0, 0, 0, 0); +const RGBA8 RGBA8::kBlack = RGBA8(0, 0, 0, 255); +const RGBA8 RGBA8::kRed = RGBA8(255, 0, 0, 255); +const RGBA8 RGBA8::kGreen = RGBA8(0, 255, 0, 255); +const RGBA8 RGBA8::kBlue = RGBA8(0, 0, 255, 255); +const RGBA8 RGBA8::kYellow = RGBA8(255, 255, 0, 255); +const RGBA8 RGBA8::kWhite = RGBA8(255, 255, 255, 255); + const DawnTestParam D3D12Backend(dawn_native::BackendType::D3D12); const DawnTestParam MetalBackend(dawn_native::BackendType::Metal); const DawnTestParam OpenGLBackend(dawn_native::BackendType::OpenGL); diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index bada502204..a5574a3577 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -74,16 +74,17 @@ struct RGBA8 { bool operator!=(const RGBA8& other) const; uint8_t r, g, b, a; + + static const RGBA8 kZero; + static const RGBA8 kBlack; + static const RGBA8 kRed; + static const RGBA8 kGreen; + static const RGBA8 kBlue; + static const RGBA8 kYellow; + static const RGBA8 kWhite; }; 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 e00c4a116b..39460ddf02 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(kRed, colorTexture, kSize - 1, kSize - 1); - EXPECT_PIXEL_RGBA8_EQ(kGreen, colorTexture, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, colorTexture, kSize - 1, kSize - 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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 e7510298aa..a5cd6a5f80 100644 --- a/src/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/tests/end2end/CompressedTextureFormatTests.cpp @@ -389,13 +389,13 @@ class CompressedTextureBCFormatTest : public DawnTest { case wgpu::TextureFormat::BC4RSnorm: case wgpu::TextureFormat::BC4RUnorm: - return FillExpectedData(testRegion, kRed, kBlack); + return FillExpectedData(testRegion, RGBA8::kRed, RGBA8::kBlack); case wgpu::TextureFormat::BC5RGSnorm: case wgpu::TextureFormat::BC5RGUnorm: case wgpu::TextureFormat::BC6HRGBSfloat: case wgpu::TextureFormat::BC6HRGBUfloat: - return FillExpectedData(testRegion, kRed, kGreen); + return FillExpectedData(testRegion, RGBA8::kRed, RGBA8::kGreen); default: UNREACHABLE(); diff --git a/src/tests/end2end/CullingTests.cpp b/src/tests/end2end/CullingTests.cpp index a61e900069..2220140cfc 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 = kBlack; + const RGBA8 kBackgroundColor = RGBA8::kBlue; + const RGBA8 kTopLeftColor = RGBA8::kBlack; constexpr RGBA8 kBottomRightColor = RGBA8(3, 3, 0, 255); - constexpr RGBA8 kBackgroundColor = kBlue; RGBA8 kCCWTriangleTopLeftColor = isCCWTriangleCulled ? kBackgroundColor : kTopLeftColor; EXPECT_PIXEL_RGBA8_EQ(kCCWTriangleTopLeftColor, colorTexture, 0, 0); diff --git a/src/tests/end2end/GpuMemorySynchronizationTests.cpp b/src/tests/end2end/GpuMemorySynchronizationTests.cpp index 15ab7eab3e..6616aff7c5 100644 --- a/src/tests/end2end/GpuMemorySynchronizationTests.cpp +++ b/src/tests/end2end/GpuMemorySynchronizationTests.cpp @@ -132,7 +132,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithSameCommandBuffer) { queue.Submit(1, &commands); // Verify the rendering result. - EXPECT_PIXEL_RGBA8_EQ(kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); } // Write into a storage buffer in compute pass in a command buffer. Then read that data in a render @@ -171,7 +171,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithDifferentCommandBuffers) { queue.Submit(2, cb); // Verify the rendering result. - EXPECT_PIXEL_RGBA8_EQ(kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); } // Write into a storage buffer in compute pass in a command buffer. Then read that data in a render @@ -211,7 +211,7 @@ TEST_P(StorageToUniformSyncTests, ReadAfterWriteWithDifferentQueueSubmits) { queue.Submit(1, &cb[1]); // Verify the rendering result. - EXPECT_PIXEL_RGBA8_EQ(kRed, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderPass.color, 0, 0); } DAWN_INSTANTIATE_TEST(StorageToUniformSyncTests, diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp index 0404cf79cc..2268deb175 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(kGreen, renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(kGreen, renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(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 + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 190, 190); // A + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 210, 210); // B + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(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 + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 190, 190); // A + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 210, 210); // B + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(kGreen, renderPass.color, 100, 300); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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 6f888a3b75..0dde8e5f35 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 ? kGreen : kZero; + RGBA8 color = locationSpec.include ? RGBA8::kGreen : RGBA8::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 9eec1083e3..1b65a36115 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] = {kGreen, kBlue}; +const RGBA8 kColors[2] = {RGBA8::kGreen, RGBA8::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 7a51e28246..945ef9ec80 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -71,11 +71,11 @@ class RenderPassLoadOpTests : public DawnTest { renderTargetView = renderTarget.CreateView(); - std::fill(expectZero.begin(), expectZero.end(), kZero); + std::fill(expectZero.begin(), expectZero.end(), RGBA8::kZero); - std::fill(expectGreen.begin(), expectGreen.end(), kGreen); + std::fill(expectGreen.begin(), expectGreen.end(), RGBA8::kGreen); - std::fill(expectBlue.begin(), expectBlue.end(), kBlue); + std::fill(expectBlue.begin(), expectBlue.end(), RGBA8::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 8ea5b2262e..223d99ba8d 100644 --- a/src/tests/end2end/RenderPassTests.cpp +++ b/src/tests/end2end/RenderPassTests.cpp @@ -108,11 +108,11 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(kBlue, renderTarget1, 1, kRTSize - 1); - EXPECT_PIXEL_RGBA8_EQ(kRed, renderTarget1, kRTSize - 1, 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlue, renderTarget1, 1, kRTSize - 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderTarget1, kRTSize - 1, 1); - EXPECT_PIXEL_RGBA8_EQ(kBlue, renderTarget2, 1, kRTSize - 1); - EXPECT_PIXEL_RGBA8_EQ(kGreen, renderTarget2, kRTSize - 1, 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlue, renderTarget2, 1, kRTSize - 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderTarget2, kRTSize - 1, 1); } // Verify that the content in the color attachment will not be changed if there is no corresponding @@ -161,8 +161,8 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) { wgpu::CommandBuffer commands = encoder.Finish(); queue.Submit(1, &commands); - EXPECT_PIXEL_RGBA8_EQ(kBlue, renderTarget, 2, kRTSize - 1); - EXPECT_PIXEL_RGBA8_EQ(kRed, renderTarget, kRTSize - 1, 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kBlue, renderTarget, 2, kRTSize - 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kRed, renderTarget, kRTSize - 1, 1); } DAWN_INSTANTIATE_TEST(RenderPassTest, diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 1d5fa842fb..5593f91ed7 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -108,8 +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]; - data[0] = data[rowPixels + 1] = kBlack; - data[1] = data[rowPixels] = kWhite; + data[0] = data[rowPixels + 1] = RGBA8::kBlack; + data[1] = data[rowPixels] = RGBA8::kWhite; wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), wgpu::BufferUsage::CopySrc); @@ -162,10 +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); - 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(RGBA8::kBlack, mRenderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kWhite, mRenderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kWhite, mRenderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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 ebcf2e37e3..21c1f591f0 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(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); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(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); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(kZero, renderPass.color, kX - 1, kY - 1); - EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, kX, kY); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, kX - 1, kY - 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, kX, kY); - EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, kX + kW, kY + kH); - EXPECT_PIXEL_RGBA8_EQ(kGreen, renderPass.color, kX + kW - 1, kY + kH - 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, kX + kW, kY + kH); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(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); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 99); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 99, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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 f82c8086d7..53710cc70a 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(kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); } }; diff --git a/src/tests/end2end/VertexStateTests.cpp b/src/tests/end2end/VertexStateTests.cpp index 8b8051d0ca..048bd7a8f7 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(kGreen, renderPass.color, x, y); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, x, y); } else { - EXPECT_PIXEL_RGBA8_EQ(kZero, renderPass.color, x, y); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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(kGreen, renderPass.color, 1, 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 1, 1); } DAWN_INSTANTIATE_TEST(OptionalVertexStateTest, diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp index 3a764bf60b..43fa889e3e 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(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); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kGreen, renderPass.color, 0, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 0, 1); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::kZero, renderPass.color, 1, 0); + EXPECT_PIXEL_RGBA8_EQ(RGBA8::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 ed13f54697..307dcc1fdd 100644 --- a/src/tests/end2end/ViewportTests.cpp +++ b/src/tests/end2end/ViewportTests.cpp @@ -155,10 +155,10 @@ class ViewportTest : public DawnTest { wgpu::Queue queue = device.CreateQueue(); queue.Submit(1, &commandBuffer); - constexpr RGBA8 kColor[ColorTypeCount] = { - kRed, // top-left triangle is red - kGreen, // bottom-right triangle is green - kBlue, // background is blue + const RGBA8 kColor[ColorTypeCount] = { + RGBA8::kRed, // top-left triangle is red + RGBA8::kGreen, // bottom-right triangle is green + RGBA8::kBlue, // background is blue }; EXPECT_PIXEL_RGBA8_EQ(kColor[info.topLeftPoint], colorTexture1, 0, 0);