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