diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 940aa1be7b..b6ac837ebf 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -1005,7 +1005,6 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file, wgpu::Origin3D origin, wgpu::Extent3D extent, uint32_t level, - uint32_t layer, wgpu::TextureAspect aspect, uint32_t dataSize, uint32_t bytesPerRow) { @@ -1026,8 +1025,8 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file, // We need to enqueue the copy immediately because by the time we resolve the expectation, // the texture might have been modified. - wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture( - texture, level, {origin.x, origin.y, origin.z + layer}, aspect); + wgpu::ImageCopyTexture imageCopyTexture = + utils::CreateImageCopyTexture(texture, level, origin, aspect); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(readback.buffer, readback.offset, bytesPerRow, rowsPerImage); diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index 3b5dbab036..1078d318d2 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -74,9 +74,9 @@ #define EXPECT_PIXEL_FLOAT_EQ(expected, texture, x, y) \ AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y}) -#define EXPECT_TEXTURE_FLOAT_EQ(expected, texture, x, y, width, height, level, layer) \ - AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y}, {width, height}, level, \ - layer) +#define EXPECT_TEXTURE_FLOAT_EQ(expected, texture, origin, extent, level) \ + AddTextureExpectation(__FILE__, __LINE__, expected, texture, utils::MakeOrigin origin, \ + utils::MakeExtent extent, level) #define EXPECT_PIXEL_RGBA8_BETWEEN(color0, color1, texture, x, y) \ AddTextureBetweenColorsExpectation(__FILE__, __LINE__, color0, color1, texture, x, y) @@ -327,14 +327,13 @@ class DawnTestBase { wgpu::Origin3D origin, wgpu::Extent3D extent, uint32_t level = 0, - uint32_t layer = 0, wgpu::TextureAspect aspect = wgpu::TextureAspect::All, uint32_t bytesPerRow = 0) { return AddTextureExpectationImpl( file, line, new detail::ExpectEq(expectedData, extent.width * extent.height * extent.depthOrArrayLayers), - texture, origin, extent, level, layer, aspect, sizeof(T), bytesPerRow); + texture, origin, extent, level, aspect, sizeof(T), bytesPerRow); } template @@ -344,12 +343,10 @@ class DawnTestBase { const wgpu::Texture& texture, wgpu::Origin3D origin, uint32_t level = 0, - uint32_t layer = 0, wgpu::TextureAspect aspect = wgpu::TextureAspect::All, uint32_t bytesPerRow = 0) { return AddTextureExpectationImpl(file, line, new detail::ExpectEq(expectedData), texture, - origin, {1, 1}, level, layer, aspect, sizeof(T), - bytesPerRow); + origin, {1, 1}, level, aspect, sizeof(T), bytesPerRow); } template @@ -362,12 +359,11 @@ class DawnTestBase { uint32_t x, uint32_t y, uint32_t level = 0, - uint32_t layer = 0, wgpu::TextureAspect aspect = wgpu::TextureAspect::All, uint32_t bytesPerRow = 0) { return AddTextureExpectationImpl( file, line, new detail::ExpectBetweenColors(color0, color1), texture, {x, y}, {1, 1}, - level, layer, aspect, sizeof(T), bytesPerRow); + level, aspect, sizeof(T), bytesPerRow); } void WaitABit(); @@ -401,7 +397,6 @@ class DawnTestBase { wgpu::Origin3D origin, wgpu::Extent3D extent, uint32_t level, - uint32_t layer, wgpu::TextureAspect aspect, uint32_t dataSize, uint32_t bytesPerRow); diff --git a/src/tests/end2end/DepthBiasTests.cpp b/src/tests/end2end/DepthBiasTests.cpp index 6d5729e3e5..414455e91e 100644 --- a/src/tests/end2end/DepthBiasTests.cpp +++ b/src/tests/end2end/DepthBiasTests.cpp @@ -162,7 +162,7 @@ TEST_P(DepthBiasTests, PositiveBiasOnFloat) { 0.5, 0.5, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -182,7 +182,7 @@ TEST_P(DepthBiasTests, PositiveBiasOnFloatWithClamp) { 0.375, 0.375, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -204,7 +204,7 @@ TEST_P(DepthBiasTests, NegativeBiasOnFloat) { 0.0, 0.0, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -224,7 +224,7 @@ TEST_P(DepthBiasTests, NegativeBiasOnFloatWithClamp) { 0.125, 0.125, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -243,7 +243,7 @@ TEST_P(DepthBiasTests, PositiveInfinitySlopeBiasOnFloat) { 1.0, 1.0, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -262,7 +262,7 @@ TEST_P(DepthBiasTests, NegativeInfinityBiasOnFloat) { 0.0, 0.0, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -277,7 +277,7 @@ TEST_P(DepthBiasTests, NoBiasTiltedXOnFloat) { 0.125, 0.125, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -292,7 +292,7 @@ TEST_P(DepthBiasTests, PositiveSlopeBiasOnFloat) { 0.375, 0.375, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } @@ -307,7 +307,7 @@ TEST_P(DepthBiasTests, NegativeHalfSlopeBiasOnFloat) { 0.0, 0.0, // }; - EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, 0, + EXPECT_TEXTURE_EQ(expected.data(), mDepthTexture, {0, 0}, {kRTSize, kRTSize}, 0, wgpu::TextureAspect::DepthOnly); } diff --git a/src/tests/end2end/DepthStencilCopyTests.cpp b/src/tests/end2end/DepthStencilCopyTests.cpp index 38e95c7aa3..356c0784f1 100644 --- a/src/tests/end2end/DepthStencilCopyTests.cpp +++ b/src/tests/end2end/DepthStencilCopyTests.cpp @@ -300,7 +300,7 @@ class DepthStencilCopyTests : public DawnTest { queue.Submit(1, &commands); std::vector colorData(width * height, 1u); - EXPECT_TEXTURE_EQ(colorData.data(), colorTexture, {0, 0}, {width, height}, 0, 0); + EXPECT_TEXTURE_EQ(colorData.data(), colorTexture, {0, 0}, {width, height}); } wgpu::ShaderModule mVertexModule; @@ -323,7 +323,7 @@ TEST_P(DepthStencilCopyTests, FromDepthAspect) { 0.3, 0.3, 0.0, 0.0, // 0.3, 0.3, 0.0, 0.0, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthTexture, {0, 0}, {kWidth, kHeight}, 0, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), depthTexture, {0, 0}, {kWidth, kHeight}, 0, wgpu::TextureAspect::DepthOnly); } @@ -348,7 +348,7 @@ TEST_P(DepthStencilCopyTests, FromStencilAspect) { 1u, 1u, 0u, 0u, // 1u, 1u, 0u, 0u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthStencilTexture, {0, 0}, {kWidth, kHeight}, 0, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), depthStencilTexture, {0, 0}, {kWidth, kHeight}, 0, wgpu::TextureAspect::StencilOnly); } @@ -373,7 +373,7 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipStencilAspect) { 1u, 1u, 0u, 0u, // 1u, 1u, 0u, 0u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthStencilTexture, {0, 0}, {4, 4}, 1, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), depthStencilTexture, {0, 0}, {4, 4}, 1, wgpu::TextureAspect::StencilOnly); } @@ -391,7 +391,7 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipDepthAspect) { 0.4, 0.4, 0.0, 0.0, // 0.4, 0.4, 0.0, 0.0, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), depthTexture, {0, 0}, {4, 4}, 1, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), depthTexture, {0, 0}, {4, 4}, 1, wgpu::TextureAspect::DepthOnly); } @@ -420,7 +420,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) { 3u, 3u, 1u, 1u, // 3u, 3u, 1u, 1u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, wgpu::TextureAspect::StencilOnly); } @@ -443,7 +443,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableStencil) { 3u, 3u, 1u, 1u, // 3u, 3u, 1u, 1u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, wgpu::TextureAspect::StencilOnly); } @@ -469,7 +469,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableNonZeroMipStenc 3u, 3u, 1u, 1u, // 3u, 3u, 1u, 1u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {4, 4}, 1, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {4, 4}, 1, wgpu::TextureAspect::StencilOnly); } @@ -525,7 +525,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencilThenDepth) { 3u, 3u, 1u, 1u, // 3u, 3u, 1u, 1u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, wgpu::TextureAspect::StencilOnly); // Check the depth @@ -574,7 +574,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepthThenStencil) { 3u, 3u, 1u, 1u, // 3u, 3u, 1u, 1u, // }; - EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, 0, + EXPECT_TEXTURE_EQ(expectedData.data(), texture, {0, 0}, {kWidth, kHeight}, 0, wgpu::TextureAspect::StencilOnly); } @@ -673,7 +673,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) { // Copy back the stencil data and check it is correct. EXPECT_TEXTURE_EQ(expectedStencilData.data(), depthStencilTexture, {0, 0}, {kWidth, kHeight}, 0, - 0, wgpu::TextureAspect::StencilOnly); + wgpu::TextureAspect::StencilOnly); ExpectDepthData(depthStencilTexture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight, 0, diff --git a/src/tests/end2end/NonzeroTextureCreationTests.cpp b/src/tests/end2end/NonzeroTextureCreationTests.cpp index 57ba60122d..cb3427f88b 100644 --- a/src/tests/end2end/NonzeroTextureCreationTests.cpp +++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp @@ -64,7 +64,7 @@ TEST_P(NonzeroTextureCreationTests, Depth32TextureCreationDepthClears) { // TODO(crbug.com/dawn/145): Test other formats via sampling. wgpu::Texture texture = device.CreateTexture(&descriptor); std::vector expected(kSize * kSize, 1.f); - EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0}, {kSize, kSize}, 0, 0); + EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0}, {kSize, kSize}); } // Test that non-zero mip level clears 0xFF because toggle is enabled. diff --git a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp index 6b86cf1d36..94d18c2260 100644 --- a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp +++ b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp @@ -85,8 +85,8 @@ class SubresourceRenderAttachmentTest : public DawnTest { } case Type::Depth: { std::vector expected(renderTargetSize * renderTargetSize, expectedDepth); - EXPECT_TEXTURE_FLOAT_EQ(expected.data(), renderTarget, 0, 0, renderTargetSize, - renderTargetSize, baseMipLevel, baseArrayLayer); + EXPECT_TEXTURE_FLOAT_EQ(expected.data(), renderTarget, (0, 0, baseArrayLayer), + (renderTargetSize, renderTargetSize), baseMipLevel); break; } case Type::Stencil: diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp index 33ee637486..c90d1b4078 100644 --- a/src/tests/end2end/TextureZeroInitTests.cpp +++ b/src/tests/end2end/TextureZeroInitTests.cpp @@ -663,7 +663,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) { std::vector expected(kSize * kSize, 2); EXPECT_LAZY_CLEAR( 0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, {kSize, kSize}, - 0, 0, wgpu::TextureAspect::StencilOnly)); + 0, wgpu::TextureAspect::StencilOnly)); } } @@ -736,7 +736,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) { std::vector expected(kSize * kSize, 0); EXPECT_LAZY_CLEAR( 0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, {kSize, kSize}, - 0, 0, wgpu::TextureAspect::StencilOnly)); + 0, wgpu::TextureAspect::StencilOnly)); } } } @@ -779,9 +779,8 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) { // Check by copy that the stencil data is lazily cleared to 0. std::vector expected(kSize * kSize, 0); - EXPECT_LAZY_CLEAR( - 1u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, {kSize, kSize}, 0, 0, - wgpu::TextureAspect::StencilOnly)); + EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, + {kSize, kSize}, 0, wgpu::TextureAspect::StencilOnly)); // Everything is initialized now EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0, diff --git a/src/tests/end2end/ViewportTests.cpp b/src/tests/end2end/ViewportTests.cpp index 6442a4c87a..00eeab557b 100644 --- a/src/tests/end2end/ViewportTests.cpp +++ b/src/tests/end2end/ViewportTests.cpp @@ -144,7 +144,7 @@ class ViewportTest : public DawnTest { (maxDepth + minDepth) / 2, minDepth, }; - EXPECT_TEXTURE_EQ(expected.data(), depthTexture, {0, 0}, {3, 1}, 0, 0); + EXPECT_TEXTURE_EQ(expected.data(), depthTexture, {0, 0}, {3, 1}); } };