Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tests/VKTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace gpgmm::vk {
mPhysicalDevice = physicalDevices[0];
}

ASSERT_NE(mPhysicalDevice, VK_NULL_HANDLE);
ASSERT_FALSE(mPhysicalDevice == VK_NULL_HANDLE);

// Setup a single (universal) queue.
uint32_t queueFamilyIndex = 0;
Expand Down
33 changes: 17 additions & 16 deletions src/tests/end2end/D3D12ResourceAllocatorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ static constexpr uint64_t kDefaultBufferSize = 4ll * 1024ll * 1024ll; // 4MB

#define GPGMM_GET_VAR_NAME(x) (#x)

#define EXPECT_SIZE_CACHE_HIT(allocator, statement) \
do { \
ASSERT_NE(allocator, nullptr); \
size_t countBefore = allocator->GetInfo().SizeCacheHits; \
EXPECT_SUCCEEDED(statement); \
size_t countAfter = allocator->GetInfo().SizeCacheHits; \
EXPECT_GT(countAfter, countBefore); \
} while (0)

#define EXPECT_SIZE_CACHE_MISS(allocator, statement) \
#define EXPECT_SIZE_CACHE_HIT(allocator, statement) \
do { \
ASSERT_NE(allocator, nullptr); \
size_t countBefore = allocator->GetInfo().SizeCacheMisses; \
uint64_t countBefore = allocator->GetInfo().SizeCacheHits; \
EXPECT_SUCCEEDED(statement); \
size_t countAfter = allocator->GetInfo().SizeCacheMisses; \
uint64_t countAfter = allocator->GetInfo().SizeCacheHits; \
EXPECT_GT(countAfter, countBefore); \
} while (0)

#define EXPECT_SIZE_CACHE_MISS(allocator, statement) \
do { \
ASSERT_NE(allocator, nullptr); \
uint64_t countBefore = allocator->GetInfo().SizeCacheMisses; \
EXPECT_SUCCEEDED(statement); \
uint64_t countAfter = allocator->GetInfo().SizeCacheMisses; \
EXPECT_GT(countAfter, countBefore); \
} while (0)

class D3D12ResourceAllocatorTests : public D3D12TestBase, public ::testing::Test {
protected:
void SetUp() override {
Expand Down Expand Up @@ -674,19 +674,19 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferWithinMany) {
ASSERT_FAILED(smallBufferC->Map(/*subresource*/ 1));

// Fill small buffer C with value 0xCC.
std::vector<uint8_t> dataCC(smallBufferC->GetSize(), 0xCC);
std::vector<uint8_t> dataCC(static_cast<const size_t>(smallBufferC->GetSize()), 0xCC);
void* mappedBufferC = nullptr;
ASSERT_SUCCEEDED(smallBufferC->Map(0, nullptr, &mappedBufferC));
memcpy(mappedBufferC, dataCC.data(), dataCC.size());

// Fill small buffer A with value 0xAA.
std::vector<uint8_t> dataAA(smallBufferA->GetSize(), 0xAA);
std::vector<uint8_t> dataAA(static_cast<const size_t>(smallBufferA->GetSize()), 0xAA);
void* mappedBufferA = nullptr;
ASSERT_SUCCEEDED(smallBufferA->Map(0, nullptr, &mappedBufferA));
memcpy(mappedBufferA, dataAA.data(), dataAA.size());

// Fill small buffer B with value 0xBB.
std::vector<uint8_t> dataBB(smallBufferB->GetSize(), 0xBB);
std::vector<uint8_t> dataBB(static_cast<const size_t>(smallBufferB->GetSize()), 0xBB);
void* mappedBufferB = nullptr;
ASSERT_SUCCEEDED(smallBufferB->Map(0, nullptr, &mappedBufferB));
memcpy(mappedBufferB, dataBB.data(), dataBB.size());
Expand Down Expand Up @@ -1246,7 +1246,8 @@ TEST_F(D3D12ResourceAllocatorTests, CreateBufferCacheSize) {
EXPECT_SIZE_CACHE_MISS(resourceAllocator,
resourceAllocator->CreateResource(
smallResourceAllocDesc,
CreateBasicBufferDesc(D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT),
CreateBasicBufferDesc(static_cast<uint64_t>(
D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT)),
D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, &allocation));
ASSERT_NE(allocation, nullptr);
EXPECT_EQ(allocation->GetSize(),
Expand Down