@@ -36,10 +36,12 @@ struct MockDescriptorPool {};
36
36
37
37
struct MockSurfaceKHR {};
38
38
39
- struct MockSwapchainKHR {};
40
-
41
39
struct MockImage {};
42
40
41
+ struct MockSwapchainKHR {
42
+ std::array<MockImage, 3 > images;
43
+ };
44
+
43
45
struct MockSemaphore {};
44
46
45
47
static ISize currentImageSize = ISize{1 , 1 };
@@ -539,6 +541,14 @@ VkResult vkCreateQueryPool(VkDevice device,
539
541
return VK_SUCCESS;
540
542
}
541
543
544
+ void vkDestroyQueryPool (VkDevice device,
545
+ VkQueryPool queryPool,
546
+ const VkAllocationCallbacks* pAllocator) {
547
+ MockDevice* mock_device = reinterpret_cast <MockDevice*>(device);
548
+ mock_device->AddCalledFunction (" vkDestroyQueryPool" );
549
+ delete reinterpret_cast <MockQueryPool*>(queryPool);
550
+ }
551
+
542
552
VkResult vkGetQueryPoolResults (VkDevice device,
543
553
VkQueryPool queryPool,
544
554
uint32_t firstQuery,
@@ -574,6 +584,14 @@ VkResult vkCreateDescriptorPool(VkDevice device,
574
584
return VK_SUCCESS;
575
585
}
576
586
587
+ void vkDestroyDescriptorPool (VkDevice device,
588
+ VkDescriptorPool descriptorPool,
589
+ const VkAllocationCallbacks* pAllocator) {
590
+ MockDevice* mock_device = reinterpret_cast <MockDevice*>(device);
591
+ mock_device->AddCalledFunction (" vkDestroyDescriptorPool" );
592
+ delete reinterpret_cast <MockDescriptorPool*>(descriptorPool);
593
+ }
594
+
577
595
VkResult vkResetDescriptorPool (VkDevice device,
578
596
VkDescriptorPool descriptorPool,
579
597
VkDescriptorPoolResetFlags flags) {
@@ -655,15 +673,24 @@ VkResult vkCreateSwapchainKHR(VkDevice device,
655
673
return VK_SUCCESS;
656
674
}
657
675
676
+ void vkDestroySwapchainKHR (VkDevice device,
677
+ VkSwapchainKHR swapchain,
678
+ const VkAllocationCallbacks* pAllocator) {
679
+ delete reinterpret_cast <MockSwapchainKHR*>(swapchain);
680
+ }
681
+
658
682
VkResult vkGetSwapchainImagesKHR (VkDevice device,
659
683
VkSwapchainKHR swapchain,
660
684
uint32_t * pSwapchainImageCount,
661
685
VkImage* pSwapchainImages) {
662
- *pSwapchainImageCount = 3 ;
686
+ MockSwapchainKHR* mock_swapchain =
687
+ reinterpret_cast <MockSwapchainKHR*>(swapchain);
688
+ auto & images = mock_swapchain->images ;
689
+ *pSwapchainImageCount = images.size ();
663
690
if (pSwapchainImages != nullptr ) {
664
- pSwapchainImages[ 0 ] = reinterpret_cast <VkImage>( new MockImage ());
665
- pSwapchainImages[1 ] = reinterpret_cast <VkImage>(new MockImage () );
666
- pSwapchainImages[ 2 ] = reinterpret_cast <VkImage>( new MockImage ());
691
+ for ( size_t i = 0 ; i < images. size (); i++) {
692
+ pSwapchainImages[i ] = reinterpret_cast <VkImage>(&images[i] );
693
+ }
667
694
}
668
695
return VK_SUCCESS;
669
696
}
@@ -676,6 +703,12 @@ VkResult vkCreateSemaphore(VkDevice device,
676
703
return VK_SUCCESS;
677
704
}
678
705
706
+ void vkDestroySemaphore (VkDevice device,
707
+ VkSemaphore semaphore,
708
+ const VkAllocationCallbacks* pAllocator) {
709
+ delete reinterpret_cast <MockSemaphore*>(semaphore);
710
+ }
711
+
679
712
VkResult vkAcquireNextImageKHR (VkDevice device,
680
713
VkSwapchainKHR swapchain,
681
714
uint64_t timeout,
@@ -790,10 +823,14 @@ PFN_vkVoidFunction GetMockVulkanProcAddress(VkInstance instance,
790
823
return (PFN_vkVoidFunction)vkSetDebugUtilsObjectNameEXT;
791
824
} else if (strcmp (" vkCreateQueryPool" , pName) == 0 ) {
792
825
return (PFN_vkVoidFunction)vkCreateQueryPool;
826
+ } else if (strcmp (" vkDestroyQueryPool" , pName) == 0 ) {
827
+ return (PFN_vkVoidFunction)vkDestroyQueryPool;
793
828
} else if (strcmp (" vkGetQueryPoolResults" , pName) == 0 ) {
794
829
return (PFN_vkVoidFunction)vkGetQueryPoolResults;
795
830
} else if (strcmp (" vkCreateDescriptorPool" , pName) == 0 ) {
796
831
return (PFN_vkVoidFunction)vkCreateDescriptorPool;
832
+ } else if (strcmp (" vkDestroyDescriptorPool" , pName) == 0 ) {
833
+ return (PFN_vkVoidFunction)vkDestroyDescriptorPool;
797
834
} else if (strcmp (" vkResetDescriptorPool" , pName) == 0 ) {
798
835
return (PFN_vkVoidFunction)vkResetDescriptorPool;
799
836
} else if (strcmp (" vkAllocateDescriptorSets" , pName) == 0 ) {
@@ -806,10 +843,14 @@ PFN_vkVoidFunction GetMockVulkanProcAddress(VkInstance instance,
806
843
return (PFN_vkVoidFunction)vkGetPhysicalDeviceSurfaceSupportKHR;
807
844
} else if (strcmp (" vkCreateSwapchainKHR" , pName) == 0 ) {
808
845
return (PFN_vkVoidFunction)vkCreateSwapchainKHR;
846
+ } else if (strcmp (" vkDestroySwapchainKHR" , pName) == 0 ) {
847
+ return (PFN_vkVoidFunction)vkDestroySwapchainKHR;
809
848
} else if (strcmp (" vkGetSwapchainImagesKHR" , pName) == 0 ) {
810
849
return (PFN_vkVoidFunction)vkGetSwapchainImagesKHR;
811
850
} else if (strcmp (" vkCreateSemaphore" , pName) == 0 ) {
812
851
return (PFN_vkVoidFunction)vkCreateSemaphore;
852
+ } else if (strcmp (" vkDestroySemaphore" , pName) == 0 ) {
853
+ return (PFN_vkVoidFunction)vkDestroySemaphore;
813
854
} else if (strcmp (" vkDestroySurfaceKHR" , pName) == 0 ) {
814
855
return (PFN_vkVoidFunction)vkDestroySurfaceKHR;
815
856
} else if (strcmp (" vkAcquireNextImageKHR" , pName) == 0 ) {
0 commit comments