aboutsummaryrefslogtreecommitdiff
path: root/tests/vklayertests_others.cpp
diff options
context:
space:
mode:
authorPetr Kraus <petr_kraus@email.cz>2019-06-12 20:13:33 +0200
committerMark Lobodzinski <mark@lunarg.com>2019-06-13 15:13:01 -0600
commit84bc35d7ac3d99913bf0affd90cbb5460115be57 (patch)
tree484434b109a89c6e59b0247c9ef0396d141b4000 /tests/vklayertests_others.cpp
parenta45d47bfcb235a723b2ec06a61f82740d8f1aee5 (diff)
downloadvulkan-validation-layers-84bc35d7ac3d99913bf0affd90cbb5460115be57.tar.gz
tests: Test creation with VkAllocationCallbacks
Diffstat (limited to 'tests/vklayertests_others.cpp')
-rw-r--r--tests/vklayertests_others.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/vklayertests_others.cpp b/tests/vklayertests_others.cpp
index 3666209cb..4c2ddfc5c 100644
--- a/tests/vklayertests_others.cpp
+++ b/tests/vklayertests_others.cpp
@@ -723,6 +723,62 @@ TEST_F(VkLayerTest, UseObjectWithWrongDevice) {
vkDestroyDevice(second_device, NULL);
}
+TEST_F(VkLayerTest, InvalidAllocationCallbacks) {
+ TEST_DESCRIPTION("Test with invalid VkAllocationCallbacks");
+
+ ASSERT_NO_FATAL_FAILURE(Init());
+
+ // vkCreateInstance, and vkCreateDevice tend to crash in the Loader Trampoline ATM, so choosing vkCreateCommandPool
+ const VkCommandPoolCreateInfo cpci = {VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, 0,
+ DeviceObj()->QueueFamilyMatching(0, 0, true)};
+ VkCommandPool cmdPool;
+
+ struct Alloc {
+ static VKAPI_ATTR void *VKAPI_CALL alloc(void *, size_t, size_t, VkSystemAllocationScope) { return nullptr; };
+ static VKAPI_ATTR void *VKAPI_CALL realloc(void *, void *, size_t, size_t, VkSystemAllocationScope) { return nullptr; };
+ static VKAPI_ATTR void VKAPI_CALL free(void *, void *){};
+ static VKAPI_ATTR void VKAPI_CALL internalAlloc(void *, size_t, VkInternalAllocationType, VkSystemAllocationScope){};
+ static VKAPI_ATTR void VKAPI_CALL internalFree(void *, size_t, VkInternalAllocationType, VkSystemAllocationScope){};
+ };
+
+ {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkAllocationCallbacks-pfnAllocation-00632");
+ const VkAllocationCallbacks allocator = {nullptr, nullptr, Alloc::realloc, Alloc::free, nullptr, nullptr};
+ vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool);
+ m_errorMonitor->VerifyFound();
+ }
+
+ {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkAllocationCallbacks-pfnReallocation-00633");
+ const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, nullptr, Alloc::free, nullptr, nullptr};
+ vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool);
+ m_errorMonitor->VerifyFound();
+ }
+
+ {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT, "VUID-VkAllocationCallbacks-pfnFree-00634");
+ const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, Alloc::realloc, nullptr, nullptr, nullptr};
+ vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool);
+ m_errorMonitor->VerifyFound();
+ }
+
+ {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VUID-VkAllocationCallbacks-pfnInternalAllocation-00635");
+ const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, Alloc::realloc, Alloc::free, nullptr, Alloc::internalFree};
+ vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool);
+ m_errorMonitor->VerifyFound();
+ }
+
+ {
+ m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ "VUID-VkAllocationCallbacks-pfnInternalAllocation-00635");
+ const VkAllocationCallbacks allocator = {nullptr, Alloc::alloc, Alloc::realloc, Alloc::free, Alloc::internalAlloc, nullptr};
+ vkCreateCommandPool(device(), &cpci, &allocator, &cmdPool);
+ m_errorMonitor->VerifyFound();
+ }
+}
+
TEST_F(VkLayerTest, MismatchedQueueFamiliesOnSubmit) {
TEST_DESCRIPTION(
"Submit command buffer created using one queue family and attempt to submit them on a queue created in a different queue "