Implement 3D texture copy: preparation
This is a preparation CL for 3D texture copy. It refactors texture result comparison MACROs and their implementations, in order to add texture result comparison for 3D texture. Prior to this change, texture result comparison supports 1D/2D texture only. BUG: dawn:547 Change-Id: Ia242356e05f4762e33a8278ec0d038b8580f7aa9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46320 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
parent
dca3f4fbbc
commit
4eb40c1849
|
@ -21,7 +21,6 @@
|
||||||
#include "common/Platform.h"
|
#include "common/Platform.h"
|
||||||
#include "common/SystemUtils.h"
|
#include "common/SystemUtils.h"
|
||||||
#include "dawn/dawn_proc.h"
|
#include "dawn/dawn_proc.h"
|
||||||
#include "dawn_native/DawnNative.h"
|
|
||||||
#include "dawn_wire/WireClient.h"
|
#include "dawn_wire/WireClient.h"
|
||||||
#include "dawn_wire/WireServer.h"
|
#include "dawn_wire/WireServer.h"
|
||||||
#include "utils/PlatformDebugLogger.h"
|
#include "utils/PlatformDebugLogger.h"
|
||||||
|
@ -1003,26 +1002,23 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file,
|
||||||
int line,
|
int line,
|
||||||
detail::Expectation* expectation,
|
detail::Expectation* expectation,
|
||||||
const wgpu::Texture& texture,
|
const wgpu::Texture& texture,
|
||||||
uint32_t x,
|
wgpu::Origin3D origin,
|
||||||
uint32_t y,
|
wgpu::Extent3D extent,
|
||||||
uint32_t width,
|
|
||||||
uint32_t height,
|
|
||||||
uint32_t level,
|
uint32_t level,
|
||||||
uint32_t slice,
|
uint32_t layer,
|
||||||
wgpu::TextureAspect aspect,
|
wgpu::TextureAspect aspect,
|
||||||
uint32_t dataSize,
|
uint32_t dataSize,
|
||||||
uint32_t bytesPerRow) {
|
uint32_t bytesPerRow) {
|
||||||
if (bytesPerRow == 0) {
|
if (bytesPerRow == 0) {
|
||||||
bytesPerRow = Align(width * dataSize, kTextureBytesPerRowAlignment);
|
bytesPerRow = Align(extent.width * dataSize, kTextureBytesPerRowAlignment);
|
||||||
} else {
|
} else {
|
||||||
ASSERT(bytesPerRow >= width * dataSize);
|
ASSERT(bytesPerRow >= extent.width * dataSize);
|
||||||
ASSERT(bytesPerRow == Align(bytesPerRow, kTextureBytesPerRowAlignment));
|
ASSERT(bytesPerRow == Align(bytesPerRow, kTextureBytesPerRowAlignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t rowsPerImage = height;
|
uint32_t rowsPerImage = extent.height;
|
||||||
uint32_t depth = 1;
|
uint32_t size = utils::RequiredBytesInCopy(bytesPerRow, rowsPerImage, extent.width,
|
||||||
uint32_t size =
|
extent.height, extent.depth, dataSize);
|
||||||
utils::RequiredBytesInCopy(bytesPerRow, rowsPerImage, width, height, depth, dataSize);
|
|
||||||
|
|
||||||
// TODO(enga): We should have the map async alignment in Contants.h. Also, it should change to 8
|
// TODO(enga): We should have the map async alignment in Contants.h. Also, it should change to 8
|
||||||
// for Float64Array.
|
// for Float64Array.
|
||||||
|
@ -1031,13 +1027,12 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file,
|
||||||
// We need to enqueue the copy immediately because by the time we resolve the expectation,
|
// We need to enqueue the copy immediately because by the time we resolve the expectation,
|
||||||
// the texture might have been modified.
|
// the texture might have been modified.
|
||||||
wgpu::ImageCopyTexture imageCopyTexture =
|
wgpu::ImageCopyTexture imageCopyTexture =
|
||||||
utils::CreateImageCopyTexture(texture, level, {x, y, slice}, aspect);
|
utils::CreateImageCopyTexture(texture, level, {origin.x, origin.y, layer}, aspect);
|
||||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||||
utils::CreateImageCopyBuffer(readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
|
utils::CreateImageCopyBuffer(readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
|
||||||
wgpu::Extent3D copySize = {width, height, 1};
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent);
|
||||||
|
|
||||||
wgpu::CommandBuffer commands = encoder.Finish();
|
wgpu::CommandBuffer commands = encoder.Finish();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
@ -1048,7 +1043,7 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file,
|
||||||
deferred.readbackSlot = readback.slot;
|
deferred.readbackSlot = readback.slot;
|
||||||
deferred.readbackOffset = readback.offset;
|
deferred.readbackOffset = readback.offset;
|
||||||
deferred.size = size;
|
deferred.size = size;
|
||||||
deferred.rowBytes = width * dataSize;
|
deferred.rowBytes = extent.width * dataSize;
|
||||||
deferred.bytesPerRow = bytesPerRow;
|
deferred.bytesPerRow = bytesPerRow;
|
||||||
deferred.expectation.reset(expectation);
|
deferred.expectation.reset(expectation);
|
||||||
|
|
||||||
|
|
|
@ -65,16 +65,18 @@
|
||||||
|
|
||||||
// Test a pixel of the mip level 0 of a 2D texture.
|
// Test a pixel of the mip level 0 of a 2D texture.
|
||||||
#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, x, y, width, height, level, slice) \
|
#define EXPECT_TEXTURE_RGBA8_EQ(expected, texture, origin, extent, level, layer) \
|
||||||
AddTextureExpectation(__FILE__, __LINE__, expected, texture, x, y, width, height, level, slice)
|
AddTextureExpectation(__FILE__, __LINE__, expected, texture, utils::MakeOrigin origin, \
|
||||||
|
utils::MakeExtent extent, level, layer)
|
||||||
|
|
||||||
#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, x, y, width, height, level, slice) \
|
#define EXPECT_TEXTURE_FLOAT_EQ(expected, texture, x, y, width, height, level, layer) \
|
||||||
AddTextureExpectation(__FILE__, __LINE__, expected, texture, x, y, width, height, level, slice)
|
AddTextureExpectation(__FILE__, __LINE__, expected, texture, {x, y}, {width, height}, level, \
|
||||||
|
layer)
|
||||||
|
|
||||||
#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)
|
||||||
|
@ -322,17 +324,17 @@ class DawnTestBase {
|
||||||
int line,
|
int line,
|
||||||
const T* expectedData,
|
const T* expectedData,
|
||||||
const wgpu::Texture& texture,
|
const wgpu::Texture& texture,
|
||||||
uint32_t x,
|
wgpu::Origin3D origin,
|
||||||
uint32_t y,
|
wgpu::Extent3D extent,
|
||||||
uint32_t width = 1,
|
|
||||||
uint32_t height = 1,
|
|
||||||
uint32_t level = 0,
|
uint32_t level = 0,
|
||||||
uint32_t slice = 0,
|
uint32_t layer = 0,
|
||||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
||||||
uint32_t bytesPerRow = 0) {
|
uint32_t bytesPerRow = 0) {
|
||||||
return AddTextureExpectationImpl(
|
return AddTextureExpectationImpl(
|
||||||
file, line, new detail::ExpectEq<T>(expectedData, width * height), texture, x, y, width,
|
file, line,
|
||||||
height, level, slice, aspect, sizeof(T), bytesPerRow);
|
new detail::ExpectEq<T>(expectedData,
|
||||||
|
extent.width * extent.height * extent.depthOrArrayLayers),
|
||||||
|
texture, origin, extent, level, layer, aspect, sizeof(T), bytesPerRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -340,14 +342,14 @@ class DawnTestBase {
|
||||||
int line,
|
int line,
|
||||||
const T& expectedData,
|
const T& expectedData,
|
||||||
const wgpu::Texture& texture,
|
const wgpu::Texture& texture,
|
||||||
uint32_t x,
|
wgpu::Origin3D origin,
|
||||||
uint32_t y,
|
|
||||||
uint32_t level = 0,
|
uint32_t level = 0,
|
||||||
uint32_t slice = 0,
|
uint32_t layer = 0,
|
||||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
||||||
uint32_t bytesPerRow = 0) {
|
uint32_t bytesPerRow = 0) {
|
||||||
return AddTextureExpectationImpl(file, line, new detail::ExpectEq<T>(expectedData), texture,
|
return AddTextureExpectationImpl(file, line, new detail::ExpectEq<T>(expectedData), texture,
|
||||||
x, y, 1, 1, level, slice, aspect, sizeof(T), bytesPerRow);
|
origin, {1, 1}, level, layer, aspect, sizeof(T),
|
||||||
|
bytesPerRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -360,12 +362,12 @@ class DawnTestBase {
|
||||||
uint32_t x,
|
uint32_t x,
|
||||||
uint32_t y,
|
uint32_t y,
|
||||||
uint32_t level = 0,
|
uint32_t level = 0,
|
||||||
uint32_t slice = 0,
|
uint32_t layer = 0,
|
||||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
||||||
uint32_t bytesPerRow = 0) {
|
uint32_t bytesPerRow = 0) {
|
||||||
return AddTextureExpectationImpl(
|
return AddTextureExpectationImpl(
|
||||||
file, line, new detail::ExpectBetweenColors<T>(color0, color1), texture, x, y, 1, 1,
|
file, line, new detail::ExpectBetweenColors<T>(color0, color1), texture, {x, y}, {1, 1},
|
||||||
level, slice, aspect, sizeof(T), bytesPerRow);
|
level, layer, aspect, sizeof(T), bytesPerRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitABit();
|
void WaitABit();
|
||||||
|
@ -396,12 +398,10 @@ class DawnTestBase {
|
||||||
int line,
|
int line,
|
||||||
detail::Expectation* expectation,
|
detail::Expectation* expectation,
|
||||||
const wgpu::Texture& texture,
|
const wgpu::Texture& texture,
|
||||||
uint32_t x,
|
wgpu::Origin3D origin,
|
||||||
uint32_t y,
|
wgpu::Extent3D extent,
|
||||||
uint32_t width,
|
|
||||||
uint32_t height,
|
|
||||||
uint32_t level,
|
uint32_t level,
|
||||||
uint32_t slice,
|
uint32_t layer,
|
||||||
wgpu::TextureAspect aspect,
|
wgpu::TextureAspect aspect,
|
||||||
uint32_t dataSize,
|
uint32_t dataSize,
|
||||||
uint32_t bytesPerRow);
|
uint32_t bytesPerRow);
|
||||||
|
|
|
@ -197,9 +197,9 @@ 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, expectedOrigin.x,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color,
|
||||||
expectedOrigin.y, expectedExtent.width, expectedExtent.height, 0,
|
(expectedOrigin.x, expectedOrigin.y),
|
||||||
0);
|
(expectedExtent.width, expectedExtent.height), 0, 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
|
||||||
|
|
|
@ -281,9 +281,9 @@ class CopyTests_B2T : public CopyTests {
|
||||||
copySize.width, copySize.height, bufferSpec.bytesPerRow,
|
copySize.width, copySize.height, bufferSpec.bytesPerRow,
|
||||||
expected.data(), copySize.width * bytesPerTexel);
|
expected.data(), copySize.width * bytesPerTexel);
|
||||||
|
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, textureSpec.copyOrigin.x,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture,
|
||||||
textureSpec.copyOrigin.y, copySize.width, copySize.height,
|
(textureSpec.copyOrigin.x, textureSpec.copyOrigin.y),
|
||||||
textureSpec.copyLevel, slice)
|
(copySize.width, copySize.height), textureSpec.copyLevel, slice)
|
||||||
<< "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 << ", "
|
||||||
|
|
|
@ -162,7 +162,7 @@ TEST_P(DepthBiasTests, PositiveBiasOnFloat) {
|
||||||
0.5, 0.5, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ TEST_P(DepthBiasTests, PositiveBiasOnFloatWithClamp) {
|
||||||
0.375, 0.375, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ TEST_P(DepthBiasTests, NegativeBiasOnFloat) {
|
||||||
0.0, 0.0, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ TEST_P(DepthBiasTests, NegativeBiasOnFloatWithClamp) {
|
||||||
0.125, 0.125, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ TEST_P(DepthBiasTests, PositiveInfinitySlopeBiasOnFloat) {
|
||||||
1.0, 1.0, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ TEST_P(DepthBiasTests, NegativeInfinityBiasOnFloat) {
|
||||||
0.0, 0.0, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ TEST_P(DepthBiasTests, NoBiasTiltedXOnFloat) {
|
||||||
0.125, 0.125, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ TEST_P(DepthBiasTests, PositiveSlopeBiasOnFloat) {
|
||||||
0.375, 0.375, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ TEST_P(DepthBiasTests, NegativeHalfSlopeBiasOnFloat) {
|
||||||
0.0, 0.0, //
|
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), mRenderTarget, (0, 0), (kRTSize, kRTSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(zero.data(), mRenderTarget, (0, 0), (kRTSize, kRTSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), mRenderTarget, (0, 0), (kRTSize, kRTSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(DepthBiasTests,
|
DAWN_INSTANTIATE_TEST(DepthBiasTests,
|
||||||
|
|
|
@ -300,7 +300,7 @@ class DepthStencilCopyTests : public DawnTest {
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
|
||||||
std::vector<uint32_t> colorData(width * height, 1u);
|
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}, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::ShaderModule mVertexModule;
|
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, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ TEST_P(DepthStencilCopyTests, FromStencilAspect) {
|
||||||
1u, 1u, 0u, 0u, //
|
1u, 1u, 0u, 0u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
wgpu::TextureAspect::StencilOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipStencilAspect) {
|
||||||
1u, 1u, 0u, 0u, //
|
1u, 1u, 0u, 0u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
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, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::DepthOnly);
|
wgpu::TextureAspect::DepthOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
|
||||||
3u, 3u, 1u, 1u, //
|
3u, 3u, 1u, 1u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
wgpu::TextureAspect::StencilOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableStencil) {
|
||||||
3u, 3u, 1u, 1u, //
|
3u, 3u, 1u, 1u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
wgpu::TextureAspect::StencilOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonRenderableNonZeroMipStenc
|
||||||
3u, 3u, 1u, 1u, //
|
3u, 3u, 1u, 1u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
wgpu::TextureAspect::StencilOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencilThenDepth) {
|
||||||
3u, 3u, 1u, 1u, //
|
3u, 3u, 1u, 1u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
wgpu::TextureAspect::StencilOnly);
|
||||||
|
|
||||||
// Check the depth
|
// Check the depth
|
||||||
|
@ -574,7 +574,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepthThenStencil) {
|
||||||
3u, 3u, 1u, 1u, //
|
3u, 3u, 1u, 1u, //
|
||||||
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, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
wgpu::TextureAspect::StencilOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,8 +672,8 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy back the stencil data and check it is correct.
|
// Copy back the stencil data and check it is correct.
|
||||||
EXPECT_TEXTURE_EQ(expectedStencilData.data(), depthStencilTexture, 0, 0, kWidth, kHeight, 0, 0,
|
EXPECT_TEXTURE_EQ(expectedStencilData.data(), depthStencilTexture, {0, 0}, {kWidth, kHeight}, 0,
|
||||||
wgpu::TextureAspect::StencilOnly);
|
0, wgpu::TextureAspect::StencilOnly);
|
||||||
|
|
||||||
ExpectDepthData(depthStencilTexture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight,
|
ExpectDepthData(depthStencilTexture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -339,7 +339,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
wgpu::CommandBuffer commands = commandEncoder.Finish();
|
wgpu::CommandBuffer commands = commandEncoder.Finish();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
|
||||||
EXPECT_TEXTURE_EQ(expectedValues[i], outputTexture, 0, 0);
|
EXPECT_TEXTURE_EQ(expectedValues[i], outputTexture, {0, 0});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
|
||||||
EXPECT_TEXTURE_EQ(CompareFunctionPasses(compareRef, compare, textureValue) ? 1.f : 0.f,
|
EXPECT_TEXTURE_EQ(CompareFunctionPasses(compareRef, compare, textureValue) ? 1.f : 0.f,
|
||||||
outputTexture, 0, 0);
|
outputTexture, {0, 0});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,9 +652,10 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
||||||
wgpu::CommandBuffer commands = commandEncoder.Finish();
|
wgpu::CommandBuffer commands = commandEncoder.Finish();
|
||||||
queue.Submit(1, &commands);
|
queue.Submit(1, &commands);
|
||||||
|
|
||||||
EXPECT_TEXTURE_EQ(passDescriptor.cDepthStencilAttachmentInfo.clearDepth, depthOutput, 0, 0);
|
EXPECT_TEXTURE_EQ(passDescriptor.cDepthStencilAttachmentInfo.clearDepth, depthOutput,
|
||||||
|
{0, 0});
|
||||||
EXPECT_TEXTURE_EQ(uint8_t(passDescriptor.cDepthStencilAttachmentInfo.clearStencil),
|
EXPECT_TEXTURE_EQ(uint8_t(passDescriptor.cDepthStencilAttachmentInfo.clearStencil),
|
||||||
stencilOutput, 0, 0);
|
stencilOutput, {0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
// With compute pipeline
|
// With compute pipeline
|
||||||
|
|
|
@ -630,7 +630,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, SeparateBuffers) {
|
||||||
queue.Submit(1, &commandBuffer);
|
queue.Submit(1, &commandBuffer);
|
||||||
|
|
||||||
// Verify the rendering result.
|
// Verify the rendering result.
|
||||||
int min = 1, max = kRTSize - 3;
|
uint32_t min = 1, max = kRTSize - 3;
|
||||||
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, min);
|
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, min);
|
||||||
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, min);
|
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, min);
|
||||||
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, max);
|
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, max);
|
||||||
|
@ -749,7 +749,7 @@ TEST_P(MultipleWriteThenMultipleReadTests, OneBuffer) {
|
||||||
queue.Submit(1, &commandBuffer);
|
queue.Submit(1, &commandBuffer);
|
||||||
|
|
||||||
// Verify the rendering result.
|
// Verify the rendering result.
|
||||||
int min = 1, max = kRTSize - 3;
|
uint32_t min = 1, max = kRTSize - 3;
|
||||||
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, min);
|
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, min);
|
||||||
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, min);
|
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, max, min);
|
||||||
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, max);
|
EXPECT_PIXEL_RGBA8_EQ(RGBA8::kYellow, renderPass.color, min, max);
|
||||||
|
|
|
@ -180,7 +180,7 @@ 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, 1, 1,
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, resolveTexture, (kMiddleX, kMiddleY), (1, 1),
|
||||||
mipmapLevel, arrayLayer);
|
mipmapLevel, arrayLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedRed, mResolveTexture, (1, 0), (1, 1), 0, 0);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&expectedGreen, resolveTexture2, 1, 0, 1, 1, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedGreen, resolveTexture2, (1, 0), (1, 1), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&expectedColor, mResolveTexture, (1, 0), (1, 1), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ TEST_P(NonzeroTextureCreationTests, Depth32TextureCreationDepthClears) {
|
||||||
// TODO(crbug.com/dawn/145): Test other formats via sampling.
|
// TODO(crbug.com/dawn/145): Test other formats via sampling.
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
std::vector<float> expected(kSize * kSize, 1.f);
|
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}, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that non-zero mip level clears 0xFF because toggle is enabled.
|
// Test that non-zero mip level clears 0xFF because toggle is enabled.
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0), (mipSize, mipSize), 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, kSize, kSize, 0, 2);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0), (kSize, kSize), 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, 1, 1, 0, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), 0, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 1, 1, j, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), j, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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, 1, 1, 0, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), 0, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, 1, 1, j, i);
|
EXPECT_TEXTURE_RGBA8_EQ(&filled, texture, (0, 0), (1, 1), j, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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, textureSpec.copyOrigin.x,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture,
|
||||||
textureSpec.copyOrigin.y, copySize.width, copySize.height,
|
(textureSpec.copyOrigin.x, textureSpec.copyOrigin.y),
|
||||||
textureSpec.level, slice)
|
(copySize.width, copySize.height), textureSpec.level, slice)
|
||||||
<< "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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (width, height), 0, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectZero.data(), renderTarget, (0, 0), (kRTSize, kRTSize), 0, 0);
|
||||||
|
|
||||||
queue.Submit(1, &commandsClearGreen);
|
queue.Submit(1, &commandsClearGreen);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectGreen.data(), renderTarget, 0, 0, kRTSize, kRTSize, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectGreen.data(), renderTarget, (0, 0), (kRTSize, kRTSize), 0, 0);
|
||||||
|
|
||||||
// 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,10 @@ 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectGreen.data(), renderTarget, (0, 0), (kRTSize / 2, kRTSize), 0, 0);
|
||||||
// Right half should now be blue
|
// Right half should now be blue
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectBlue.data(), renderTarget, kRTSize / 2, 0, kRTSize / 2, kRTSize,
|
EXPECT_TEXTURE_RGBA8_EQ(expectBlue.data(), renderTarget, (kRTSize / 2, 0),
|
||||||
0, 0);
|
(kRTSize / 2, kRTSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test clearing a color attachment with signed and unsigned integer formats.
|
// Test clearing a color attachment with signed and unsigned integer formats.
|
||||||
|
|
|
@ -79,8 +79,9 @@ 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, renderTargetSize,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderTarget, (0, 0),
|
||||||
renderTargetSize, baseMipLevel, baseArrayLayer);
|
(renderTargetSize, renderTargetSize), baseMipLevel,
|
||||||
|
baseArrayLayer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::Depth: {
|
case Type::Depth: {
|
||||||
|
|
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&topRight, texture, (kSize / 2 - 1, 0), (1, 1), 1, 0);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&bottomLeft, texture, 0, kSize / 2 - 1, 1, 1, 1, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&bottomLeft, texture, (0, kSize / 2 - 1), (1, 1), 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, 0, 1);
|
EXPECT_TEXTURE_RGBA8_EQ(&topRight, texture, (kSize - 1, 0), (1, 1), 0, 1);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&bottomLeft, texture, 0, kSize - 1, 1, 1, 0, 1);
|
EXPECT_TEXTURE_RGBA8_EQ(&bottomLeft, texture, (0, kSize - 1), (1, 1), 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO (yunchao.he@intel.com):
|
// TODO (yunchao.he@intel.com):
|
||||||
|
|
|
@ -532,8 +532,9 @@ 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, textureViewWidth, textureViewHeight,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0),
|
||||||
textureViewBaseLevel, textureViewBaseLayer);
|
(textureViewWidth, textureViewHeight), textureViewBaseLevel,
|
||||||
|
textureViewBaseLayer);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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, kSize, kSize, 0, layer);
|
EXPECT_TEXTURE_RGBA8_EQ(kExpectedAllZero.data(), texture, (0, 0), (kSize, kSize), 0, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, mipSize, mipSize, baseMipLevel,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0), (mipSize, mipSize),
|
||||||
baseArrayLayer);
|
baseMipLevel, baseArrayLayer);
|
||||||
|
|
||||||
// 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,7 +258,7 @@ 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, kSize, kSize, baseMipLevel,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0), (kSize, kSize), baseMipLevel,
|
||||||
baseArrayLayer);
|
baseArrayLayer);
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
|
@ -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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), texture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
|
|
||||||
// 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,10 @@ 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected100.data(), texture, (0, 0), (kSize / 2, kSize), 0, 0);
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, kSize / 2, 0, kSize / 2, kSize, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kSize / 2, 0), (kSize / 2, kSize), 0,
|
||||||
|
0);
|
||||||
|
|
||||||
// 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 +364,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, kSize, kSize, 0, layer);
|
EXPECT_TEXTURE_RGBA8_EQ(expected100.data(), texture, (0, 0), (kSize, kSize), 0, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,8 +396,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), dstTexture, 0, 0, kSize, kSize, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), dstTexture, (0, 0), (kSize, kSize), 0, 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));
|
||||||
|
@ -450,10 +451,10 @@ 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedWith100.data(), srcTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedWith100.data(), dstTexture, 0, 0, kSize / 2, kSize, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedWith100.data(), dstTexture, (0, 0), (kSize / 2, kSize), 0, 0);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), dstTexture, kSize / 2, 0, kSize / 2, kSize, 0,
|
EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), dstTexture, (kSize / 2, 0),
|
||||||
0);
|
(kSize / 2, kSize), 0, 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 +497,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0, 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));
|
||||||
|
@ -538,7 +539,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0, 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));
|
||||||
|
@ -577,7 +578,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), srcTexture, (0, 0), (kSize, kSize), 0, 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));
|
||||||
|
@ -646,7 +647,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), colorTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything is initialized now
|
// Everything is initialized now
|
||||||
|
@ -662,8 +663,8 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
||||||
// Check by copy that the stencil data is 2.
|
// Check by copy that the stencil data is 2.
|
||||||
std::vector<uint8_t> expected(kSize * kSize, 2);
|
std::vector<uint8_t> expected(kSize * kSize, 2);
|
||||||
EXPECT_LAZY_CLEAR(
|
EXPECT_LAZY_CLEAR(
|
||||||
0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, 0, 0, kSize, kSize, 0,
|
0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, {kSize, kSize},
|
||||||
0, wgpu::TextureAspect::StencilOnly));
|
0, 0, wgpu::TextureAspect::StencilOnly));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +720,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), colorTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything is initialized now
|
// Everything is initialized now
|
||||||
|
@ -735,8 +736,8 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
||||||
// Check by copy that the stencil data is 0.
|
// Check by copy that the stencil data is 0.
|
||||||
std::vector<uint8_t> expected(kSize * kSize, 0);
|
std::vector<uint8_t> expected(kSize * kSize, 0);
|
||||||
EXPECT_LAZY_CLEAR(
|
EXPECT_LAZY_CLEAR(
|
||||||
0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, 0, 0, kSize, kSize, 0,
|
0u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, {kSize, kSize},
|
||||||
0, wgpu::TextureAspect::StencilOnly));
|
0, 0, wgpu::TextureAspect::StencilOnly));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -779,8 +780,9 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
|
||||||
|
|
||||||
// Check by copy that the stencil data is lazily cleared to 0.
|
// Check by copy that the stencil data is lazily cleared to 0.
|
||||||
std::vector<uint8_t> expected(kSize * kSize, 0);
|
std::vector<uint8_t> expected(kSize * kSize, 0);
|
||||||
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, 0, 0, kSize,
|
EXPECT_LAZY_CLEAR(
|
||||||
kSize, 0, 0, wgpu::TextureAspect::StencilOnly));
|
1u, EXPECT_TEXTURE_EQ(expected.data(), depthStencilTexture, {0, 0}, {kSize, kSize}, 0, 0,
|
||||||
|
wgpu::TextureAspect::StencilOnly));
|
||||||
|
|
||||||
// Everything is initialized now
|
// Everything is initialized now
|
||||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0,
|
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0,
|
||||||
|
@ -817,7 +819,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), colorTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -837,7 +839,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0), (kSize, kSize), 0, 0);
|
||||||
|
|
||||||
// Expect texture subresource initialized to be true
|
// Expect texture subresource initialized to be true
|
||||||
EXPECT_EQ(true,
|
EXPECT_EQ(true,
|
||||||
|
@ -882,7 +884,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
|
|
||||||
// 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 +943,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, 1, 1, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(&RGBA8::kZero, texture, (0, 0), (1, 1), 0, 0);
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(&RGBA8::kZero, texture, 0, 0, 1, 1, 0, 1);
|
EXPECT_TEXTURE_RGBA8_EQ(&RGBA8::kZero, texture, (0, 0), (1, 1), 0, 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));
|
||||||
|
@ -1169,8 +1171,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(1u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0),
|
||||||
kSize, kSize, 0, 0));
|
(kSize, kSize), 0, 0));
|
||||||
|
|
||||||
// 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 +1225,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedBlack.data(), srcTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
|
|
||||||
// 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 +1250,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedRed.data(), srcTexture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
|
|
||||||
// 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 +1318,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(1u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0),
|
||||||
kSize, kSize, 0, 0));
|
(kSize, kSize), 0, 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(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), sampleTexture, (0, 0),
|
||||||
kSize, kSize, 0, 0));
|
(kSize, kSize), 0, 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_RGBA8_EQ(expectedWithTwos.data(), sampleTexture, (0, 0),
|
||||||
mipSize, mipSize, 1, 0));
|
(mipSize, mipSize), 1, 0));
|
||||||
|
|
||||||
// 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 +1401,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, 0, 0,
|
EXPECT_LAZY_CLEAR(1u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), renderTexture, (0, 0),
|
||||||
kSize, kSize, 0, 0));
|
(kSize, kSize), 0, 0));
|
||||||
|
|
||||||
// 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, 0, 0,
|
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithZeros.data(), sampleTexture, (0, 0),
|
||||||
kSize, kSize, 0, 0));
|
(kSize, kSize), 0, 0));
|
||||||
|
|
||||||
// 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,
|
EXPECT_LAZY_CLEAR(0u, EXPECT_TEXTURE_RGBA8_EQ(expectedWithTwos.data(), sampleTexture, (0, 0),
|
||||||
kSize, kSize, 0, 1));
|
(kSize, kSize), 0, 1));
|
||||||
|
|
||||||
// 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 +1487,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kSize, kSize), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 +1522,10 @@ 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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kSize / 2, kSize), 0, 0);
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, kSize / 2, 0, kSize / 2, kSize, 0, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kSize / 2, 0), (kSize / 2, kSize), 0,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 +1564,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, kSize, kSize, 0, layer);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kSize, kSize), 0, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,10 +1606,10 @@ 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, kSize / 2, kSize, 0, layer);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kSize / 2, kSize), 0, layer);
|
||||||
// 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_RGBA8_EQ(expectedZeros.data(), texture, (kSize / 2, 0), (kSize / 2, kSize),
|
||||||
layer);
|
0, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1642,7 +1645,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kMipSize, kMipSize), kMipLevel, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 +1685,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, 0);
|
EXPECT_TEXTURE_RGBA8_EQ(data.data(), texture, (0, 0), (kMipSize / 2, kMipSize), kMipLevel, 0);
|
||||||
// second half should be cleared
|
// second half should be cleared
|
||||||
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, kMipSize / 2, 0, kMipSize / 2, kMipSize,
|
EXPECT_TEXTURE_RGBA8_EQ(expectedZeros.data(), texture, (kMipSize / 2, 0),
|
||||||
kMipLevel, 0);
|
(kMipSize / 2, kMipSize), kMipLevel, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(TextureZeroInitTest,
|
DAWN_INSTANTIATE_TEST(TextureZeroInitTest,
|
||||||
|
@ -1812,8 +1815,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, nonPaddedCopyExtent.width,
|
EXPECT_TEXTURE_RGBA8_EQ(expected.data(), renderPass.color, (0, 0),
|
||||||
nonPaddedCopyExtent.height, 0, 0);
|
(nonPaddedCopyExtent.width, nonPaddedCopyExtent.height), 0, 0);
|
||||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel,
|
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel,
|
||||||
1, baseArrayLayer, 1));
|
1, baseArrayLayer, 1));
|
||||||
|
|
||||||
|
@ -1821,8 +1824,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_RGBA8_EQ(expectBlack.data(), renderPass.color, (copyExtent3D.width, 0),
|
||||||
nonPaddedCopyExtent.width, nonPaddedCopyExtent.height, 0, 0);
|
(nonPaddedCopyExtent.width, nonPaddedCopyExtent.height), 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ class ViewportTest : public DawnTest {
|
||||||
(maxDepth + minDepth) / 2,
|
(maxDepth + minDepth) / 2,
|
||||||
minDepth,
|
minDepth,
|
||||||
};
|
};
|
||||||
EXPECT_TEXTURE_EQ(expected.data(), depthTexture, 0, 0, 3, 1, 0, 0);
|
EXPECT_TEXTURE_EQ(expected.data(), depthTexture, {0, 0}, {3, 1}, 0, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -359,4 +359,11 @@ 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,6 +176,8 @@ 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