Use __VA_ARGS__ for texture expectation helpers/macros
After we applied __VA_ARGS__ in macros and use {x, y} and {w, h} to replace (x, y) and (w, h) in EXPECT_TEXTURE_RGBA8_EQ and EXPECT_TEXTURE_FLOAT_EQ, we can use the more general macro EXPECT_TEXTURE_EQ. Then these two macros can be removed. Austin has already put a TODO for this change but didn't do that. utils::MakeOrigin and utils::MakeExtent are removed because they are not needed. In addition, this change removes 0 in callers for parameter level, because level's default values is 0 in helpers implementation. BUG: dawn:748 Change-Id: Iece4db7a8ed1d47b57988412f1c897205e7403d4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47100 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
parent
47b6b680e1
commit
0da94c3d66
|
@ -67,17 +67,9 @@
|
||||||
#define EXPECT_PIXEL_RGBA8_EQ(expected, texture, x, y) \
|
#define EXPECT_PIXEL_RGBA8_EQ(expected, texture, x, y) \
|
||||||
AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y})
|
AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y})
|
||||||
|
|
||||||
#define EXPECT_TEXTURE_RGBA8_EQ(expected, texture, origin, extent, level) \
|
|
||||||
AddTextureExpectation(__FILE__, __LINE__, expected, texture, utils::MakeOrigin origin, \
|
|
||||||
utils::MakeExtent extent, level)
|
|
||||||
|
|
||||||
#define EXPECT_PIXEL_FLOAT_EQ(expected, texture, x, y) \
|
#define EXPECT_PIXEL_FLOAT_EQ(expected, texture, x, y) \
|
||||||
AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y})
|
AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y})
|
||||||
|
|
||||||
#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) \
|
#define EXPECT_PIXEL_RGBA8_BETWEEN(color0, color1, texture, x, y) \
|
||||||
AddTextureBetweenColorsExpectation(__FILE__, __LINE__, color0, color1, texture, x, y)
|
AddTextureBetweenColorsExpectation(__FILE__, __LINE__, color0, color1, texture, x, y)
|
||||||
|
|
||||||
|
|
|
@ -197,9 +197,8 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color,
|
EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {expectedOrigin.x, expectedOrigin.y},
|
||||||
(expectedOrigin.x, expectedOrigin.y),
|
{expectedExtent.width, expectedExtent.height});
|
||||||
(expectedExtent.width, expectedExtent.height), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the tests that copies pre-prepared BC format data into a BC texture and verifies if we
|
// Run the tests that copies pre-prepared BC format data into a BC texture and verifies if we
|
||||||
|
|
|
@ -299,11 +299,10 @@ class CopyTests_B2T : public CopyTests {
|
||||||
copySize.width, copySize.height, copyDepth, bufferSpec.bytesPerRow,
|
copySize.width, copySize.height, copyDepth, bufferSpec.bytesPerRow,
|
||||||
expected.data(), copySize.width * bytesPerTexel);
|
expected.data(), copySize.width * bytesPerTexel);
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture,
|
EXPECT_TEXTURE_EQ(expected.data(), texture,
|
||||||
(textureSpec.copyOrigin.x, textureSpec.copyOrigin.y,
|
{textureSpec.copyOrigin.x, textureSpec.copyOrigin.y,
|
||||||
textureSpec.copyOrigin.z + layer),
|
textureSpec.copyOrigin.z + layer},
|
||||||
(copySize.width, copySize.height, copyDepth),
|
{copySize.width, copySize.height, copyDepth}, textureSpec.copyLevel)
|
||||||
textureSpec.copyLevel)
|
|
||||||
<< "Buffer to Texture copy failed copying " << bufferSpec.size
|
<< "Buffer to Texture copy failed copying " << bufferSpec.size
|
||||||
<< "-byte buffer with offset " << bufferSpec.offset << " and bytes per row "
|
<< "-byte buffer with offset " << bufferSpec.offset << " and bytes per row "
|
||||||
<< bufferSpec.bytesPerRow << " to [(" << textureSpec.copyOrigin.x << ", "
|
<< bufferSpec.bytesPerRow << " to [(" << textureSpec.copyOrigin.x << ", "
|
||||||
|
|
|
@ -324,7 +324,7 @@ TEST_P(DepthBiasTests, PositiveBiasOn24bit) {
|
||||||
RGBA8::kRed, RGBA8::kRed, //
|
RGBA8::kRed, RGBA8::kRed, //
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), mRenderTarget, (0, 0), (kRTSize, kRTSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), mRenderTarget, {0, 0}, {kRTSize, kRTSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test adding positive bias to output with a clamp
|
// Test adding positive bias to output with a clamp
|
||||||
|
@ -345,7 +345,7 @@ TEST_P(DepthBiasTests, PositiveBiasOn24bitWithClamp) {
|
||||||
RGBA8::kZero, RGBA8::kZero, //
|
RGBA8::kZero, RGBA8::kZero, //
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(zero.data(), mRenderTarget, (0, 0), (kRTSize, kRTSize), 0);
|
EXPECT_TEXTURE_EQ(zero.data(), mRenderTarget, {0, 0}, {kRTSize, kRTSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test adding positive bias to output
|
// Test adding positive bias to output
|
||||||
|
@ -360,7 +360,7 @@ TEST_P(DepthBiasTests, PositiveSlopeBiasOn24bit) {
|
||||||
RGBA8::kZero, RGBA8::kZero, //
|
RGBA8::kZero, RGBA8::kZero, //
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), mRenderTarget, (0, 0), (kRTSize, kRTSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), mRenderTarget, {0, 0}, {kRTSize, kRTSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DepthBiasTests,
|
DAWN_INSTANTIATE_TEST(DepthBiasTests,
|
||||||
|
|
|
@ -180,8 +180,8 @@ class MultisampledRenderingTest : public DawnTest {
|
||||||
constexpr uint32_t kMiddleY = (kHeight - 1) / 2;
|
constexpr uint32_t kMiddleY = (kHeight - 1) / 2;
|
||||||
|
|
||||||
RGBA8 expectedColor = ExpectedMSAAColor(inputColor, msaaCoverage);
|
RGBA8 expectedColor = ExpectedMSAAColor(inputColor, msaaCoverage);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, resolveTexture, (kMiddleX, kMiddleY, arrayLayer),
|
EXPECT_TEXTURE_EQ(&expectedColor, resolveTexture, {kMiddleX, kMiddleY, arrayLayer}, {1, 1},
|
||||||
(1, 1), mipmapLevel);
|
mipmapLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr static uint32_t kWidth = 3;
|
constexpr static uint32_t kWidth = 3;
|
||||||
|
@ -800,7 +800,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut
|
||||||
queue.Submit(1, &commandBuffer);
|
queue.Submit(1, &commandBuffer);
|
||||||
|
|
||||||
RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage);
|
RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test doing MSAA resolve into multiple resolve targets works correctly with a non-default
|
// Test doing MSAA resolve into multiple resolve targets works correctly with a non-default
|
||||||
|
@ -909,7 +909,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithAlphaToCoverage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RGBA8 expectedColor = ExpectedMSAAColor(kGreen, msaaCoverage);
|
RGBA8 expectedColor = ExpectedMSAAColor(kGreen, msaaCoverage);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,8 +962,8 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithAlphaToCo
|
||||||
// using only the first one.
|
// using only the first one.
|
||||||
RGBA8 expectedRed = ExpectedMSAAColor(kRed, kMSAACoverage);
|
RGBA8 expectedRed = ExpectedMSAAColor(kRed, kMSAACoverage);
|
||||||
RGBA8 expectedGreen = ExpectedMSAAColor(kGreen, kMSAACoverage);
|
RGBA8 expectedGreen = ExpectedMSAAColor(kGreen, kMSAACoverage);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedRed, mResolveTexture, (1, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&expectedRed, mResolveTexture, {1, 0}, {1, 1});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedGreen, resolveTexture2, (1, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&expectedGreen, resolveTexture2, {1, 0}, {1, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,7 +1024,7 @@ TEST_P(MultisampledRenderingTest, MultisampledRenderingWithDepthTestAndAlphaToCo
|
||||||
(kGreen.a + kRed.a) / 2.0};
|
(kGreen.a + kRed.a) / 2.0};
|
||||||
RGBA8 expectedColor = ExpectedMSAAColor(kHalfGreenHalfRed, 1.0f);
|
RGBA8 expectedColor = ExpectedMSAAColor(kHalfGreenHalfRed, 1.0f);
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test using one multisampled color attachment with resolve target can render correctly
|
// Test using one multisampled color attachment with resolve target can render correctly
|
||||||
|
@ -1068,7 +1068,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithAlphaToCoverageAndSamp
|
||||||
queue.Submit(1, &commandBuffer);
|
queue.Submit(1, &commandBuffer);
|
||||||
|
|
||||||
RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage * alpha);
|
RGBA8 expectedColor = ExpectedMSAAColor(kGreen, kMSAACoverage * alpha);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&expectedColor, mResolveTexture, {1, 0}, {1, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) {
|
||||||
expected.push_back(filled);
|
expected.push_back(filled);
|
||||||
}
|
}
|
||||||
uint32_t mipSize = kSize >> 2;
|
uint32_t mipSize = kSize >> 2;
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0), (mipSize, mipSize), 2);
|
EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0}, {mipSize, mipSize}, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that non-zero array layers clears 0xFF because toggle is enabled.
|
// Test that non-zero array layers clears 0xFF because toggle is enabled.
|
||||||
|
@ -112,7 +112,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
||||||
expected.push_back(filled);
|
expected.push_back(filled);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0, 2), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0, 2}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that nonrenderable texture formats clear 0x01 because toggle is enabled
|
// Test that nonrenderable texture formats clear 0x01 because toggle is enabled
|
||||||
|
@ -212,7 +212,7 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0, i), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&filled, texture, {0, 0, i}, {1, 1}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.mipLevelCount; ++i) {
|
for (uint32_t i = 0; i < descriptor.mipLevelCount; ++i) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), i);
|
EXPECT_TEXTURE_EQ(&filled, texture, {0, 0}, {1, 1}, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
||||||
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0, i), (1, 1), j);
|
EXPECT_TEXTURE_EQ(&filled, texture, {0, 0, i}, {1, 1}, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableAllSubresourcesFilled) {
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0, i), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&filled, texture, {0, 0, i}, {1, 1}, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableAllSubresourcesFilled) {
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.mipLevelCount; ++i) {
|
for (uint32_t i = 0; i < descriptor.mipLevelCount; ++i) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), i);
|
EXPECT_TEXTURE_EQ(&filled, texture, {0, 0}, {1, 1}, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableAllSubresourcesFilled) {
|
||||||
|
|
||||||
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
for (uint32_t i = 0; i < descriptor.size.depthOrArrayLayers; ++i) {
|
||||||
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
for (uint32_t j = 0; j < descriptor.mipLevelCount; ++j) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0, i), (1, 1), j);
|
EXPECT_TEXTURE_EQ(&filled, texture, {0, 0, i}, {1, 1}, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,9 +308,9 @@ class QueueWriteTextureTests : public DawnTest {
|
||||||
PackTextureData(data.data() + dataOffset, copySize.width, copySize.height,
|
PackTextureData(data.data() + dataOffset, copySize.width, copySize.height,
|
||||||
dataSpec.bytesPerRow, expected.data(), copySize.width, bytesPerTexel);
|
dataSpec.bytesPerRow, expected.data(), copySize.width, bytesPerTexel);
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture,
|
EXPECT_TEXTURE_EQ(expected.data(), texture,
|
||||||
(textureSpec.copyOrigin.x, textureSpec.copyOrigin.y, slice),
|
{textureSpec.copyOrigin.x, textureSpec.copyOrigin.y, slice},
|
||||||
(copySize.width, copySize.height), textureSpec.level)
|
{copySize.width, copySize.height}, textureSpec.level)
|
||||||
<< "Write to texture failed copying " << dataSpec.size << "-byte data with offset "
|
<< "Write to texture failed copying " << dataSpec.size << "-byte data with offset "
|
||||||
<< dataSpec.offset << " and bytes per row " << dataSpec.bytesPerRow << " to [("
|
<< dataSpec.offset << " and bytes per row " << dataSpec.bytesPerRow << " to [("
|
||||||
<< textureSpec.copyOrigin.x << ", " << textureSpec.copyOrigin.y << "), ("
|
<< textureSpec.copyOrigin.x << ", " << textureSpec.copyOrigin.y << "), ("
|
||||||
|
@ -346,7 +346,7 @@ class QueueWriteTextureTests : public DawnTest {
|
||||||
device.GetQueue().WriteTexture(&imageCopyTexture, data.data(), width * height * kPixelSize,
|
device.GetQueue().WriteTexture(&imageCopyTexture, data.data(), width * height * kPixelSize,
|
||||||
&textureDataLayout, ©Extent);
|
&textureDataLayout, ©Extent);
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (width, height), 0);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {width, height});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -166,10 +166,10 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) {
|
||||||
auto commandsClearGreen = commandsClearGreenEncoder.Finish();
|
auto commandsClearGreen = commandsClearGreenEncoder.Finish();
|
||||||
|
|
||||||
queue.Submit(1, &commandsClearZero);
|
queue.Submit(1, &commandsClearZero);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectZero.data(), renderTarget, (0, 0), (kRTSize, kRTSize), 0);
|
EXPECT_TEXTURE_EQ(expectZero.data(), renderTarget, {0, 0}, {kRTSize, kRTSize});
|
||||||
|
|
||||||
queue.Submit(1, &commandsClearGreen);
|
queue.Submit(1, &commandsClearGreen);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectGreen.data(), renderTarget, (0, 0), (kRTSize, kRTSize), 0);
|
EXPECT_TEXTURE_EQ(expectGreen.data(), renderTarget, {0, 0}, {kRTSize, kRTSize});
|
||||||
|
|
||||||
// Part 2: draw a blue quad into the right half of the render target, and check result
|
// Part 2: draw a blue quad into the right half of the render target, and check result
|
||||||
utils::ComboRenderPassDescriptor renderPassLoad({renderTargetView});
|
utils::ComboRenderPassDescriptor renderPassLoad({renderTargetView});
|
||||||
|
@ -185,10 +185,9 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) {
|
||||||
|
|
||||||
queue.Submit(1, &commandsLoad);
|
queue.Submit(1, &commandsLoad);
|
||||||
// Left half should still be green
|
// Left half should still be green
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectGreen.data(), renderTarget, (0, 0), (kRTSize / 2, kRTSize), 0);
|
EXPECT_TEXTURE_EQ(expectGreen.data(), renderTarget, {0, 0}, {kRTSize / 2, kRTSize});
|
||||||
// Right half should now be blue
|
// Right half should now be blue
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectBlue.data(), renderTarget, (kRTSize / 2, 0),
|
EXPECT_TEXTURE_EQ(expectBlue.data(), renderTarget, {kRTSize / 2, 0}, {kRTSize / 2, kRTSize});
|
||||||
(kRTSize / 2, kRTSize), 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test clearing a color attachment with signed and unsigned integer formats.
|
// Test clearing a color attachment with signed and unsigned integer formats.
|
||||||
|
|
|
@ -79,14 +79,14 @@ class SubresourceRenderAttachmentTest : public DawnTest {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Type::Color: {
|
case Type::Color: {
|
||||||
std::vector<RGBA8> expected(renderTargetSize * renderTargetSize, expectedColor);
|
std::vector<RGBA8> expected(renderTargetSize * renderTargetSize, expectedColor);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderTarget, (0, 0, baseArrayLayer),
|
EXPECT_TEXTURE_EQ(expected.data(), renderTarget, {0, 0, baseArrayLayer},
|
||||||
(renderTargetSize, renderTargetSize), baseMipLevel);
|
{renderTargetSize, renderTargetSize}, baseMipLevel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::Depth: {
|
case Type::Depth: {
|
||||||
std::vector<float> expected(renderTargetSize * renderTargetSize, expectedDepth);
|
std::vector<float> expected(renderTargetSize * renderTargetSize, expectedDepth);
|
||||||
EXPECT_TEXTURE_FLOAT_EQ(expected.data(), renderTarget, (0, 0, baseArrayLayer),
|
EXPECT_TEXTURE_EQ(expected.data(), renderTarget, {0, 0, baseArrayLayer},
|
||||||
(renderTargetSize, renderTargetSize), baseMipLevel);
|
{renderTargetSize, renderTargetSize}, baseMipLevel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::Stencil:
|
case Type::Stencil:
|
||||||
|
|
|
@ -169,8 +169,8 @@ TEST_P(TextureSubresourceTest, MipmapLevelsTest) {
|
||||||
// black in render view (mip level 1).
|
// black in render view (mip level 1).
|
||||||
RGBA8 topRight = RGBA8::kBlack;
|
RGBA8 topRight = RGBA8::kBlack;
|
||||||
RGBA8 bottomLeft = RGBA8::kRed;
|
RGBA8 bottomLeft = RGBA8::kRed;
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&topRight, texture, (kSize / 2 - 1, 0), (1, 1), 1);
|
EXPECT_TEXTURE_EQ(&topRight, texture, {kSize / 2 - 1, 0}, {1, 1}, 1);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&bottomLeft, texture, (0, kSize / 2 - 1), (1, 1), 1);
|
EXPECT_TEXTURE_EQ(&bottomLeft, texture, {0, kSize / 2 - 1}, {1, 1}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test different array layers
|
// Test different array layers
|
||||||
|
@ -197,8 +197,8 @@ TEST_P(TextureSubresourceTest, ArrayLayersTest) {
|
||||||
// black in render view (array layer 1).
|
// black in render view (array layer 1).
|
||||||
RGBA8 topRight = RGBA8::kBlack;
|
RGBA8 topRight = RGBA8::kBlack;
|
||||||
RGBA8 bottomLeft = RGBA8::kRed;
|
RGBA8 bottomLeft = RGBA8::kRed;
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&topRight, texture, (kSize - 1, 0, 1), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&topRight, texture, {kSize - 1, 0, 1}, {1, 1});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&bottomLeft, texture, (0, kSize - 1, 1), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&bottomLeft, texture, {0, kSize - 1, 1}, {1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO (yunchao.he@intel.com):
|
// TODO (yunchao.he@intel.com):
|
||||||
|
|
|
@ -532,8 +532,8 @@ class TextureViewRenderingTest : public DawnTest {
|
||||||
bytesPerRow / kBytesPerTexel * (textureWidthLevel0 - 1) + textureHeightLevel0;
|
bytesPerRow / kBytesPerTexel * (textureWidthLevel0 - 1) + textureHeightLevel0;
|
||||||
constexpr RGBA8 kExpectedPixel(0, 255, 0, 255);
|
constexpr RGBA8 kExpectedPixel(0, 255, 0, 255);
|
||||||
std::vector<RGBA8> expected(expectedDataSize, kExpectedPixel);
|
std::vector<RGBA8> expected(expectedDataSize, kExpectedPixel);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0, textureViewBaseLayer),
|
EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0, textureViewBaseLayer},
|
||||||
(textureViewWidth, textureViewHeight), textureViewBaseLevel);
|
{textureViewWidth, textureViewHeight}, textureViewBaseLevel);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ TEST_P(TextureZeroInitTest, CopyMultipleTextureArrayLayersToBufferSource) {
|
||||||
|
|
||||||
const std::vector<RGBA8> kExpectedAllZero(kSize * kSize, {0, 0, 0, 0});
|
const std::vector<RGBA8> kExpectedAllZero(kSize * kSize, {0, 0, 0, 0});
|
||||||
for (uint32_t layer = 0; layer < kArrayLayers; ++layer) {
|
for (uint32_t layer = 0; layer < kArrayLayers; ++layer) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(kExpectedAllZero.data(), texture, (0, 0, layer), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(kExpectedAllZero.data(), texture, {0, 0, layer}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,8 +215,8 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
|
||||||
uint32_t mipSize = kSize >> 2;
|
uint32_t mipSize = kSize >> 2;
|
||||||
std::vector<RGBA8> expected(mipSize * mipSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expected(mipSize * mipSize, {0, 0, 0, 0});
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0, baseArrayLayer),
|
EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0, baseArrayLayer}, {mipSize, mipSize},
|
||||||
(mipSize, mipSize), baseMipLevel);
|
baseMipLevel);
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(
|
||||||
|
@ -258,8 +258,8 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
|
||||||
|
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expected(kSize * kSize, {0, 0, 0, 0});
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0, baseArrayLayer),
|
EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0, baseArrayLayer}, {kSize, kSize},
|
||||||
(kSize, kSize), baseMipLevel);
|
baseMipLevel);
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(
|
||||||
|
@ -290,7 +290,7 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
|
||||||
|
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {100, 100, 100, 100});
|
std::vector<RGBA8> expected(kSize * kSize, {100, 100, 100, 100});
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -322,9 +322,9 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) {
|
||||||
std::vector<RGBA8> expected100((kSize / 2) * kSize, {100, 100, 100, 100});
|
std::vector<RGBA8> expected100((kSize / 2) * kSize, {100, 100, 100, 100});
|
||||||
std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
||||||
// first half filled with 100, by the buffer data
|
// first half filled with 100, by the buffer data
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected100.data(), texture, (0, 0), (kSize / 2, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected100.data(), texture, {0, 0}, {kSize / 2, kSize});
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kSize / 2, 0), (kSize / 2, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedZeros.data(), texture, {kSize / 2, 0}, {kSize / 2, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -363,7 +363,7 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureMultipleArrayLayers) {
|
||||||
|
|
||||||
const std::vector<RGBA8> expected100(kSize * kSize, {100, 100, 100, 100});
|
const std::vector<RGBA8> expected100(kSize * kSize, {100, 100, 100, 100});
|
||||||
for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) {
|
for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected100.data(), texture, (0, 0, layer), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected100.data(), texture, {0, 0, layer}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,8 +395,8 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
|
||||||
|
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expected(kSize * kSize, {0, 0, 0, 0});
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), dstTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), dstTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -450,10 +450,9 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
||||||
std::vector<RGBA8> expectedWithZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedWithZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
||||||
std::vector<RGBA8> expectedWith100(kSize * kSize, {100, 100, 100, 100});
|
std::vector<RGBA8> expectedWith100(kSize * kSize, {100, 100, 100, 100});
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedWith100.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedWith100.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedWith100.data(), dstTexture, (0, 0), (kSize / 2, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedWith100.data(), dstTexture, {0, 0}, {kSize / 2, kSize});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), dstTexture, (kSize / 2, 0),
|
EXPECT_TEXTURE_EQ(expectedWithZeros.data(), dstTexture, {kSize / 2, 0}, {kSize / 2, kSize});
|
||||||
(kSize / 2, kSize), 0);
|
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -496,7 +495,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
|
||||||
|
|
||||||
// Expect the texture to be red because depth test passed.
|
// Expect the texture to be red because depth test passed.
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -538,7 +537,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
|
||||||
|
|
||||||
// Expect the texture to be red because stencil test passed.
|
// Expect the texture to be red because stencil test passed.
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -577,7 +576,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
|
||||||
|
|
||||||
// Expect the texture to be red because both depth and stencil tests passed.
|
// Expect the texture to be red because both depth and stencil tests passed.
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -646,7 +645,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
||||||
// Expect the texture to be red because the depth and stencil tests passed. Depth was 0
|
// Expect the texture to be red because the depth and stencil tests passed. Depth was 0
|
||||||
// and stencil was 2.
|
// and stencil was 2.
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), colorTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), colorTexture, {0, 0}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything is initialized now
|
// Everything is initialized now
|
||||||
|
@ -719,7 +718,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
||||||
// Expect the texture to be red because both the depth a stencil tests passed.
|
// Expect the texture to be red because both the depth a stencil tests passed.
|
||||||
// Depth was 0.7 and stencil was 0
|
// Depth was 0.7 and stencil was 0
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), colorTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), colorTexture, {0, 0}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything is initialized now
|
// Everything is initialized now
|
||||||
|
@ -817,7 +816,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
|
||||||
// Expect the texture to be red because both the depth a stencil tests passed.
|
// Expect the texture to be red because both the depth a stencil tests passed.
|
||||||
// Depth was 0.3 and stencil was 0
|
// Depth was 0.3 and stencil was 0
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expected(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), colorTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), colorTexture, {0, 0}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -837,7 +836,7 @@ TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
|
||||||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||||
|
|
||||||
std::vector<RGBA8> expected(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expected(kSize * kSize, {0, 0, 0, 0});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true,
|
EXPECT_EQ(true,
|
||||||
|
@ -882,7 +881,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
||||||
|
|
||||||
// Expect the rendered texture to be cleared
|
// Expect the rendered texture to be cleared
|
||||||
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(renderTexture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(renderTexture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -941,8 +940,8 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
||||||
|
|
||||||
// Expect both subresources to be zero: the sampled one with lazy-clearing and the attachment
|
// Expect both subresources to be zero: the sampled one with lazy-clearing and the attachment
|
||||||
// because it sampled the lazy-cleared sampled subresource.
|
// because it sampled the lazy-cleared sampled subresource.
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&RGBA8::kZero, texture, (0, 0, 0), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&RGBA8::kZero, texture, {0, 0, 0}, {1, 1});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&RGBA8::kZero, texture, (0, 0, 1), (1, 1), 0);
|
EXPECT_TEXTURE_EQ(&RGBA8::kZero, texture, {0, 0, 1}, {1, 1});
|
||||||
|
|
||||||
// The whole texture is now initialized.
|
// The whole texture is now initialized.
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 2));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 2));
|
||||||
|
@ -1115,7 +1114,7 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClearWithMultiArrayLayers) {
|
||||||
// This tests that storeOp clear resets resource state to uninitialized.
|
// This tests that storeOp clear resets resource state to uninitialized.
|
||||||
// Start with a sample texture that is initialized with data.
|
// Start with a sample texture that is initialized with data.
|
||||||
// Then expect the render texture to not store the data from sample texture
|
// Then expect the render texture to not store the data from sample texture
|
||||||
// because it will be lazy cleared by the EXPECT_TEXTURE_RGBA8_EQ call.
|
// because it will be lazy cleared by the EXPECT_TEXTURE_EQ call.
|
||||||
TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
||||||
// Create needed resources
|
// Create needed resources
|
||||||
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||||
|
@ -1169,8 +1168,8 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
||||||
|
|
||||||
// Expect the rendered texture to be cleared
|
// Expect the rendered texture to be cleared
|
||||||
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
||||||
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0),
|
EXPECT_LAZY_CLEAR(
|
||||||
(kSize, kSize), 0));
|
1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize}));
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
||||||
|
@ -1223,7 +1222,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) {
|
||||||
// The depth stencil test should fail and not draw because the depth stencil texture is
|
// The depth stencil test should fail and not draw because the depth stencil texture is
|
||||||
// cleared to 1's by using loadOp clear and set values from descriptor.
|
// cleared to 1's by using loadOp clear and set values from descriptor.
|
||||||
std::vector<RGBA8> expectedBlack(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedBlack(kSize * kSize, {0, 0, 0, 0});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedBlack.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedBlack.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be false since storeop is clear, sets
|
// Expect texture subresource initialized to be false since storeop is clear, sets
|
||||||
// subresource as uninitialized
|
// subresource as uninitialized
|
||||||
|
@ -1248,7 +1247,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) {
|
||||||
// Now the depth stencil test should pass since depth stencil texture is cleared to 0's by
|
// Now the depth stencil test should pass since depth stencil texture is cleared to 0's by
|
||||||
// loadop load and uninitialized subresource, so we should have a red square
|
// loadop load and uninitialized subresource, so we should have a red square
|
||||||
std::vector<RGBA8> expectedRed(kSize * kSize, {255, 0, 0, 255});
|
std::vector<RGBA8> expectedRed(kSize * kSize, {255, 0, 0, 255});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedRed.data(), srcTexture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedRed.data(), srcTexture, {0, 0}, {kSize, kSize});
|
||||||
|
|
||||||
// Expect texture subresource initialized to be false since storeop is clear, sets
|
// Expect texture subresource initialized to be false since storeop is clear, sets
|
||||||
// subresource as uninitialized
|
// subresource as uninitialized
|
||||||
|
@ -1316,17 +1315,17 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
||||||
// Expect the rendered texture to be cleared since we copied from the uninitialized first
|
// Expect the rendered texture to be cleared since we copied from the uninitialized first
|
||||||
// mip.
|
// mip.
|
||||||
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
||||||
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0),
|
EXPECT_LAZY_CLEAR(
|
||||||
(kSize, kSize), 0));
|
1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize}, 0));
|
||||||
|
|
||||||
// Expect the first mip to have been lazy cleared to 0.
|
// Expect the first mip to have been lazy cleared to 0.
|
||||||
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), sampleTexture, (0, 0),
|
EXPECT_LAZY_CLEAR(
|
||||||
(kSize, kSize), 0));
|
0u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), sampleTexture, {0, 0}, {kSize, kSize}, 0));
|
||||||
|
|
||||||
// Expect the second mip to still be filled with 2.
|
// Expect the second mip to still be filled with 2.
|
||||||
std::vector<RGBA8> expectedWithTwos(mipSize * mipSize, {2, 2, 2, 2});
|
std::vector<RGBA8> expectedWithTwos(mipSize * mipSize, {2, 2, 2, 2});
|
||||||
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithTwos.data(), sampleTexture, (0, 0),
|
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_EQ(expectedWithTwos.data(), sampleTexture, {0, 0},
|
||||||
(mipSize, mipSize), 1));
|
{mipSize, mipSize}, 1));
|
||||||
|
|
||||||
// Expect the whole texture to be initialized
|
// Expect the whole texture to be initialized
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 2, 0, 1));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 2, 0, 1));
|
||||||
|
@ -1399,17 +1398,17 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
||||||
// Expect the rendered texture to be cleared since we copied from the uninitialized first
|
// Expect the rendered texture to be cleared since we copied from the uninitialized first
|
||||||
// array layer.
|
// array layer.
|
||||||
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedWithZeros(kSize * kSize, {0, 0, 0, 0});
|
||||||
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture,
|
EXPECT_LAZY_CLEAR(
|
||||||
(0, 0, 0), (kSize, kSize), 0));
|
1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0, 0}, {kSize, kSize}));
|
||||||
|
|
||||||
// Expect the first array layer to have been lazy cleared to 0.
|
// Expect the first array layer to have been lazy cleared to 0.
|
||||||
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), sampleTexture,
|
EXPECT_LAZY_CLEAR(
|
||||||
(0, 0, 0), (kSize, kSize), 0));
|
0u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), sampleTexture, {0, 0, 0}, {kSize, kSize}));
|
||||||
|
|
||||||
// Expect the second array layer to still be filled with 2.
|
// Expect the second array layer to still be filled with 2.
|
||||||
std::vector<RGBA8> expectedWithTwos(kSize * kSize, {2, 2, 2, 2});
|
std::vector<RGBA8> expectedWithTwos(kSize * kSize, {2, 2, 2, 2});
|
||||||
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithTwos.data(), sampleTexture, (0, 0, 1),
|
EXPECT_LAZY_CLEAR(
|
||||||
(kSize, kSize), 0));
|
0u, EXPECT_TEXTURE_EQ(expectedWithTwos.data(), sampleTexture, {0, 0, 1}, {kSize, kSize}));
|
||||||
|
|
||||||
// Expect the whole texture to be initialized
|
// Expect the whole texture to be initialized
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 1, 0, 2));
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 1, 0, 2));
|
||||||
|
@ -1485,7 +1484,7 @@ TEST_P(TextureZeroInitTest, WriteWholeTexture) {
|
||||||
// Expect texture initialized to be true
|
// Expect texture initialized to be true
|
||||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test WriteTexture to a subset of the texture, lazy init is necessary to clear the other
|
// Test WriteTexture to a subset of the texture, lazy init is necessary to clear the other
|
||||||
|
@ -1520,9 +1519,9 @@ TEST_P(TextureZeroInitTest, WriteTextureHalf) {
|
||||||
|
|
||||||
std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
||||||
// first half filled with 100, by the data
|
// first half filled with 100, by the data
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kSize / 2, kSize), 0);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kSize / 2, kSize});
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kSize / 2, 0), (kSize / 2, kSize), 0);
|
EXPECT_TEXTURE_EQ(expectedZeros.data(), texture, {kSize / 2, 0}, {kSize / 2, kSize});
|
||||||
}
|
}
|
||||||
|
|
||||||
// In this test WriteTexture fully overwrites a range of subresources, so lazy initialization
|
// In this test WriteTexture fully overwrites a range of subresources, so lazy initialization
|
||||||
|
@ -1561,7 +1560,7 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
|
||||||
kCopyLayerCount));
|
kCopyLayerCount));
|
||||||
|
|
||||||
for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) {
|
for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) {
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0, layer), (kSize, kSize), 0);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0, layer}, {kSize, kSize});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,10 +1602,9 @@ TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
|
||||||
std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0});
|
||||||
for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) {
|
for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) {
|
||||||
// first half filled with 100, by the data
|
// first half filled with 100, by the data
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0, layer), (kSize / 2, kSize), 0);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0, layer}, {kSize / 2, kSize});
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kSize / 2, 0, layer),
|
EXPECT_TEXTURE_EQ(expectedZeros.data(), texture, {kSize / 2, 0, layer}, {kSize / 2, kSize});
|
||||||
(kSize / 2, kSize), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1642,7 +1640,7 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
|
||||||
// Expect texture initialized to be true
|
// Expect texture initialized to be true
|
||||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1));
|
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1));
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kMipSize, kMipSize), kMipLevel);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kMipSize, kMipSize}, kMipLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test WriteTexture to a subset of the texture at mip level, lazy init is necessary to clear the
|
// Test WriteTexture to a subset of the texture at mip level, lazy init is necessary to clear the
|
||||||
|
@ -1682,10 +1680,10 @@ TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
|
||||||
|
|
||||||
std::vector<RGBA8> expectedZeros((kMipSize / 2) * kMipSize, {0, 0, 0, 0});
|
std::vector<RGBA8> expectedZeros((kMipSize / 2) * kMipSize, {0, 0, 0, 0});
|
||||||
// first half filled with 100, by the data
|
// first half filled with 100, by the data
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kMipSize / 2, kMipSize), kMipLevel);
|
EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kMipSize / 2, kMipSize}, kMipLevel);
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kMipSize / 2, 0),
|
EXPECT_TEXTURE_EQ(expectedZeros.data(), texture, {kMipSize / 2, 0}, {kMipSize / 2, kMipSize},
|
||||||
(kMipSize / 2, kMipSize), kMipLevel);
|
kMipLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(TextureZeroInitTest,
|
DAWN_INSTANTIATE_TEST(TextureZeroInitTest,
|
||||||
|
@ -1812,8 +1810,8 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
||||||
|
|
||||||
std::vector<RGBA8> expected(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height,
|
std::vector<RGBA8> expected(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height,
|
||||||
{0x00, 0x20, 0x08, 0xFF});
|
{0x00, 0x20, 0x08, 0xFF});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0),
|
EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0},
|
||||||
(nonPaddedCopyExtent.width, nonPaddedCopyExtent.height), 0);
|
{nonPaddedCopyExtent.width, nonPaddedCopyExtent.height});
|
||||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel,
|
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel,
|
||||||
1, baseArrayLayer, 1));
|
1, baseArrayLayer, 1));
|
||||||
|
|
||||||
|
@ -1821,8 +1819,8 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
||||||
if (halfCopyTest) {
|
if (halfCopyTest) {
|
||||||
std::vector<RGBA8> expectBlack(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height,
|
std::vector<RGBA8> expectBlack(nonPaddedCopyExtent.width * nonPaddedCopyExtent.height,
|
||||||
{0x00, 0x00, 0x00, 0xFF});
|
{0x00, 0x00, 0x00, 0xFF});
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectBlack.data(), renderPass.color, (copyExtent3D.width, 0),
|
EXPECT_TEXTURE_EQ(expectBlack.data(), renderPass.color, {copyExtent3D.width, 0},
|
||||||
(nonPaddedCopyExtent.width, nonPaddedCopyExtent.height), 0);
|
{nonPaddedCopyExtent.width, nonPaddedCopyExtent.height});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -359,11 +359,4 @@ namespace utils {
|
||||||
return device.CreateBindGroup(&descriptor);
|
return device.CreateBindGroup(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Origin3D MakeOrigin(uint32_t x, uint32_t y, uint32_t z) {
|
|
||||||
return {x, y, z};
|
|
||||||
}
|
|
||||||
|
|
||||||
wgpu::Extent3D MakeExtent(uint32_t w, uint32_t h, uint32_t d) {
|
|
||||||
return {w, h, d};
|
|
||||||
}
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
|
@ -176,8 +176,6 @@ namespace utils {
|
||||||
const wgpu::BindGroupLayout& layout,
|
const wgpu::BindGroupLayout& layout,
|
||||||
std::initializer_list<BindingInitializationHelper> entriesInitializer);
|
std::initializer_list<BindingInitializationHelper> entriesInitializer);
|
||||||
|
|
||||||
wgpu::Origin3D MakeOrigin(uint32_t x = 0, uint32_t y = 0, uint32_t z = 0);
|
|
||||||
wgpu::Extent3D MakeExtent(uint32_t w = 1, uint32_t h = 1, uint32_t d = 1);
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
#endif // UTILS_DAWNHELPERS_H_
|
#endif // UTILS_DAWNHELPERS_H_
|
||||||
|
|
Loading…
Reference in New Issue