diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 6a4dfdd04e..c78161267b 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -87,8 +87,8 @@ add_executable(dawn_end2end_tests ${END2END_TESTS_DIR}/SamplerTests.cpp ${END2END_TESTS_DIR}/ViewportOrientationTests.cpp ${TESTS_DIR}/End2EndTestsMain.cpp - ${TESTS_DIR}/NXTTest.cpp - ${TESTS_DIR}/NXTTest.h + ${TESTS_DIR}/DawnTest.cpp + ${TESTS_DIR}/DawnTest.h ) target_link_libraries(dawn_end2end_tests dawn_common dawn_wire gtest utils) DawnInternalTarget("tests" dawn_end2end_tests) diff --git a/src/tests/NXTTest.cpp b/src/tests/DawnTest.cpp similarity index 73% rename from src/tests/NXTTest.cpp rename to src/tests/DawnTest.cpp index ea7bf7defa..3045593912 100644 --- a/src/tests/NXTTest.cpp +++ b/src/tests/DawnTest.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "common/Constants.h" @@ -29,7 +29,7 @@ namespace { utils::BackendType ParamToBackendType(BackendType type) { - switch(type) { + switch (type) { case D3D12Backend: return utils::BackendType::D3D12; case MetalBackend: @@ -44,7 +44,7 @@ namespace { } std::string ParamName(BackendType type) { - switch(type) { + switch (type) { case D3D12Backend: return "D3D12"; case MetalBackend: @@ -87,16 +87,16 @@ namespace { // End2end tests should test valid commands produce the expected result so no error // should happen. Failure cases should be tested in the validation tests. void DeviceErrorCauseTestFailure(const char* message, dawnCallbackUserdata) { - FAIL() << "Device level failure: " << message; + FAIL() << "Device level failure: " << message; } struct MapReadUserdata { - NXTTest* test; + DawnTest* test; size_t slot; }; -} +} // namespace -NXTTest::~NXTTest() { +DawnTest::~DawnTest() { // We need to destroy child objects before the Device mReadbackSlots.clear(); queue = dawn::Queue(); @@ -109,25 +109,25 @@ NXTTest::~NXTTest() { dawnSetProcs(nullptr); } -bool NXTTest::IsD3D12() const { +bool DawnTest::IsD3D12() const { return GetParam() == D3D12Backend; } -bool NXTTest::IsMetal() const { +bool DawnTest::IsMetal() const { return GetParam() == MetalBackend; } -bool NXTTest::IsOpenGL() const { +bool DawnTest::IsOpenGL() const { return GetParam() == OpenGLBackend; } -bool NXTTest::IsVulkan() const { +bool DawnTest::IsVulkan() const { return GetParam() == VulkanBackend; } bool gTestUsesWire = false; -void NXTTest::SetUp() { +void DawnTest::SetUp() { mBinding = utils::CreateBinding(ParamToBackendType(GetParam())); DAWN_ASSERT(mBinding != nullptr); @@ -163,7 +163,7 @@ void NXTTest::SetUp() { cDevice = backendDevice; } - // Set up the device and queue because all tests need them, and NXTTest needs them too for the + // Set up the device and queue because all tests need them, and DawnTest needs them too for the // deferred expectations. dawnSetProcs(&procs); device = dawn::Device::Acquire(cDevice); @@ -172,16 +172,17 @@ void NXTTest::SetUp() { // The swapchain isn't used by tests but is useful when debugging with graphics debuggers that // capture at frame boundaries. swapchain = device.CreateSwapChainBuilder() - .SetImplementation(mBinding->GetSwapChainImplementation()) - .GetResult(); - swapchain.Configure(static_cast(mBinding->GetPreferredSwapChainTextureFormat()), - dawn::TextureUsageBit::OutputAttachment, 400, 400); + .SetImplementation(mBinding->GetSwapChainImplementation()) + .GetResult(); + swapchain.Configure( + static_cast(mBinding->GetPreferredSwapChainTextureFormat()), + dawn::TextureUsageBit::OutputAttachment, 400, 400); // The end2end tests should never cause validation errors. These should be tested in unittests. device.SetErrorCallback(DeviceErrorCauseTestFailure, 0); } -void NXTTest::TearDown() { +void DawnTest::TearDown() { FlushWire(); MapSlotsSynchronously(); @@ -204,16 +205,22 @@ void NXTTest::TearDown() { } } -std::ostringstream& NXTTest::AddBufferExpectation(const char* file, int line, const dawn::Buffer& buffer, uint32_t offset, uint32_t size, detail::Expectation* expectation) { +std::ostringstream& DawnTest::AddBufferExpectation(const char* file, + int line, + const dawn::Buffer& buffer, + uint32_t offset, + uint32_t size, + detail::Expectation* expectation) { dawn::Buffer source = buffer.Clone(); auto readback = ReserveReadback(size); // We need to enqueue the copy immediately because by the time we resolve the expectation, // the buffer might have been modified. - dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() - .CopyBufferToBuffer(source, offset, readback.buffer, readback.offset, size) - .GetResult(); + dawn::CommandBuffer commands = + device.CreateCommandBufferBuilder() + .CopyBufferToBuffer(source, offset, readback.buffer, readback.offset, size) + .GetResult(); queue.Submit(1, &commands); @@ -232,7 +239,16 @@ std::ostringstream& NXTTest::AddBufferExpectation(const char* file, int line, co return *(mDeferredExpectations.back().message.get()); } -std::ostringstream& NXTTest::AddTextureExpectation(const char* file, int line, const dawn::Texture& texture, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t level, uint32_t pixelSize, detail::Expectation* expectation) { +std::ostringstream& DawnTest::AddTextureExpectation(const char* file, + int line, + const dawn::Texture& texture, + uint32_t x, + uint32_t y, + uint32_t width, + uint32_t height, + uint32_t level, + uint32_t pixelSize, + detail::Expectation* expectation) { dawn::Texture source = texture.Clone(); uint32_t rowPitch = Align(width * pixelSize, kTextureRowPitchAlignment); uint32_t size = rowPitch * (height - 1) + width * pixelSize; @@ -241,9 +257,11 @@ std::ostringstream& NXTTest::AddTextureExpectation(const char* file, int line, c // We need to enqueue the copy immediately because by the time we resolve the expectation, // the texture might have been modified. - dawn::CommandBuffer commands = device.CreateCommandBufferBuilder() - .CopyTextureToBuffer(source, x, y, 0, width, height, 1, level, readback.buffer, readback.offset, rowPitch) - .GetResult(); + dawn::CommandBuffer commands = + device.CreateCommandBufferBuilder() + .CopyTextureToBuffer(source, x, y, 0, width, height, 1, level, readback.buffer, + readback.offset, rowPitch) + .GetResult(); queue.Submit(1, &commands); @@ -262,35 +280,36 @@ std::ostringstream& NXTTest::AddTextureExpectation(const char* file, int line, c return *(mDeferredExpectations.back().message.get()); } -void NXTTest::WaitABit() { +void DawnTest::WaitABit() { device.Tick(); FlushWire(); utils::USleep(100); } -void NXTTest::SwapBuffersForCapture() { +void DawnTest::SwapBuffersForCapture() { // Insert a frame boundary for API capture tools. dawn::Texture backBuffer = swapchain.GetNextTexture(); swapchain.Present(backBuffer); } -void NXTTest::FlushWire() { +void DawnTest::FlushWire() { if (gTestUsesWire) { ASSERT(mC2sBuf->Flush()); ASSERT(mS2cBuf->Flush()); } } -NXTTest::ReadbackReservation NXTTest::ReserveReadback(uint32_t readbackSize) { +DawnTest::ReadbackReservation DawnTest::ReserveReadback(uint32_t readbackSize) { // For now create a new MapRead buffer for each readback // TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly? ReadbackSlot slot; slot.bufferSize = readbackSize; - slot.buffer = device.CreateBufferBuilder() - .SetSize(readbackSize) - .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) - .GetResult(); + slot.buffer = + device.CreateBufferBuilder() + .SetSize(readbackSize) + .SetAllowedUsage(dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst) + .GetResult(); ReadbackReservation reservation; reservation.buffer = slot.buffer.Clone(); @@ -301,8 +320,9 @@ NXTTest::ReadbackReservation NXTTest::ReserveReadback(uint32_t readbackSize) { return reservation; } -void NXTTest::MapSlotsSynchronously() { - // Initialize numPendingMapOperations before mapping, just in case the callback is called immediately. +void DawnTest::MapSlotsSynchronously() { + // Initialize numPendingMapOperations before mapping, just in case the callback is called + // immediately. mNumPendingMapOperations = mReadbackSlots.size(); // Map all readback slots @@ -310,7 +330,9 @@ void NXTTest::MapSlotsSynchronously() { auto userdata = new MapReadUserdata{this, i}; auto& slot = mReadbackSlots[i]; - slot.buffer.MapReadAsync(0, slot.bufferSize, SlotMapReadCallback, static_cast(reinterpret_cast(userdata))); + slot.buffer.MapReadAsync( + 0, slot.bufferSize, SlotMapReadCallback, + static_cast(reinterpret_cast(userdata))); } // Busy wait until all map operations are done. @@ -320,31 +342,33 @@ void NXTTest::MapSlotsSynchronously() { } // static -void NXTTest::SlotMapReadCallback(dawnBufferMapAsyncStatus status, - const void* data, - dawnCallbackUserdata userdata_) { +void DawnTest::SlotMapReadCallback(dawnBufferMapAsyncStatus status, + const void* data, + dawnCallbackUserdata userdata_) { DAWN_ASSERT(status == DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS); auto userdata = reinterpret_cast(static_cast(userdata_)); userdata->test->mReadbackSlots[userdata->slot].mappedData = data; - userdata->test->mNumPendingMapOperations --; + userdata->test->mNumPendingMapOperations--; delete userdata; } -void NXTTest::ResolveExpectations() { +void DawnTest::ResolveExpectations() { for (const auto& expectation : mDeferredExpectations) { DAWN_ASSERT(mReadbackSlots[expectation.readbackSlot].mappedData != nullptr); // Get a pointer to the mapped copy of the data for the expectation. - const char* data = reinterpret_cast(mReadbackSlots[expectation.readbackSlot].mappedData); + const char* data = + reinterpret_cast(mReadbackSlots[expectation.readbackSlot].mappedData); data += expectation.readbackOffset; uint32_t size; std::vector packedData; if (expectation.rowBytes != expectation.rowPitch) { DAWN_ASSERT(expectation.rowPitch > expectation.rowBytes); - uint32_t rowCount = (expectation.size + expectation.rowPitch - 1) / expectation.rowPitch; + uint32_t rowCount = + (expectation.size + expectation.rowPitch - 1) / expectation.rowPitch; uint32_t packedSize = rowCount * expectation.rowBytes; packedData.resize(packedSize); for (uint32_t r = 0; r < rowCount; ++r) { @@ -361,7 +385,8 @@ void NXTTest::ResolveExpectations() { // Get the result for the expectation and add context to failures testing::AssertionResult result = expectation.expectation->Check(data, size); if (!result) { - result << " Expectation created at " << expectation.file << ":" << expectation.line << std::endl; + result << " Expectation created at " << expectation.file << ":" << expectation.line + << std::endl; result << expectation.message->str(); } @@ -377,33 +402,30 @@ bool RGBA8::operator!=(const RGBA8& other) const { return !(*this == other); } -std::ostream& operator<< (std::ostream& stream, const RGBA8& color) { - return stream << "RGBA8(" << - static_cast(color.r) << ", " << - static_cast(color.g) << ", " << - static_cast(color.b) << ", " << - static_cast(color.a) << ")"; +std::ostream& operator<<(std::ostream& stream, const RGBA8& color) { + return stream << "RGBA8(" << static_cast(color.r) << ", " << static_cast(color.g) + << ", " << static_cast(color.b) << ", " << static_cast(color.a) << ")"; } -std::ostream &operator<<(std::ostream& stream, BackendType backend) { +std::ostream& operator<<(std::ostream& stream, BackendType backend) { return stream << ParamName(backend); } namespace detail { bool IsBackendAvailable(BackendType type) { switch (type) { - #if defined(DAWN_ENABLE_BACKEND_D3D12) - case D3D12Backend: - #endif - #if defined(DAWN_ENABLE_BACKEND_METAL) - case MetalBackend: - #endif - #if defined(DAWN_ENABLE_BACKEND_OPENGL) - case OpenGLBackend: - #endif - #if defined(DAWN_ENABLE_BACKEND_VULKAN) - case VulkanBackend: - #endif +#if defined(DAWN_ENABLE_BACKEND_D3D12) + case D3D12Backend: +#endif +#if defined(DAWN_ENABLE_BACKEND_METAL) + case MetalBackend: +#endif +#if defined(DAWN_ENABLE_BACKEND_OPENGL) + case OpenGLBackend: +#endif +#if defined(DAWN_ENABLE_BACKEND_VULKAN) + case VulkanBackend: +#endif return true; default: @@ -424,17 +446,17 @@ namespace detail { // Helper classes to set expectations - template + template ExpectEq::ExpectEq(T singleValue) { mExpected.push_back(singleValue); } - template + template ExpectEq::ExpectEq(const T* values, const unsigned int count) { mExpected.assign(values, values + count); } - template + template testing::AssertionResult ExpectEq::Check(const void* data, size_t size) { DAWN_ASSERT(size == sizeof(T) * mExpected.size()); @@ -443,7 +465,10 @@ namespace detail { testing::AssertionResult failure = testing::AssertionFailure(); for (size_t i = 0; i < mExpected.size(); ++i) { if (actual[i] != mExpected[i]) { - testing::AssertionResult result = testing::AssertionFailure() << "Expected data[" << i << "] to be " << mExpected[i] << ", actual " << actual[i] << std::endl; + testing::AssertionResult result = testing::AssertionFailure() + << "Expected data[" << i << "] to be " + << mExpected[i] << ", actual " << actual[i] + << std::endl; auto printBuffer = [&](const T* buffer) { static constexpr unsigned int kBytes = sizeof(T); @@ -477,4 +502,4 @@ namespace detail { template class ExpectEq; template class ExpectEq; template class ExpectEq; -} +} // namespace detail diff --git a/src/tests/NXTTest.h b/src/tests/DawnTest.h similarity index 74% rename from src/tests/NXTTest.h rename to src/tests/DawnTest.h index 45c7f86858..440d9e68c2 100644 --- a/src/tests/NXTTest.h +++ b/src/tests/DawnTest.h @@ -19,34 +19,40 @@ // Getting data back from NXT is done in an async manners so all expectations are "deferred" // until the end of the test. Also expectations use a copy to a MapRead buffer to get the data -// so resources should have the TransferSrc allowed usage bit if you want to add expectations on them. -#define EXPECT_BUFFER_U32_EQ(expected, buffer, offset) \ - AddBufferExpectation(__FILE__, __LINE__, buffer, offset, sizeof(uint32_t), new detail::ExpectEq(expected)) +// so resources should have the TransferSrc allowed usage bit if you want to add expectations on +// them. +#define EXPECT_BUFFER_U32_EQ(expected, buffer, offset) \ + AddBufferExpectation(__FILE__, __LINE__, buffer, offset, sizeof(uint32_t), \ + new detail::ExpectEq(expected)) -#define EXPECT_BUFFER_U32_RANGE_EQ(expected, buffer, offset, count) \ - AddBufferExpectation(__FILE__, __LINE__, buffer, offset, sizeof(uint32_t) * count, new detail::ExpectEq(expected, count)) +#define EXPECT_BUFFER_U32_RANGE_EQ(expected, buffer, offset, count) \ + AddBufferExpectation(__FILE__, __LINE__, buffer, offset, sizeof(uint32_t) * count, \ + new detail::ExpectEq(expected, count)) #define EXPECT_BUFFER_U8_EQ(expected, buffer, offset) \ AddBufferExpectation(__FILE__, __LINE__, buffer, offset, sizeof(uint8_t), \ new detail::ExpectEq(expected)) // Test a pixel of the mip level 0 of a 2D texture. -#define EXPECT_PIXEL_RGBA8_EQ(expected, texture, x, y) \ - AddTextureExpectation(__FILE__, __LINE__, texture, x, y, 1, 1, 0, sizeof(RGBA8), new detail::ExpectEq(expected)) +#define EXPECT_PIXEL_RGBA8_EQ(expected, texture, x, y) \ + AddTextureExpectation(__FILE__, __LINE__, texture, x, y, 1, 1, 0, sizeof(RGBA8), \ + new detail::ExpectEq(expected)) -#define EXPECT_TEXTURE_RGBA8_EQ(expected, texture, x, y, width, height, level) \ - AddTextureExpectation(__FILE__, __LINE__, texture, x, y, width, height, level, sizeof(RGBA8), new detail::ExpectEq(expected, (width) * (height))) +#define EXPECT_TEXTURE_RGBA8_EQ(expected, texture, x, y, width, height, level) \ + AddTextureExpectation(__FILE__, __LINE__, texture, x, y, width, height, level, sizeof(RGBA8), \ + new detail::ExpectEq(expected, (width) * (height))) struct RGBA8 { - constexpr RGBA8() : RGBA8(0,0,0,0) {} - constexpr RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a): r(r), g(g), b(b), a(a) { + constexpr RGBA8() : RGBA8(0, 0, 0, 0) { + } + constexpr RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a) : r(r), g(g), b(b), a(a) { } bool operator==(const RGBA8& other) const; bool operator!=(const RGBA8& other) const; uint8_t r, g, b, a; }; -std::ostream& operator<< (std::ostream& stream, const RGBA8& color); +std::ostream& operator<<(std::ostream& stream, const RGBA8& color); // Backend types used in the DAWN_INSTANTIATE_TEST enum BackendType { @@ -56,7 +62,7 @@ enum BackendType { VulkanBackend, NumBackendTypes, }; -std::ostream &operator<<(std::ostream& stream, BackendType backend); +std::ostream& operator<<(std::ostream& stream, BackendType backend); namespace utils { class BackendBinding; @@ -71,9 +77,9 @@ namespace dawn { namespace wire { class TerribleCommandBuffer; }} // namespace dawn::wire -class NXTTest : public ::testing::TestWithParam { +class DawnTest : public ::testing::TestWithParam { public: - ~NXTTest(); + ~DawnTest(); void SetUp() override; void TearDown() override; @@ -164,11 +170,12 @@ class NXTTest : public ::testing::TestWithParam { // Instantiate the test once for each backend provided after the first argument. Use it like this: // DAWN_INSTANTIATE_TEST(MyTestFixture, MetalBackend, OpenGLBackend) -#define DAWN_INSTANTIATE_TEST(testName, firstParam, ...) \ - const decltype(firstParam) testName##params[] = { firstParam, ##__VA_ARGS__ }; \ - INSTANTIATE_TEST_CASE_P(, testName, \ - testing::ValuesIn(::detail::FilterBackends(testName##params, sizeof(testName##params) / sizeof(firstParam))), \ - testing::PrintToStringParamName()); +#define DAWN_INSTANTIATE_TEST(testName, firstParam, ...) \ + const decltype(firstParam) testName##params[] = {firstParam, ##__VA_ARGS__}; \ + INSTANTIATE_TEST_CASE_P(, testName, \ + testing::ValuesIn(::detail::FilterBackends( \ + testName##params, sizeof(testName##params) / sizeof(firstParam))), \ + testing::PrintToStringParamName()); namespace detail { // Helper functions used for DAWN_INSTANTIATE_TEST @@ -177,27 +184,26 @@ namespace detail { // All classes used to implement the deferred expectations should inherit from this. class Expectation { - public: - virtual ~Expectation() = default; + public: + virtual ~Expectation() = default; - // Will be called with the buffer or texture data the expectation should check. - virtual testing::AssertionResult Check(const void* data, size_t size) = 0; + // Will be called with the buffer or texture data the expectation should check. + virtual testing::AssertionResult Check(const void* data, size_t size) = 0; }; // Expectation that checks the data is equal to some expected values. - template + template class ExpectEq : public Expectation { - public: - ExpectEq(T singleValue); - ExpectEq(const T* values, const unsigned int count); + public: + ExpectEq(T singleValue); + ExpectEq(const T* values, const unsigned int count); - testing::AssertionResult Check(const void* data, size_t size) override; + testing::AssertionResult Check(const void* data, size_t size) override; - private: - std::vector mExpected; + private: + std::vector mExpected; }; extern template class ExpectEq; extern template class ExpectEq; extern template class ExpectEq; -} - +} // namespace detail diff --git a/src/tests/end2end/BasicTests.cpp b/src/tests/end2end/BasicTests.cpp index 8637ee635a..45998f5824 100644 --- a/src/tests/end2end/BasicTests.cpp +++ b/src/tests/end2end/BasicTests.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "utils/DawnHelpers.h" -class BasicTests : public NXTTest { +class BasicTests : public DawnTest { }; // Test Buffer::SetSubData changes the content of the buffer, but really this is the most diff --git a/src/tests/end2end/BlendStateTests.cpp b/src/tests/end2end/BlendStateTests.cpp index 5d6cf57026..c1cdfd9171 100644 --- a/src/tests/end2end/BlendStateTests.cpp +++ b/src/tests/end2end/BlendStateTests.cpp @@ -15,7 +15,7 @@ #include #include -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "common/Constants.h" @@ -23,10 +23,10 @@ constexpr static unsigned int kRTSize = 64; -class BlendStateTest : public NXTTest { +class BlendStateTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( #version 450 diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp index cd8767d4e8..4b3bcd6afa 100644 --- a/src/tests/end2end/BufferTests.cpp +++ b/src/tests/end2end/BufferTests.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include -class BufferMapReadTests : public NXTTest { +class BufferMapReadTests : public DawnTest { protected: static void MapReadCallback(dawnBufferMapAsyncStatus status, const void* data, dawnCallbackUserdata userdata) { @@ -112,7 +112,7 @@ TEST_P(BufferMapReadTests, LargeRead) { DAWN_INSTANTIATE_TEST(BufferMapReadTests, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend) -class BufferMapWriteTests : public NXTTest { +class BufferMapWriteTests : public DawnTest { protected: static void MapWriteCallback(dawnBufferMapAsyncStatus status, void* data, dawnCallbackUserdata userdata) { @@ -189,7 +189,7 @@ TEST_P(BufferMapWriteTests, LargeWrite) { DAWN_INSTANTIATE_TEST(BufferMapWriteTests, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend) -class BufferSetSubDataTests : public NXTTest { +class BufferSetSubDataTests : public DawnTest { }; // Test the simplest set sub data: setting one u8 at offset 0. diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp index da64c98afc..ded655fe9f 100644 --- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "utils/DawnHelpers.h" #include -class ComputeCopyStorageBufferTests : public NXTTest { +class ComputeCopyStorageBufferTests : public DawnTest { public: static constexpr int kInstances = 4; static constexpr int kUintsPerInstance = 4; diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp index 19c883387c..164f35a4a6 100644 --- a/src/tests/end2end/CopyTests.cpp +++ b/src/tests/end2end/CopyTests.cpp @@ -12,14 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include #include "common/Constants.h" #include "common/Math.h" #include "utils/DawnHelpers.h" -class CopyTests : public NXTTest { +class CopyTests : public DawnTest { protected: static constexpr unsigned int kBytesPerTexel = 4; diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index 05a7b1039e..a998724afa 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "utils/DawnHelpers.h" constexpr static unsigned int kRTSize = 64; -class DepthStencilStateTest : public NXTTest { +class DepthStencilStateTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); renderTarget = device.CreateTextureBuilder() .SetDimension(dawn::TextureDimension::e2D) diff --git a/src/tests/end2end/DrawElementsTests.cpp b/src/tests/end2end/DrawElementsTests.cpp index 906c87820c..2ec3d4a0b7 100644 --- a/src/tests/end2end/DrawElementsTests.cpp +++ b/src/tests/end2end/DrawElementsTests.cpp @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "utils/DawnHelpers.h" constexpr uint32_t kRTSize = 4; -class DrawElementsTest : public NXTTest { +class DrawElementsTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp index 2a634f4c62..6cd229f30c 100644 --- a/src/tests/end2end/IndexFormatTests.cpp +++ b/src/tests/end2end/IndexFormatTests.cpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "utils/DawnHelpers.h" constexpr uint32_t kRTSize = 400; -class IndexFormatTest : public NXTTest { +class IndexFormatTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); } diff --git a/src/tests/end2end/InputStateTests.cpp b/src/tests/end2end/InputStateTests.cpp index 8a4d18c13e..5771ce62a9 100644 --- a/src/tests/end2end/InputStateTests.cpp +++ b/src/tests/end2end/InputStateTests.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "utils/DawnHelpers.h" @@ -32,10 +32,10 @@ constexpr static unsigned int kRTSize = 400; constexpr static unsigned int kRTCellOffset = 50; constexpr static unsigned int kRTCellSize = 100; -class InputStateTest : public NXTTest { +class InputStateTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); } diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp index fdc8e7caa4..bc5624906d 100644 --- a/src/tests/end2end/PrimitiveTopologyTests.cpp +++ b/src/tests/end2end/PrimitiveTopologyTests.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "utils/DawnHelpers.h" @@ -142,10 +142,10 @@ constexpr static float kVertices[] = { }; // clang-format on -class PrimitiveTopologyTest : public NXTTest { +class PrimitiveTopologyTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); diff --git a/src/tests/end2end/PushConstantTests.cpp b/src/tests/end2end/PushConstantTests.cpp index a25cc07003..eefec2bc46 100644 --- a/src/tests/end2end/PushConstantTests.cpp +++ b/src/tests/end2end/PushConstantTests.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "common/Constants.h" @@ -20,7 +20,7 @@ #include -class PushConstantTest: public NXTTest { +class PushConstantTest: public DawnTest { protected: // Layout, bind group and friends to store results for compute tests, can have an extra buffer // so that two different pipeline layout can be created. diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index a9ed149d2d..64404c6735 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "utils/DawnHelpers.h" @@ -50,10 +50,10 @@ class DrawQuad { dawn::PipelineLayout pipelineLayout = {}; }; -class RenderPassLoadOpTests : public NXTTest { +class RenderPassLoadOpTests : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); renderTarget = device.CreateTextureBuilder() .SetDimension(dawn::TextureDimension::e2D) diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 85c7b199eb..2024c7852c 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -15,7 +15,7 @@ #include #include -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "common/Assert.h" #include "common/Constants.h" @@ -36,10 +36,10 @@ namespace { }; } -class SamplerTest : public NXTTest { +class SamplerTest : public DawnTest { protected: void SetUp() override { - NXTTest::SetUp(); + DawnTest::SetUp(); mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); mBindGroupLayout = utils::MakeBindGroupLayout( diff --git a/src/tests/end2end/ScissorTests.cpp b/src/tests/end2end/ScissorTests.cpp index 188e045125..ba851275ee 100644 --- a/src/tests/end2end/ScissorTests.cpp +++ b/src/tests/end2end/ScissorTests.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "utils/DawnHelpers.h" -class ScissorTest: public NXTTest { +class ScissorTest: public DawnTest { protected: dawn::RenderPipeline CreateQuadPipeline(dawn::TextureFormat format) { dawn::ShaderModule vsModule = utils::CreateShaderModule(device, dawn::ShaderStage::Vertex, R"( diff --git a/src/tests/end2end/ViewportOrientationTests.cpp b/src/tests/end2end/ViewportOrientationTests.cpp index c73b92916d..084c1de11f 100644 --- a/src/tests/end2end/ViewportOrientationTests.cpp +++ b/src/tests/end2end/ViewportOrientationTests.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "tests/NXTTest.h" +#include "tests/DawnTest.h" #include "utils/DawnHelpers.h" -class ViewportOrientationTests : public NXTTest {}; +class ViewportOrientationTests : public DawnTest {}; // Test that the pixel in viewport coordinate (-1, -1) matches texel (0, 0) TEST_P(ViewportOrientationTests, OriginAt0x0) {