Remove parameter layer and use origin.z in MACROs
This change removes layer and use origin.z in MACROs
EXPECT_TEXTURE_FLOAT_EQ and EXPECT_TEXTURE_EQ.
It also removes parameter layer in MACROs' implementation
functions AddTextureExpectation and AddTextureExpectationImpl
and use origin.z instead in these functions.
BUG: dawn:747
Change-Id: I0103524074c6c250fa2f85bf9c3abda8c8cd2197
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47000
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Yunchao He <yunchao.he@intel.com>
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 940aa1b..b6ac837 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -1005,7 +1005,6 @@
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 @@
// 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 3b5dbab..1078d31 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 @@
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<T>(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 <typename T>
@@ -344,12 +343,10 @@
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<T>(expectedData), texture,
- origin, {1, 1}, level, layer, aspect, sizeof(T),
- bytesPerRow);
+ origin, {1, 1}, level, aspect, sizeof(T), bytesPerRow);
}
template <typename T>
@@ -362,12 +359,11 @@
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<T>(color0, color1), texture, {x, y}, {1, 1},
- level, layer, aspect, sizeof(T), bytesPerRow);
+ level, aspect, sizeof(T), bytesPerRow);
}
void WaitABit();
@@ -401,7 +397,6 @@
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 6d5729e..414455e 100644
--- a/src/tests/end2end/DepthBiasTests.cpp
+++ b/src/tests/end2end/DepthBiasTests.cpp
@@ -162,7 +162,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 38e95c7..356c078 100644
--- a/src/tests/end2end/DepthStencilCopyTests.cpp
+++ b/src/tests/end2end/DepthStencilCopyTests.cpp
@@ -300,7 +300,7 @@
queue.Submit(1, &commands);
std::vector<uint32_t> 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 57ba601..cb3427f 100644
--- a/src/tests/end2end/NonzeroTextureCreationTests.cpp
+++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp
@@ -64,7 +64,7 @@
// TODO(crbug.com/dawn/145): Test other formats via sampling.
wgpu::Texture texture = device.CreateTexture(&descriptor);
std::vector<float> 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 6b86cf1..94d18c2 100644
--- a/src/tests/end2end/SubresourceRenderAttachmentTests.cpp
+++ b/src/tests/end2end/SubresourceRenderAttachmentTests.cpp
@@ -85,8 +85,8 @@
}
case Type::Depth: {
std::vector<float> 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 33ee637..c90d1b4 100644
--- a/src/tests/end2end/TextureZeroInitTests.cpp
+++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -663,7 +663,7 @@
std::vector<uint8_t> 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 @@
std::vector<uint8_t> 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 @@
// Check by copy that the stencil data is lazily cleared to 0.
std::vector<uint8_t> 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 6442a4c..00eeab5 100644
--- a/src/tests/end2end/ViewportTests.cpp
+++ b/src/tests/end2end/ViewportTests.cpp
@@ -144,7 +144,7 @@
(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});
}
};