[vulkan] ABI independence: fuse marshaling with handle mapping
bug: 119685647
bug: 111137294
This CL takes the changes for fusing marshaling with handle mapping. It
also refactors to have a common VulkanHandles.h header that both
Resources and VulkanHandleMapping will use, and takes the new
definitions of ResourceTracker in terms of macros instead of using a
code generator.
Change-Id: Ia461d799da273e437624d32f74af4aa9378f371f
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index fbacad8..20098af 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -13,1547 +13,57 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Autogenerated module ResourceTracker
-// (impl) generated by android/android-emugl/host/libs/libOpenglRender/vulkan-registry/xml/genvk.py -registry android/android-emugl/host/libs/libOpenglRender/vulkan-registry/xml/vk.xml cereal -o android/android-emugl/host/libs/libOpenglRender/vulkan/cereal
-// Please do not modify directly;
-// re-run android/scripts/generate-vulkan-sources.sh,
-// or directly from Python by defining:
-// VULKAN_REGISTRY_XML_DIR : Directory containing genvk.py and vk.xml
-// CEREAL_OUTPUT_DIR: Where to put the generated sources.
-// python3 $VULKAN_REGISTRY_XML_DIR/genvk.py -registry $VULKAN_REGISTRY_XML_DIR/vk.xml cereal -o $CEREAL_OUTPUT_DIR
-
#include "ResourceTracker.h"
-
#include "Resources.h"
-
namespace goldfish_vk {
-class CreateMapping : public VulkanHandleMapping {
-public:
- virtual ~CreateMapping() { }
- void mapHandles_VkBuffer(VkBuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkBuffer(handles[i]);
- }
- }
- void mapHandles_VkBuffer_u64(const VkBuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkBuffer(handles[i]);
- }
- }
- void mapHandles_VkBufferView(VkBufferView* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkBufferView(handles[i]);
- }
- }
- void mapHandles_VkBufferView_u64(const VkBufferView* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkBufferView(handles[i]);
- }
- }
- void mapHandles_VkCommandBuffer(VkCommandBuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkCommandBuffer(handles[i]);
- }
- }
- void mapHandles_VkCommandBuffer_u64(const VkCommandBuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkCommandBuffer(handles[i]);
- }
- }
- void mapHandles_VkCommandPool(VkCommandPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkCommandPool(handles[i]);
- }
- }
- void mapHandles_VkCommandPool_u64(const VkCommandPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkCommandPool(handles[i]);
- }
- }
- void mapHandles_VkDebugReportCallbackEXT(VkDebugReportCallbackEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDebugReportCallbackEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugReportCallbackEXT_u64(const VkDebugReportCallbackEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDebugReportCallbackEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugUtilsMessengerEXT(VkDebugUtilsMessengerEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDebugUtilsMessengerEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugUtilsMessengerEXT_u64(const VkDebugUtilsMessengerEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDebugUtilsMessengerEXT(handles[i]);
- }
- }
- void mapHandles_VkDescriptorPool(VkDescriptorPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDescriptorPool(handles[i]);
- }
- }
- void mapHandles_VkDescriptorPool_u64(const VkDescriptorPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDescriptorPool(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSet(VkDescriptorSet* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDescriptorSet(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSet_u64(const VkDescriptorSet* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDescriptorSet(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSetLayout(VkDescriptorSetLayout* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDescriptorSetLayout(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSetLayout_u64(const VkDescriptorSetLayout* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDescriptorSetLayout(handles[i]);
- }
- }
- void mapHandles_VkDescriptorUpdateTemplate(VkDescriptorUpdateTemplate* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDescriptorUpdateTemplate(handles[i]);
- }
- }
- void mapHandles_VkDescriptorUpdateTemplate_u64(const VkDescriptorUpdateTemplate* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDescriptorUpdateTemplate(handles[i]);
- }
- }
- void mapHandles_VkDevice(VkDevice* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDevice(handles[i]);
- }
- }
- void mapHandles_VkDevice_u64(const VkDevice* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDevice(handles[i]);
- }
- }
- void mapHandles_VkDeviceMemory(VkDeviceMemory* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDeviceMemory(handles[i]);
- }
- }
- void mapHandles_VkDeviceMemory_u64(const VkDeviceMemory* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDeviceMemory(handles[i]);
- }
- }
- void mapHandles_VkDisplayKHR(VkDisplayKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDisplayKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayKHR_u64(const VkDisplayKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDisplayKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayModeKHR(VkDisplayModeKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkDisplayModeKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayModeKHR_u64(const VkDisplayModeKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkDisplayModeKHR(handles[i]);
- }
- }
- void mapHandles_VkEvent(VkEvent* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkEvent(handles[i]);
- }
- }
- void mapHandles_VkEvent_u64(const VkEvent* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkEvent(handles[i]);
- }
- }
- void mapHandles_VkFence(VkFence* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkFence(handles[i]);
- }
- }
- void mapHandles_VkFence_u64(const VkFence* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkFence(handles[i]);
- }
- }
- void mapHandles_VkFramebuffer(VkFramebuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkFramebuffer(handles[i]);
- }
- }
- void mapHandles_VkFramebuffer_u64(const VkFramebuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkFramebuffer(handles[i]);
- }
- }
- void mapHandles_VkImage(VkImage* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkImage(handles[i]);
- }
- }
- void mapHandles_VkImage_u64(const VkImage* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkImage(handles[i]);
- }
- }
- void mapHandles_VkImageView(VkImageView* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkImageView(handles[i]);
- }
- }
- void mapHandles_VkImageView_u64(const VkImageView* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkImageView(handles[i]);
- }
- }
- void mapHandles_VkIndirectCommandsLayoutNVX(VkIndirectCommandsLayoutNVX* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkIndirectCommandsLayoutNVX(handles[i]);
- }
- }
- void mapHandles_VkIndirectCommandsLayoutNVX_u64(const VkIndirectCommandsLayoutNVX* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkIndirectCommandsLayoutNVX(handles[i]);
- }
- }
- void mapHandles_VkInstance(VkInstance* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkInstance(handles[i]);
- }
- }
- void mapHandles_VkInstance_u64(const VkInstance* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkInstance(handles[i]);
- }
- }
- void mapHandles_VkObjectTableNVX(VkObjectTableNVX* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkObjectTableNVX(handles[i]);
- }
- }
- void mapHandles_VkObjectTableNVX_u64(const VkObjectTableNVX* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkObjectTableNVX(handles[i]);
- }
- }
- void mapHandles_VkPhysicalDevice(VkPhysicalDevice* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkPhysicalDevice(handles[i]);
- }
- }
- void mapHandles_VkPhysicalDevice_u64(const VkPhysicalDevice* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkPhysicalDevice(handles[i]);
- }
- }
- void mapHandles_VkPipeline(VkPipeline* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkPipeline(handles[i]);
- }
- }
- void mapHandles_VkPipeline_u64(const VkPipeline* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkPipeline(handles[i]);
- }
- }
- void mapHandles_VkPipelineCache(VkPipelineCache* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkPipelineCache(handles[i]);
- }
- }
- void mapHandles_VkPipelineCache_u64(const VkPipelineCache* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkPipelineCache(handles[i]);
- }
- }
- void mapHandles_VkPipelineLayout(VkPipelineLayout* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkPipelineLayout(handles[i]);
- }
- }
- void mapHandles_VkPipelineLayout_u64(const VkPipelineLayout* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkPipelineLayout(handles[i]);
- }
- }
- void mapHandles_VkQueryPool(VkQueryPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkQueryPool(handles[i]);
- }
- }
- void mapHandles_VkQueryPool_u64(const VkQueryPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkQueryPool(handles[i]);
- }
- }
- void mapHandles_VkQueue(VkQueue* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkQueue(handles[i]);
- }
- }
- void mapHandles_VkQueue_u64(const VkQueue* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkQueue(handles[i]);
- }
- }
- void mapHandles_VkRenderPass(VkRenderPass* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkRenderPass(handles[i]);
- }
- }
- void mapHandles_VkRenderPass_u64(const VkRenderPass* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkRenderPass(handles[i]);
- }
- }
- void mapHandles_VkSampler(VkSampler* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkSampler(handles[i]);
- }
- }
- void mapHandles_VkSampler_u64(const VkSampler* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkSampler(handles[i]);
- }
- }
- void mapHandles_VkSamplerYcbcrConversion(VkSamplerYcbcrConversion* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkSamplerYcbcrConversion(handles[i]);
- }
- }
- void mapHandles_VkSamplerYcbcrConversion_u64(const VkSamplerYcbcrConversion* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkSamplerYcbcrConversion(handles[i]);
- }
- }
- void mapHandles_VkSemaphore(VkSemaphore* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkSemaphore(handles[i]);
- }
- }
- void mapHandles_VkSemaphore_u64(const VkSemaphore* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkSemaphore(handles[i]);
- }
- }
- void mapHandles_VkShaderModule(VkShaderModule* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkShaderModule(handles[i]);
- }
- }
- void mapHandles_VkShaderModule_u64(const VkShaderModule* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkShaderModule(handles[i]);
- }
- }
- void mapHandles_VkSurfaceKHR(VkSurfaceKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkSurfaceKHR(handles[i]);
- }
- }
- void mapHandles_VkSurfaceKHR_u64(const VkSurfaceKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkSurfaceKHR(handles[i]);
- }
- }
- void mapHandles_VkSwapchainKHR(VkSwapchainKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkSwapchainKHR(handles[i]);
- }
- }
- void mapHandles_VkSwapchainKHR_u64(const VkSwapchainKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkSwapchainKHR(handles[i]);
- }
- }
- void mapHandles_VkValidationCacheEXT(VkValidationCacheEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = new_from_host_VkValidationCacheEXT(handles[i]);
- }
- }
- void mapHandles_VkValidationCacheEXT_u64(const VkValidationCacheEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_VkValidationCacheEXT(handles[i]);
- }
- }
-};
-class UnwrapMapping : public VulkanHandleMapping {
-public:
- virtual ~UnwrapMapping() { }
- void mapHandles_VkBuffer(VkBuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkBuffer(handles[i]);
- }
- }
- void mapHandles_VkBuffer_u64(const VkBuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkBuffer(handles[i]);
- }
- }
- void mapHandles_VkBufferView(VkBufferView* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkBufferView(handles[i]);
- }
- }
- void mapHandles_VkBufferView_u64(const VkBufferView* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkBufferView(handles[i]);
- }
- }
- void mapHandles_VkCommandBuffer(VkCommandBuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkCommandBuffer(handles[i]);
- }
- }
- void mapHandles_VkCommandBuffer_u64(const VkCommandBuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkCommandBuffer(handles[i]);
- }
- }
- void mapHandles_VkCommandPool(VkCommandPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkCommandPool(handles[i]);
- }
- }
- void mapHandles_VkCommandPool_u64(const VkCommandPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkCommandPool(handles[i]);
- }
- }
- void mapHandles_VkDebugReportCallbackEXT(VkDebugReportCallbackEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDebugReportCallbackEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugReportCallbackEXT_u64(const VkDebugReportCallbackEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDebugReportCallbackEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugUtilsMessengerEXT(VkDebugUtilsMessengerEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDebugUtilsMessengerEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugUtilsMessengerEXT_u64(const VkDebugUtilsMessengerEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDebugUtilsMessengerEXT(handles[i]);
- }
- }
- void mapHandles_VkDescriptorPool(VkDescriptorPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDescriptorPool(handles[i]);
- }
- }
- void mapHandles_VkDescriptorPool_u64(const VkDescriptorPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDescriptorPool(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSet(VkDescriptorSet* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDescriptorSet(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSet_u64(const VkDescriptorSet* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDescriptorSet(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSetLayout(VkDescriptorSetLayout* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDescriptorSetLayout(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSetLayout_u64(const VkDescriptorSetLayout* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDescriptorSetLayout(handles[i]);
- }
- }
- void mapHandles_VkDescriptorUpdateTemplate(VkDescriptorUpdateTemplate* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDescriptorUpdateTemplate(handles[i]);
- }
- }
- void mapHandles_VkDescriptorUpdateTemplate_u64(const VkDescriptorUpdateTemplate* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDescriptorUpdateTemplate(handles[i]);
- }
- }
- void mapHandles_VkDevice(VkDevice* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDevice(handles[i]);
- }
- }
- void mapHandles_VkDevice_u64(const VkDevice* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDevice(handles[i]);
- }
- }
- void mapHandles_VkDeviceMemory(VkDeviceMemory* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDeviceMemory(handles[i]);
- }
- }
- void mapHandles_VkDeviceMemory_u64(const VkDeviceMemory* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDeviceMemory(handles[i]);
- }
- }
- void mapHandles_VkDisplayKHR(VkDisplayKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDisplayKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayKHR_u64(const VkDisplayKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDisplayKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayModeKHR(VkDisplayModeKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkDisplayModeKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayModeKHR_u64(const VkDisplayModeKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkDisplayModeKHR(handles[i]);
- }
- }
- void mapHandles_VkEvent(VkEvent* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkEvent(handles[i]);
- }
- }
- void mapHandles_VkEvent_u64(const VkEvent* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkEvent(handles[i]);
- }
- }
- void mapHandles_VkFence(VkFence* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkFence(handles[i]);
- }
- }
- void mapHandles_VkFence_u64(const VkFence* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkFence(handles[i]);
- }
- }
- void mapHandles_VkFramebuffer(VkFramebuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkFramebuffer(handles[i]);
- }
- }
- void mapHandles_VkFramebuffer_u64(const VkFramebuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkFramebuffer(handles[i]);
- }
- }
- void mapHandles_VkImage(VkImage* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkImage(handles[i]);
- }
- }
- void mapHandles_VkImage_u64(const VkImage* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkImage(handles[i]);
- }
- }
- void mapHandles_VkImageView(VkImageView* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkImageView(handles[i]);
- }
- }
- void mapHandles_VkImageView_u64(const VkImageView* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkImageView(handles[i]);
- }
- }
- void mapHandles_VkIndirectCommandsLayoutNVX(VkIndirectCommandsLayoutNVX* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkIndirectCommandsLayoutNVX(handles[i]);
- }
- }
- void mapHandles_VkIndirectCommandsLayoutNVX_u64(const VkIndirectCommandsLayoutNVX* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkIndirectCommandsLayoutNVX(handles[i]);
- }
- }
- void mapHandles_VkInstance(VkInstance* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkInstance(handles[i]);
- }
- }
- void mapHandles_VkInstance_u64(const VkInstance* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkInstance(handles[i]);
- }
- }
- void mapHandles_VkObjectTableNVX(VkObjectTableNVX* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkObjectTableNVX(handles[i]);
- }
- }
- void mapHandles_VkObjectTableNVX_u64(const VkObjectTableNVX* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkObjectTableNVX(handles[i]);
- }
- }
- void mapHandles_VkPhysicalDevice(VkPhysicalDevice* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkPhysicalDevice(handles[i]);
- }
- }
- void mapHandles_VkPhysicalDevice_u64(const VkPhysicalDevice* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkPhysicalDevice(handles[i]);
- }
- }
- void mapHandles_VkPipeline(VkPipeline* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkPipeline(handles[i]);
- }
- }
- void mapHandles_VkPipeline_u64(const VkPipeline* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkPipeline(handles[i]);
- }
- }
- void mapHandles_VkPipelineCache(VkPipelineCache* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkPipelineCache(handles[i]);
- }
- }
- void mapHandles_VkPipelineCache_u64(const VkPipelineCache* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkPipelineCache(handles[i]);
- }
- }
- void mapHandles_VkPipelineLayout(VkPipelineLayout* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkPipelineLayout(handles[i]);
- }
- }
- void mapHandles_VkPipelineLayout_u64(const VkPipelineLayout* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkPipelineLayout(handles[i]);
- }
- }
- void mapHandles_VkQueryPool(VkQueryPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkQueryPool(handles[i]);
- }
- }
- void mapHandles_VkQueryPool_u64(const VkQueryPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkQueryPool(handles[i]);
- }
- }
- void mapHandles_VkQueue(VkQueue* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkQueue(handles[i]);
- }
- }
- void mapHandles_VkQueue_u64(const VkQueue* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkQueue(handles[i]);
- }
- }
- void mapHandles_VkRenderPass(VkRenderPass* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkRenderPass(handles[i]);
- }
- }
- void mapHandles_VkRenderPass_u64(const VkRenderPass* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkRenderPass(handles[i]);
- }
- }
- void mapHandles_VkSampler(VkSampler* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkSampler(handles[i]);
- }
- }
- void mapHandles_VkSampler_u64(const VkSampler* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkSampler(handles[i]);
- }
- }
- void mapHandles_VkSamplerYcbcrConversion(VkSamplerYcbcrConversion* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkSamplerYcbcrConversion(handles[i]);
- }
- }
- void mapHandles_VkSamplerYcbcrConversion_u64(const VkSamplerYcbcrConversion* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkSamplerYcbcrConversion(handles[i]);
- }
- }
- void mapHandles_VkSemaphore(VkSemaphore* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkSemaphore(handles[i]);
- }
- }
- void mapHandles_VkSemaphore_u64(const VkSemaphore* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkSemaphore(handles[i]);
- }
- }
- void mapHandles_VkShaderModule(VkShaderModule* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkShaderModule(handles[i]);
- }
- }
- void mapHandles_VkShaderModule_u64(const VkShaderModule* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkShaderModule(handles[i]);
- }
- }
- void mapHandles_VkSurfaceKHR(VkSurfaceKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkSurfaceKHR(handles[i]);
- }
- }
- void mapHandles_VkSurfaceKHR_u64(const VkSurfaceKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkSurfaceKHR(handles[i]);
- }
- }
- void mapHandles_VkSwapchainKHR(VkSwapchainKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkSwapchainKHR(handles[i]);
- }
- }
- void mapHandles_VkSwapchainKHR_u64(const VkSwapchainKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkSwapchainKHR(handles[i]);
- }
- }
- void mapHandles_VkValidationCacheEXT(VkValidationCacheEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handles[i] = get_host_VkValidationCacheEXT(handles[i]);
- }
- }
- void mapHandles_VkValidationCacheEXT_u64(const VkValidationCacheEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- handle_u64s[i] = (uint64_t)(uintptr_t)get_host_VkValidationCacheEXT(handles[i]);
- }
- }
-};
-class DestroyMapping : public VulkanHandleMapping {
-public:
- virtual ~DestroyMapping() { }
- void mapHandles_VkBuffer(VkBuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkBuffer(handles[i]);
- }
- }
- void mapHandles_VkBuffer_u64(const VkBuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkBuffer(handles[i]);
- }
- }
- void mapHandles_VkBufferView(VkBufferView* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkBufferView(handles[i]);
- }
- }
- void mapHandles_VkBufferView_u64(const VkBufferView* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkBufferView(handles[i]);
- }
- }
- void mapHandles_VkCommandBuffer(VkCommandBuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkCommandBuffer(handles[i]);
- }
- }
- void mapHandles_VkCommandBuffer_u64(const VkCommandBuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkCommandBuffer(handles[i]);
- }
- }
- void mapHandles_VkCommandPool(VkCommandPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkCommandPool(handles[i]);
- }
- }
- void mapHandles_VkCommandPool_u64(const VkCommandPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkCommandPool(handles[i]);
- }
- }
- void mapHandles_VkDebugReportCallbackEXT(VkDebugReportCallbackEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDebugReportCallbackEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugReportCallbackEXT_u64(const VkDebugReportCallbackEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDebugReportCallbackEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugUtilsMessengerEXT(VkDebugUtilsMessengerEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDebugUtilsMessengerEXT(handles[i]);
- }
- }
- void mapHandles_VkDebugUtilsMessengerEXT_u64(const VkDebugUtilsMessengerEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDebugUtilsMessengerEXT(handles[i]);
- }
- }
- void mapHandles_VkDescriptorPool(VkDescriptorPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDescriptorPool(handles[i]);
- }
- }
- void mapHandles_VkDescriptorPool_u64(const VkDescriptorPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDescriptorPool(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSet(VkDescriptorSet* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDescriptorSet(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSet_u64(const VkDescriptorSet* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDescriptorSet(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSetLayout(VkDescriptorSetLayout* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDescriptorSetLayout(handles[i]);
- }
- }
- void mapHandles_VkDescriptorSetLayout_u64(const VkDescriptorSetLayout* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDescriptorSetLayout(handles[i]);
- }
- }
- void mapHandles_VkDescriptorUpdateTemplate(VkDescriptorUpdateTemplate* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDescriptorUpdateTemplate(handles[i]);
- }
- }
- void mapHandles_VkDescriptorUpdateTemplate_u64(const VkDescriptorUpdateTemplate* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDescriptorUpdateTemplate(handles[i]);
- }
- }
- void mapHandles_VkDevice(VkDevice* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDevice(handles[i]);
- }
- }
- void mapHandles_VkDevice_u64(const VkDevice* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDevice(handles[i]);
- }
- }
- void mapHandles_VkDeviceMemory(VkDeviceMemory* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDeviceMemory(handles[i]);
- }
- }
- void mapHandles_VkDeviceMemory_u64(const VkDeviceMemory* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDeviceMemory(handles[i]);
- }
- }
- void mapHandles_VkDisplayKHR(VkDisplayKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDisplayKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayKHR_u64(const VkDisplayKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDisplayKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayModeKHR(VkDisplayModeKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkDisplayModeKHR(handles[i]);
- }
- }
- void mapHandles_VkDisplayModeKHR_u64(const VkDisplayModeKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkDisplayModeKHR(handles[i]);
- }
- }
- void mapHandles_VkEvent(VkEvent* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkEvent(handles[i]);
- }
- }
- void mapHandles_VkEvent_u64(const VkEvent* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkEvent(handles[i]);
- }
- }
- void mapHandles_VkFence(VkFence* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkFence(handles[i]);
- }
- }
- void mapHandles_VkFence_u64(const VkFence* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkFence(handles[i]);
- }
- }
- void mapHandles_VkFramebuffer(VkFramebuffer* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkFramebuffer(handles[i]);
- }
- }
- void mapHandles_VkFramebuffer_u64(const VkFramebuffer* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkFramebuffer(handles[i]);
- }
- }
- void mapHandles_VkImage(VkImage* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkImage(handles[i]);
- }
- }
- void mapHandles_VkImage_u64(const VkImage* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkImage(handles[i]);
- }
- }
- void mapHandles_VkImageView(VkImageView* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkImageView(handles[i]);
- }
- }
- void mapHandles_VkImageView_u64(const VkImageView* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkImageView(handles[i]);
- }
- }
- void mapHandles_VkIndirectCommandsLayoutNVX(VkIndirectCommandsLayoutNVX* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkIndirectCommandsLayoutNVX(handles[i]);
- }
- }
- void mapHandles_VkIndirectCommandsLayoutNVX_u64(const VkIndirectCommandsLayoutNVX* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkIndirectCommandsLayoutNVX(handles[i]);
- }
- }
- void mapHandles_VkInstance(VkInstance* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkInstance(handles[i]);
- }
- }
- void mapHandles_VkInstance_u64(const VkInstance* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkInstance(handles[i]);
- }
- }
- void mapHandles_VkObjectTableNVX(VkObjectTableNVX* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkObjectTableNVX(handles[i]);
- }
- }
- void mapHandles_VkObjectTableNVX_u64(const VkObjectTableNVX* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkObjectTableNVX(handles[i]);
- }
- }
- void mapHandles_VkPhysicalDevice(VkPhysicalDevice* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkPhysicalDevice(handles[i]);
- }
- }
- void mapHandles_VkPhysicalDevice_u64(const VkPhysicalDevice* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkPhysicalDevice(handles[i]);
- }
- }
- void mapHandles_VkPipeline(VkPipeline* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkPipeline(handles[i]);
- }
- }
- void mapHandles_VkPipeline_u64(const VkPipeline* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkPipeline(handles[i]);
- }
- }
- void mapHandles_VkPipelineCache(VkPipelineCache* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkPipelineCache(handles[i]);
- }
- }
- void mapHandles_VkPipelineCache_u64(const VkPipelineCache* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkPipelineCache(handles[i]);
- }
- }
- void mapHandles_VkPipelineLayout(VkPipelineLayout* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkPipelineLayout(handles[i]);
- }
- }
- void mapHandles_VkPipelineLayout_u64(const VkPipelineLayout* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkPipelineLayout(handles[i]);
- }
- }
- void mapHandles_VkQueryPool(VkQueryPool* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkQueryPool(handles[i]);
- }
- }
- void mapHandles_VkQueryPool_u64(const VkQueryPool* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkQueryPool(handles[i]);
- }
- }
- void mapHandles_VkQueue(VkQueue* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkQueue(handles[i]);
- }
- }
- void mapHandles_VkQueue_u64(const VkQueue* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkQueue(handles[i]);
- }
- }
- void mapHandles_VkRenderPass(VkRenderPass* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkRenderPass(handles[i]);
- }
- }
- void mapHandles_VkRenderPass_u64(const VkRenderPass* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkRenderPass(handles[i]);
- }
- }
- void mapHandles_VkSampler(VkSampler* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkSampler(handles[i]);
- }
- }
- void mapHandles_VkSampler_u64(const VkSampler* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkSampler(handles[i]);
- }
- }
- void mapHandles_VkSamplerYcbcrConversion(VkSamplerYcbcrConversion* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkSamplerYcbcrConversion(handles[i]);
- }
- }
- void mapHandles_VkSamplerYcbcrConversion_u64(const VkSamplerYcbcrConversion* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkSamplerYcbcrConversion(handles[i]);
- }
- }
- void mapHandles_VkSemaphore(VkSemaphore* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkSemaphore(handles[i]);
- }
- }
- void mapHandles_VkSemaphore_u64(const VkSemaphore* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkSemaphore(handles[i]);
- }
- }
- void mapHandles_VkShaderModule(VkShaderModule* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkShaderModule(handles[i]);
- }
- }
- void mapHandles_VkShaderModule_u64(const VkShaderModule* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkShaderModule(handles[i]);
- }
- }
- void mapHandles_VkSurfaceKHR(VkSurfaceKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkSurfaceKHR(handles[i]);
- }
- }
- void mapHandles_VkSurfaceKHR_u64(const VkSurfaceKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkSurfaceKHR(handles[i]);
- }
- }
- void mapHandles_VkSwapchainKHR(VkSwapchainKHR* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkSwapchainKHR(handles[i]);
- }
- }
- void mapHandles_VkSwapchainKHR_u64(const VkSwapchainKHR* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkSwapchainKHR(handles[i]);
- }
- }
- void mapHandles_VkValidationCacheEXT(VkValidationCacheEXT* handles, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- delete_goldfish_VkValidationCacheEXT(handles[i]);
- }
- }
- void mapHandles_VkValidationCacheEXT_u64(const VkValidationCacheEXT* handles, uint64_t* handle_u64s, size_t count) override
- {
- for (size_t i = 0; i < count; ++i)
- {
- (void)handle_u64s[i]; delete_goldfish_VkValidationCacheEXT(handles[i]);
- }
- }
-};
+#define MAKE_HANDLE_MAPPING_FOREACH(type_name, map_impl, map_to_u64_impl, map_from_u64_impl) \
+ void mapHandles_##type_name(type_name* handles, size_t count) override { \
+ for (size_t i = 0; i < count; ++i) { \
+ map_impl; \
+ } \
+ } \
+ void mapHandles_##type_name##_u64(const type_name* handles, uint64_t* handle_u64s, size_t count) override { \
+ for (size_t i = 0; i < count; ++i) { \
+ map_to_u64_impl; \
+ } \
+ } \
+ void mapHandles_u64_##type_name(const uint64_t* handle_u64s, type_name* handles, size_t count) override { \
+ for (size_t i = 0; i < count; ++i) { \
+ map_from_u64_impl; \
+ } \
+ } \
+
+#define DEFINE_RESOURCE_TRACKING_CLASS(class_name, impl) \
+class class_name : public VulkanHandleMapping { \
+public: \
+ virtual ~class_name() { } \
+ GOLDFISH_VK_LIST_HANDLE_TYPES(impl) \
+}; \
+
+#define CREATE_MAPPING_IMPL_FOR_TYPE(type_name) \
+ MAKE_HANDLE_MAPPING_FOREACH(type_name, \
+ handles[i] = new_from_host_##type_name(handles[i]), \
+ handle_u64s[i] = (uint64_t)(uintptr_t)new_from_host_##type_name(handles[i]), \
+ handles[i] = (type_name)(uintptr_t)new_from_host_##type_name((type_name)(uintptr_t)handle_u64s[i]))
+
+#define UNWRAP_MAPPING_IMPL_FOR_TYPE(type_name) \
+ MAKE_HANDLE_MAPPING_FOREACH(type_name, \
+ handles[i] = get_host_##type_name(handles[i]), \
+ handle_u64s[i] = (uint64_t)(uintptr_t)get_host_##type_name(handles[i]), \
+ handles[i] = (type_name)(uintptr_t)get_host_##type_name((type_name)(uintptr_t)handle_u64s[i]))
+
+#define DESTROY_MAPPING_IMPL_FOR_TYPE(type_name) \
+ MAKE_HANDLE_MAPPING_FOREACH(type_name, \
+ delete_goldfish_##type_name(handles[i]), \
+ (void)handle_u64s[i]; delete_goldfish_##type_name(handles[i]), \
+ (void)handles[i]; delete_goldfish_##type_name((type_name)(uintptr_t)handle_u64s[i]))
+
+DEFINE_RESOURCE_TRACKING_CLASS(CreateMapping, CREATE_MAPPING_IMPL_FOR_TYPE)
+DEFINE_RESOURCE_TRACKING_CLASS(UnwrapMapping, UNWRAP_MAPPING_IMPL_FOR_TYPE)
+DEFINE_RESOURCE_TRACKING_CLASS(DestroyMapping, DESTROY_MAPPING_IMPL_FOR_TYPE)
class ResourceTracker::Impl {
public:
@@ -1561,25 +71,23 @@
CreateMapping createMapping;
UnwrapMapping unwrapMapping;
DestroyMapping destroyMapping;
+ DefaultHandleMapping defaultMapping;
};
-
ResourceTracker::ResourceTracker() : mImpl(new ResourceTracker::Impl()) { }
ResourceTracker::~ResourceTracker() { }
-
VulkanHandleMapping* ResourceTracker::createMapping() {
return &mImpl->createMapping;
}
-
VulkanHandleMapping* ResourceTracker::unwrapMapping() {
return &mImpl->unwrapMapping;
}
-
VulkanHandleMapping* ResourceTracker::destroyMapping() {
return &mImpl->destroyMapping;
}
-
+VulkanHandleMapping* ResourceTracker::defaultMapping() {
+ return &mImpl->defaultMapping;
+}
static ResourceTracker* sTracker = nullptr;
-
// static
ResourceTracker* ResourceTracker::get() {
if (!sTracker) {
@@ -1588,249 +96,5 @@
}
return sTracker;
}
-#ifdef VK_VERSION_1_0
-#endif
-#ifdef VK_VERSION_1_1
-#endif
-#ifdef VK_KHR_surface
-#endif
-#ifdef VK_KHR_swapchain
-#endif
-#ifdef VK_KHR_display
-#endif
-#ifdef VK_KHR_display_swapchain
-#endif
-#ifdef VK_KHR_xlib_surface
-#endif
-#ifdef VK_KHR_xcb_surface
-#endif
-#ifdef VK_KHR_wayland_surface
-#endif
-#ifdef VK_KHR_mir_surface
-#endif
-#ifdef VK_KHR_android_surface
-#endif
-#ifdef VK_KHR_win32_surface
-#endif
-#ifdef VK_KHR_sampler_mirror_clamp_to_edge
-#endif
-#ifdef VK_KHR_multiview
-#endif
-#ifdef VK_KHR_get_physical_device_properties2
-#endif
-#ifdef VK_KHR_device_group
-#endif
-#ifdef VK_KHR_shader_draw_parameters
-#endif
-#ifdef VK_KHR_maintenance1
-#endif
-#ifdef VK_KHR_device_group_creation
-#endif
-#ifdef VK_KHR_external_memory_capabilities
-#endif
-#ifdef VK_KHR_external_memory
-#endif
-#ifdef VK_KHR_external_memory_win32
-#endif
-#ifdef VK_KHR_external_memory_fd
-#endif
-#ifdef VK_KHR_win32_keyed_mutex
-#endif
-#ifdef VK_KHR_external_semaphore_capabilities
-#endif
-#ifdef VK_KHR_external_semaphore
-#endif
-#ifdef VK_KHR_external_semaphore_win32
-#endif
-#ifdef VK_KHR_external_semaphore_fd
-#endif
-#ifdef VK_KHR_push_descriptor
-#endif
-#ifdef VK_KHR_16bit_storage
-#endif
-#ifdef VK_KHR_incremental_present
-#endif
-#ifdef VK_KHR_descriptor_update_template
-#endif
-#ifdef VK_KHR_create_renderpass2
-#endif
-#ifdef VK_KHR_shared_presentable_image
-#endif
-#ifdef VK_KHR_external_fence_capabilities
-#endif
-#ifdef VK_KHR_external_fence
-#endif
-#ifdef VK_KHR_external_fence_win32
-#endif
-#ifdef VK_KHR_external_fence_fd
-#endif
-#ifdef VK_KHR_maintenance2
-#endif
-#ifdef VK_KHR_get_surface_capabilities2
-#endif
-#ifdef VK_KHR_variable_pointers
-#endif
-#ifdef VK_KHR_get_display_properties2
-#endif
-#ifdef VK_KHR_dedicated_allocation
-#endif
-#ifdef VK_KHR_storage_buffer_storage_class
-#endif
-#ifdef VK_KHR_relaxed_block_layout
-#endif
-#ifdef VK_KHR_get_memory_requirements2
-#endif
-#ifdef VK_KHR_image_format_list
-#endif
-#ifdef VK_KHR_sampler_ycbcr_conversion
-#endif
-#ifdef VK_KHR_bind_memory2
-#endif
-#ifdef VK_KHR_maintenance3
-#endif
-#ifdef VK_KHR_draw_indirect_count
-#endif
-#ifdef VK_KHR_8bit_storage
-#endif
-#ifdef VK_EXT_debug_report
-#endif
-#ifdef VK_NV_glsl_shader
-#endif
-#ifdef VK_EXT_depth_range_unrestricted
-#endif
-#ifdef VK_IMG_filter_cubic
-#endif
-#ifdef VK_AMD_rasterization_order
-#endif
-#ifdef VK_AMD_shader_trinary_minmax
-#endif
-#ifdef VK_AMD_shader_explicit_vertex_parameter
-#endif
-#ifdef VK_EXT_debug_marker
-#endif
-#ifdef VK_AMD_gcn_shader
-#endif
-#ifdef VK_NV_dedicated_allocation
-#endif
-#ifdef VK_AMD_draw_indirect_count
-#endif
-#ifdef VK_AMD_negative_viewport_height
-#endif
-#ifdef VK_AMD_gpu_shader_half_float
-#endif
-#ifdef VK_AMD_shader_ballot
-#endif
-#ifdef VK_AMD_texture_gather_bias_lod
-#endif
-#ifdef VK_AMD_shader_info
-#endif
-#ifdef VK_AMD_shader_image_load_store_lod
-#endif
-#ifdef VK_IMG_format_pvrtc
-#endif
-#ifdef VK_NV_external_memory_capabilities
-#endif
-#ifdef VK_NV_external_memory
-#endif
-#ifdef VK_NV_external_memory_win32
-#endif
-#ifdef VK_NV_win32_keyed_mutex
-#endif
-#ifdef VK_EXT_validation_flags
-#endif
-#ifdef VK_NN_vi_surface
-#endif
-#ifdef VK_EXT_shader_subgroup_ballot
-#endif
-#ifdef VK_EXT_shader_subgroup_vote
-#endif
-#ifdef VK_EXT_conditional_rendering
-#endif
-#ifdef VK_NVX_device_generated_commands
-#endif
-#ifdef VK_NV_clip_space_w_scaling
-#endif
-#ifdef VK_EXT_direct_mode_display
-#endif
-#ifdef VK_EXT_acquire_xlib_display
-#endif
-#ifdef VK_EXT_display_surface_counter
-#endif
-#ifdef VK_EXT_display_control
-#endif
-#ifdef VK_GOOGLE_display_timing
-#endif
-#ifdef VK_NV_sample_mask_override_coverage
-#endif
-#ifdef VK_NV_geometry_shader_passthrough
-#endif
-#ifdef VK_NV_viewport_array2
-#endif
-#ifdef VK_NVX_multiview_per_view_attributes
-#endif
-#ifdef VK_NV_viewport_swizzle
-#endif
-#ifdef VK_EXT_discard_rectangles
-#endif
-#ifdef VK_EXT_conservative_rasterization
-#endif
-#ifdef VK_EXT_swapchain_colorspace
-#endif
-#ifdef VK_EXT_hdr_metadata
-#endif
-#ifdef VK_MVK_ios_surface
-#endif
-#ifdef VK_MVK_macos_surface
-#endif
-#ifdef VK_EXT_external_memory_dma_buf
-#endif
-#ifdef VK_EXT_queue_family_foreign
-#endif
-#ifdef VK_EXT_debug_utils
-#endif
-#ifdef VK_ANDROID_external_memory_android_hardware_buffer
-#endif
-#ifdef VK_EXT_sampler_filter_minmax
-#endif
-#ifdef VK_AMD_gpu_shader_int16
-#endif
-#ifdef VK_AMD_mixed_attachment_samples
-#endif
-#ifdef VK_AMD_shader_fragment_mask
-#endif
-#ifdef VK_EXT_shader_stencil_export
-#endif
-#ifdef VK_EXT_sample_locations
-#endif
-#ifdef VK_EXT_blend_operation_advanced
-#endif
-#ifdef VK_NV_fragment_coverage_to_color
-#endif
-#ifdef VK_NV_framebuffer_mixed_samples
-#endif
-#ifdef VK_NV_fill_rectangle
-#endif
-#ifdef VK_EXT_post_depth_coverage
-#endif
-#ifdef VK_EXT_validation_cache
-#endif
-#ifdef VK_EXT_descriptor_indexing
-#endif
-#ifdef VK_EXT_shader_viewport_index_layer
-#endif
-#ifdef VK_EXT_global_priority
-#endif
-#ifdef VK_EXT_external_memory_host
-#endif
-#ifdef VK_AMD_buffer_marker
-#endif
-#ifdef VK_AMD_shader_core_properties
-#endif
-#ifdef VK_EXT_vertex_attribute_divisor
-#endif
-#ifdef VK_NV_shader_subgroup_partitioned
-#endif
-#ifdef VK_NV_device_diagnostic_checkpoints
-#endif
} // namespace goldfish_vk