From 68b1f6a2a0826034cfb1d646ea5a8bffcd3f8a3b Mon Sep 17 00:00:00 2001 From: Andrew Woloszyn Date: Wed, 25 Apr 2018 14:20:19 -0400 Subject: [PATCH] Remap the allocator during replay. This means we can replace pAllocator with nulltpr when necessary. --- gapis/api/vulkan/android/vulkan_android.api | 3 +-- gapis/api/vulkan/api/buffer.api | 10 ++++----- .../api/vulkan/api/command_buffer_control.api | 5 ++--- gapis/api/vulkan/api/descriptor.api | 13 ++++-------- gapis/api/vulkan/api/device.api | 6 ++---- gapis/api/vulkan/api/image.api | 17 ++++++--------- gapis/api/vulkan/api/instance.api | 6 ++---- gapis/api/vulkan/api/memory.api | 4 ++-- gapis/api/vulkan/api/pipeline.api | 21 ++++++++----------- gapis/api/vulkan/api/query_pool.api | 4 ++-- .../api/vulkan/api/renderpass_framebuffer.api | 8 +++---- gapis/api/vulkan/api/synchronization.api | 14 ++++++------- gapis/api/vulkan/api/types.api | 3 +++ gapis/api/vulkan/custom_replay.go | 8 +++++++ .../vulkan/extensions/ext_debug_report.api | 4 ++-- gapis/api/vulkan/extensions/khr_display.api | 6 ++---- .../extensions/khr_display_swapchain.api | 3 +-- gapis/api/vulkan/extensions/khr_surface.api | 3 +-- gapis/api/vulkan/extensions/khr_swapchain.api | 6 ++---- gapis/api/vulkan/linux/vulkan_linux.api | 12 ++++------- gapis/api/vulkan/synthetic.api | 10 ++++----- gapis/api/vulkan/windows/vulkan_windows.api | 2 +- 22 files changed, 72 insertions(+), 96 deletions(-) diff --git a/gapis/api/vulkan/android/vulkan_android.api b/gapis/api/vulkan/android/vulkan_android.api index 708c3293e0..0033dae25e 100644 --- a/gapis/api/vulkan/android/vulkan_android.api +++ b/gapis/api/vulkan/android/vulkan_android.api @@ -47,12 +47,11 @@ class VkAndroidSurfaceCreateInfoKHR { cmd VkResult vkCreateAndroidSurfaceKHR( VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { surface := createAndroidSurfaceObject(pCreateInfo) surface.Instance = instance surface.Type = SURFACE_TYPE_ANDROID - // TODO: pAllocator handle := ? pSurface[0] = handle diff --git a/gapis/api/vulkan/api/buffer.api b/gapis/api/vulkan/api/buffer.api index ba7bb1e018..52f560dba5 100644 --- a/gapis/api/vulkan/api/buffer.api +++ b/gapis/api/vulkan/api/buffer.api @@ -67,7 +67,7 @@ cmd VkResult vkCreateBuffer( VkDevice device, const VkBufferCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkBuffer* pBuffer) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkBufferCreateInfo") } @@ -122,7 +122,7 @@ cmd VkResult vkCreateBuffer( cmd void vkDestroyBuffer( VkDevice device, VkBuffer buffer, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } if (buffer != as!VkBuffer(0)) { bufferObject := Buffers[buffer] @@ -155,12 +155,11 @@ cmd void vkDestroyBuffer( cmd VkResult vkCreateBufferView( VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkBufferView* pView) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkBufferViewCreateInfo") } buffer_view_create_info := pCreateInfo[0] - // TODO: pAllocator handle := ? bufferViewObject := new!BufferViewObject( @@ -182,8 +181,7 @@ cmd VkResult vkCreateBufferView( cmd void vkDestroyBufferView( VkDevice device, VkBufferView bufferView, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(BufferViews, bufferView) } diff --git a/gapis/api/vulkan/api/command_buffer_control.api b/gapis/api/vulkan/api/command_buffer_control.api index 43f3827070..998c8a8f11 100644 --- a/gapis/api/vulkan/api/command_buffer_control.api +++ b/gapis/api/vulkan/api/command_buffer_control.api @@ -53,12 +53,11 @@ cmd VkResult vkCreateCommandPool( VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkCommandPool* pCommandPool) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkCommandPoolCreateInfo") } create_info := pCreateInfo[0] - // TODO: pAllocator handle := ? if pCommandPool == null { vkErrorNullPointer("VkCommandPool") } @@ -76,7 +75,7 @@ cmd VkResult vkCreateCommandPool( cmd void vkDestroyCommandPool( VkDevice device, VkCommandPool commandPool, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } if (commandPool != as!VkCommandPool(0)) { if !(commandPool in CommandPools) { vkErrorInvalidCommandPool(commandPool) } diff --git a/gapis/api/vulkan/api/descriptor.api b/gapis/api/vulkan/api/descriptor.api index 6ce60714e1..5085ad7f8b 100644 --- a/gapis/api/vulkan/api/descriptor.api +++ b/gapis/api/vulkan/api/descriptor.api @@ -61,7 +61,7 @@ cmd VkResult vkCreateDescriptorSetLayout( VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDescriptorSetLayout* pSetLayout) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkDescriptorSetLayoutCreateInfo") } @@ -94,8 +94,6 @@ cmd VkResult vkCreateDescriptorSetLayout( } descriptorSetLayout.MaximumBinding = largestBinding.Val - // TODO: pAllocator - handle := ? if pSetLayout == null { vkErrorNullPointer("VkDescriptorSetLayout") } pSetLayout[0] = handle @@ -110,8 +108,7 @@ cmd VkResult vkCreateDescriptorSetLayout( cmd void vkDestroyDescriptorSetLayout( VkDevice device, VkDescriptorSetLayout descriptorSetLayout, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(DescriptorSetLayouts, descriptorSetLayout) } @@ -135,7 +132,7 @@ cmd void vkDestroyDescriptorSetLayout( cmd VkResult vkCreateDescriptorPool( VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDescriptorPool* pDescriptorPool) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkDescriptorPoolCreateInfo") } @@ -151,8 +148,6 @@ cmd VkResult vkCreateDescriptorPool( } // TODO: info.pNext - // TODO: pAllocator - handle := ? if pDescriptorPool == null { vkErrorNullPointer("VkDescriptorPool") } pDescriptorPool[0] = handle @@ -167,7 +162,7 @@ cmd VkResult vkCreateDescriptorPool( cmd void vkDestroyDescriptorPool( VkDevice device, VkDescriptorPool descriptorPool, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } if (descriptorPool != as!VkDescriptorPool(0)) { if !(descriptorPool in DescriptorPools) { vkErrorInvalidDescriptorPool(descriptorPool) } diff --git a/gapis/api/vulkan/api/device.api b/gapis/api/vulkan/api/device.api index 6b6855ef13..f2c10383b2 100644 --- a/gapis/api/vulkan/api/device.api +++ b/gapis/api/vulkan/api/device.api @@ -70,14 +70,13 @@ cmd PFN_vkVoidFunction vkGetDeviceProcAddr( cmd VkResult vkCreateDevice( VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDevice* pDevice) { // NOTE: The logic for this function should be identical to the one of // replayCreateVkDevice() in synthetic.api. Change both together. device := createDeviceObject(pCreateInfo) if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) } device.PhysicalDevice = physicalDevice - // TODO: pAllocator handle := ? if pDevice == null { vkErrorNullPointer("VkDevice*") } @@ -94,7 +93,7 @@ cmd VkResult vkCreateDevice( @custom cmd void vkDestroyDevice( VkDevice device, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if (device in Devices) { dev := Devices[device] for _ , _ , v in dev.QueueObjects { @@ -112,7 +111,6 @@ cmd void vkDestroyDevice( } } - // TODO: pAllocator delete(Devices, device) } diff --git a/gapis/api/vulkan/api/image.api b/gapis/api/vulkan/api/image.api index 62a1659662..e812dbf54b 100644 --- a/gapis/api/vulkan/api/image.api +++ b/gapis/api/vulkan/api/image.api @@ -121,11 +121,10 @@ cmd VkResult vkCreateImage( VkDevice device, const VkImageCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkImage* pImage) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkImageCreateInfo") } - // TODO: pAllocator info := pCreateInfo[0] queueFamilyIndices := info.pQueueFamilyIndices[0:info.queueFamilyIndexCount] @@ -238,8 +237,7 @@ cmd VkResult vkCreateImage( cmd void vkDestroyImage( VkDevice device, VkImage image, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } if (image != as!VkImage(0)) { imageObject := Images[image] @@ -319,12 +317,11 @@ cmd VkResult vkBindImageMemory( cmd VkResult vkCreateImageView( VkDevice device, const VkImageViewCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkImageView* pView) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkImageViewCreateInfo") } image_view_create_info := pCreateInfo[0] - // TODO: pAllocator handle := ? if !(image_view_create_info.image in Images) { vkErrorInvalidImage(image_view_create_info.image) } @@ -348,8 +345,7 @@ cmd VkResult vkCreateImageView( cmd void vkDestroyImageView( VkDevice device, VkImageView imageView, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(ImageViews, imageView) for _ , _ , drawInfo in LastDrawInfos { @@ -402,7 +398,7 @@ cmd void vkDestroyImageView( cmd VkResult vkCreateSampler( VkDevice device, const VkSamplerCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSampler* pSampler) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkSamplerCreateInfo") } @@ -438,9 +434,8 @@ cmd VkResult vkCreateSampler( cmd void vkDestroySampler( VkDevice device, VkSampler sampler, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } - // TODO: pAllocator delete(Samplers, sampler) } diff --git a/gapis/api/vulkan/api/instance.api b/gapis/api/vulkan/api/instance.api index 72c52782dc..26f42dac31 100644 --- a/gapis/api/vulkan/api/instance.api +++ b/gapis/api/vulkan/api/instance.api @@ -50,13 +50,12 @@ @override cmd VkResult vkCreateInstance( const VkInstanceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkInstance* pInstance) { // NOTE: The logic for this function should be identical to the one of // replayCreateVkInstance() in synthetic.api. Change both together. instance := createInstanceObject(pCreateInfo) - // TODO: pAllocator handle := ? if pInstance == null { vkErrorNullPointer("VkInstance") } pInstance[0] = handle @@ -71,8 +70,7 @@ cmd VkResult vkCreateInstance( @custom cmd void vkDestroyInstance( VkInstance instance, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { delete(Instances, instance) } diff --git a/gapis/api/vulkan/api/memory.api b/gapis/api/vulkan/api/memory.api index 30d65d461a..25e82d3d03 100644 --- a/gapis/api/vulkan/api/memory.api +++ b/gapis/api/vulkan/api/memory.api @@ -67,7 +67,7 @@ cmd VkResult vkAllocateMemory( VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDeviceMemory* pMemory) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pAllocateInfo == null { vkErrorNullPointer("VkMemoryAllocateInfo") } @@ -124,7 +124,7 @@ cmd VkResult vkAllocateMemory( cmd void vkFreeMemory( VkDevice device, VkDeviceMemory memory, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } if (memory != as!VkDeviceMemory(0)) { memoryObject := DeviceMemories[memory] diff --git a/gapis/api/vulkan/api/pipeline.api b/gapis/api/vulkan/api/pipeline.api index 82bd6df079..4bafc6f33d 100644 --- a/gapis/api/vulkan/api/pipeline.api +++ b/gapis/api/vulkan/api/pipeline.api @@ -53,14 +53,13 @@ cmd VkResult vkCreatePipelineLayout( VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkPipelineLayout* pPipelineLayout) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkPipelineLayoutCreateInfo") } info := pCreateInfo[0] pipelineLayout := new!PipelineLayoutObject(Device: device) // TODO: info.pNext - // TODO: pAllocator layoutCount := info.setLayoutCount layouts := info.pSetLayouts[0:layoutCount] @@ -86,10 +85,9 @@ cmd VkResult vkCreatePipelineLayout( cmd void vkDestroyPipelineLayout( VkDevice device, VkPipelineLayout pipelineLayout, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } - // TODO: pAllocator delete(PipelineLayouts, pipelineLayout) } @@ -225,7 +223,7 @@ cmd VkResult vkCreateGraphicsPipelines( VkPipelineCache pipelineCache, u32 createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkPipeline* pPipelines) { if !(device in Devices) { vkErrorInvalidDevice(device) } @@ -450,7 +448,7 @@ cmd VkResult vkCreateComputePipelines( VkPipelineCache pipelineCache, u32 createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkPipeline* pPipelines) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pipelineCache != as!VkPipelineCache(0) { @@ -495,7 +493,6 @@ cmd VkResult vkCreateComputePipelines( } created_pipelines.Objects[i] = obj } - // TODO: pAllocator pipelines := pPipelines[0:createInfoCount] for i in (0 .. createInfoCount) { @@ -516,7 +513,7 @@ cmd VkResult vkCreateComputePipelines( cmd void vkDestroyPipeline( VkDevice device, VkPipeline pipeline, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pipeline in GraphicsPipelines { delete(GraphicsPipelines, pipeline) @@ -542,7 +539,7 @@ cmd void vkDestroyPipeline( cmd VkResult vkCreateShaderModule( VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkShaderModule* pShaderModule) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkShaderModuleCreateInfo") } @@ -564,7 +561,7 @@ cmd VkResult vkCreateShaderModule( cmd void vkDestroyShaderModule( VkDevice device, VkShaderModule shaderModule, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(ShaderModules, shaderModule) } @@ -583,7 +580,7 @@ cmd void vkDestroyShaderModule( cmd VkResult vkCreatePipelineCache( VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkPipelineCache* pPipelineCache) { //TODO(awoloszyn): Add Allocator support if !(device in Devices) { vkErrorInvalidDevice(device) } @@ -601,7 +598,7 @@ cmd VkResult vkCreatePipelineCache( cmd void vkDestroyPipelineCache( VkDevice device, VkPipelineCache pipelineCache, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(PipelineCaches, pipelineCache) } diff --git a/gapis/api/vulkan/api/query_pool.api b/gapis/api/vulkan/api/query_pool.api index 2c457692a0..e9845f8fbc 100644 --- a/gapis/api/vulkan/api/query_pool.api +++ b/gapis/api/vulkan/api/query_pool.api @@ -61,7 +61,7 @@ enum QueryStatus { cmd VkResult vkCreateQueryPool( VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkQueryPool* pQueryPool) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkQueuePoolCreateInfo") } @@ -90,7 +90,7 @@ cmd VkResult vkCreateQueryPool( cmd void vkDestroyQueryPool( VkDevice device, VkQueryPool queryPool, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(QueryPools, queryPool) } diff --git a/gapis/api/vulkan/api/renderpass_framebuffer.api b/gapis/api/vulkan/api/renderpass_framebuffer.api index 4db3c30426..48df23b7d8 100644 --- a/gapis/api/vulkan/api/renderpass_framebuffer.api +++ b/gapis/api/vulkan/api/renderpass_framebuffer.api @@ -56,7 +56,7 @@ cmd VkResult vkCreateFramebuffer( VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkFramebuffer* pFramebuffer) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkFramebufferCreateInfo") } @@ -86,7 +86,7 @@ cmd VkResult vkCreateFramebuffer( cmd void vkDestroyFramebuffer( VkDevice device, VkFramebuffer framebuffer, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(Framebuffers, framebuffer) } @@ -119,7 +119,7 @@ cmd void vkDestroyFramebuffer( cmd VkResult vkCreateRenderPass( VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkRenderPass* pRenderPass) { if !(device in Devices) { vkErrorInvalidDevice(device) } renderPass := new!RenderPassObject() @@ -181,7 +181,7 @@ cmd VkResult vkCreateRenderPass( cmd void vkDestroyRenderPass( VkDevice device, VkRenderPass renderPass, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(RenderPasses, renderPass) } diff --git a/gapis/api/vulkan/api/synchronization.api b/gapis/api/vulkan/api/synchronization.api index e47fde1758..8ec8decc6e 100644 --- a/gapis/api/vulkan/api/synchronization.api +++ b/gapis/api/vulkan/api/synchronization.api @@ -52,7 +52,7 @@ cmd VkResult vkCreateFence( VkDevice device, const VkFenceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkFence* pFence) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkFenceCreateInfo") } @@ -78,7 +78,7 @@ cmd VkResult vkCreateFence( cmd void vkDestroyFence( VkDevice device, VkFence fence, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(Fences, fence) } @@ -141,12 +141,11 @@ cmd VkResult vkWaitForFences( cmd VkResult vkCreateSemaphore( VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSemaphore* pSemaphore) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkSemaphoreCreateInfo") } _ = pCreateInfo[0] - // TODO: pAllocator handle := ? semaphoreObject := new!SemaphoreObject(Device: device, @@ -163,8 +162,7 @@ cmd VkResult vkCreateSemaphore( cmd void vkDestroySemaphore( VkDevice device, VkSemaphore semaphore, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } delete(Semaphores, semaphore) } @@ -186,7 +184,7 @@ cmd void vkDestroySemaphore( cmd VkResult vkCreateEvent( VkDevice device, const VkEventCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkEvent* pEvent) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkEventCreateInfo") } @@ -208,7 +206,7 @@ cmd VkResult vkCreateEvent( cmd void vkDestroyEvent( VkDevice device, VkEvent event, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { delete(Events, event) } diff --git a/gapis/api/vulkan/api/types.api b/gapis/api/vulkan/api/types.api index dc8f59ab0a..a0a5f561e3 100644 --- a/gapis/api/vulkan/api/types.api +++ b/gapis/api/vulkan/api/types.api @@ -70,6 +70,9 @@ type u32 VkSampleMask @replay_remap @nonDispatchHandle type u64 VkFramebuffer @replay_remap @nonDispatchHandle type u64 VkCommandPool +// Custom replay values +@replay_custom_value type const VkAllocationCallbacks* AllocationCallbacks + // Vulkan 1.1 core @replay_remap @nonDispatchHandle type u64 VkDescriptorUpdateTemplate @replay_remap @nonDispatchHandle type u64 VkSamplerYcbcrConversion diff --git a/gapis/api/vulkan/custom_replay.go b/gapis/api/vulkan/custom_replay.go index a0d1fbf2ea..f321ff1554 100644 --- a/gapis/api/vulkan/custom_replay.go +++ b/gapis/api/vulkan/custom_replay.go @@ -21,6 +21,7 @@ import ( "github.com/google/gapid/gapis/api" "github.com/google/gapid/gapis/memory" "github.com/google/gapid/gapis/replay/builder" + "github.com/google/gapid/gapis/replay/value" ) func (i VkInstance) remap(api.Cmd, *api.GlobalState) (key interface{}, remap bool) { @@ -452,3 +453,10 @@ func (a *ReplayAllocateImageMemory) Mutate(ctx context.Context, id api.CmdID, s a.PMemory.Slice(0, 1, l).Write(ctx, []VkDeviceMemory{memory}, a, s, b) return err } + +func (i AllocationCallbacks) value(b *builder.Builder, cmd api.Cmd, s *api.GlobalState) value.Value { + // Return 0 (nullptr) here. We don't have an allocator set up for replay. Since we cannot use the + // application's allocator. If we pass in null for all allocator calls, then it will use the default + // allocator. + return value.AbsolutePointer(0) +} diff --git a/gapis/api/vulkan/extensions/ext_debug_report.api b/gapis/api/vulkan/extensions/ext_debug_report.api index 0c8a74c15c..058b209f7a 100644 --- a/gapis/api/vulkan/extensions/ext_debug_report.api +++ b/gapis/api/vulkan/extensions/ext_debug_report.api @@ -151,7 +151,7 @@ class VkDebugReportCallbackCreateInfoEXT { cmd VkResult vkCreateDebugReportCallbackEXT( VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDebugReportCallbackEXT* pCallback) { if !(instance in Instances) { vkErrorInvalidInstance(instance) } return ? @@ -163,7 +163,7 @@ cmd VkResult vkCreateDebugReportCallbackEXT( cmd void vkDestroyDebugReportCallbackEXT( VkInstance instance, VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks* pAllocator) { + AllocationCallbacks pAllocator) { if !(instance in Instances) { vkErrorInvalidInstance(instance) } } diff --git a/gapis/api/vulkan/extensions/khr_display.api b/gapis/api/vulkan/extensions/khr_display.api index 0e551684b3..72ba651962 100644 --- a/gapis/api/vulkan/extensions/khr_display.api +++ b/gapis/api/vulkan/extensions/khr_display.api @@ -249,12 +249,11 @@ cmd VkResult vkCreateDisplayModeKHR( VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDisplayModeKHR* pMode) { if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) } if pCreateInfo == null { vkErrorNullPointer("VkDisplayModeCreateInfo") } _ = pCreateInfo[0] - // TODO: pAllocator handle := ? if pMode == null { vkErrorNullPointer("VkDisplayModeKHR") } @@ -286,12 +285,11 @@ cmd VkResult vkGetDisplayPlaneCapabilitiesKHR( cmd VkResult vkCreateDisplayPlaneSurfaceKHR( VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { if !(instance in Instances) { vkErrorInvalidInstance(instance) } if pCreateInfo == null { vkErrorNullPointer("VkDisplaySurfaceCreateInfoKHR") } _ = pCreateInfo[0] - // TODO: pAllocator handle := ? if pSurface == null { vkErrorNullPointer("VkSurfaceKHR") } diff --git a/gapis/api/vulkan/extensions/khr_display_swapchain.api b/gapis/api/vulkan/extensions/khr_display_swapchain.api index cbc3607290..6f3b25c1c8 100644 --- a/gapis/api/vulkan/extensions/khr_display_swapchain.api +++ b/gapis/api/vulkan/extensions/khr_display_swapchain.api @@ -66,7 +66,7 @@ cmd VkResult vkCreateSharedSwapchainsKHR( VkDevice device, u32 swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSwapchainKHR* pSwapchains) { if !(device in Devices) { vkErrorInvalidDevice(device) } create_infos := pCreateInfos[0:swapchainCount] @@ -76,7 +76,6 @@ cmd VkResult vkCreateSharedSwapchainsKHR( for i in (0 .. swapchainCount) { create_info := create_infos[i] queueFamilyIndices := create_info.pQueueFamilyIndices[0:create_info.queueFamilyIndexCount] - // TODO: pAllocator swapchainObject := new!SwapchainObject(Device: device, Info: ImageInfo( diff --git a/gapis/api/vulkan/extensions/khr_surface.api b/gapis/api/vulkan/extensions/khr_surface.api index 1cce0c3dcb..5363285013 100644 --- a/gapis/api/vulkan/extensions/khr_surface.api +++ b/gapis/api/vulkan/extensions/khr_surface.api @@ -128,8 +128,7 @@ class VkSurfaceFormatKHR { cmd void vkDestroySurfaceKHR( VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(instance in Instances) { vkErrorInvalidInstance(instance) } delete(Surfaces, surface) } diff --git a/gapis/api/vulkan/extensions/khr_swapchain.api b/gapis/api/vulkan/extensions/khr_swapchain.api index 887609c88a..1ef8b494bf 100644 --- a/gapis/api/vulkan/extensions/khr_swapchain.api +++ b/gapis/api/vulkan/extensions/khr_swapchain.api @@ -106,13 +106,12 @@ class VkPresentInfoKHR { cmd VkResult vkCreateSwapchainKHR( VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSwapchainKHR* pSwapchain) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkSwapchainCreateInfoKHR") } create_info := pCreateInfo[0] queueFamilyIndices := create_info.pQueueFamilyIndices[0:create_info.queueFamilyIndexCount] - // TODO: pAllocator swapchainObject := new!SwapchainObject(Device: device, Info: ImageInfo( @@ -154,8 +153,7 @@ cmd VkResult vkCreateSwapchainKHR( cmd void vkDestroySwapchainKHR( VkDevice device, VkSwapchainKHR swapchain, - const VkAllocationCallbacks* pAllocator) { - // TODO: pAllocator + AllocationCallbacks pAllocator) { if !(device in Devices) { vkErrorInvalidDevice(device) } swapObject := Swapchains[swapchain] if swapObject != null { diff --git a/gapis/api/vulkan/linux/vulkan_linux.api b/gapis/api/vulkan/linux/vulkan_linux.api index 86a6fef5e7..0567ad850b 100644 --- a/gapis/api/vulkan/linux/vulkan_linux.api +++ b/gapis/api/vulkan/linux/vulkan_linux.api @@ -52,13 +52,12 @@ class VkXlibSurfaceCreateInfoKHR { cmd VkResult vkCreateXlibSurfaceKHR( VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { _ = pCreateInfo[0] surface := new!SurfaceObject() surface.Instance = instance surface.Type = SURFACE_TYPE_XLIB - // TODO: pAllocator handle := ? pSurface[0] = handle @@ -104,13 +103,12 @@ class VkXcbSurfaceCreateInfoKHR { cmd VkResult vkCreateXcbSurfaceKHR( VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { read(pCreateInfo[0:1]) surface := new!SurfaceObject() surface.Instance = instance surface.Type = SURFACE_TYPE_XCB - // TODO: pAllocator handle := ? pSurface[0] = handle @@ -155,13 +153,12 @@ class VkWaylandSurfaceCreateInfoKHR { cmd VkResult vkCreateWaylandSurfaceKHR( VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { _ = pCreateInfo[0] surface := new!SurfaceObject() surface.Instance = instance surface.Type = SURFACE_TYPE_WAYLAND - // TODO: pAllocator handle := ? pSurface[0] = handle @@ -205,13 +202,12 @@ class VkMirSurfaceCreateInfoKHR { cmd VkResult vkCreateMirSurfaceKHR( VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { _ = pCreateInfo[0] surface := new!SurfaceObject() surface.Instance = instance surface.Type = SURFACE_TYPE_MIR - // TODO: pAllocator handle := ? pSurface[0] = handle diff --git a/gapis/api/vulkan/synthetic.api b/gapis/api/vulkan/synthetic.api index 3fa732716c..51896717bc 100644 --- a/gapis/api/vulkan/synthetic.api +++ b/gapis/api/vulkan/synthetic.api @@ -15,13 +15,13 @@ @synthetic cmd VkResult replayCreateVkInstance( const VkInstanceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkInstance* pInstance) { // NOTE: The logic for this function should be identical to the one of // vkCreateInstance() in vulkan.api. Change both together. instance := createInstanceObject(pCreateInfo) - // TODO: pAllocator + handle := ? if pInstance == null {vkErrorNullPointer("VkInstance")} pInstance[0] = handle @@ -34,14 +34,13 @@ cmd VkResult replayCreateVkInstance( cmd VkResult ReplayCreateVkDevice( VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkDevice* pDevice) { // NOTE: The logic for this function should be identical to the one of // vkCreateDevice() in vulkan.api. Change both together. device := createDeviceObject(pCreateInfo) device.PhysicalDevice = physicalDevice - // TODO: pAllocator handle := ? if pDevice == null {vkErrorNullPointer("VkDevice")} @@ -153,13 +152,12 @@ cmd VkResult replayEnumeratePhysicalDevices( cmd VkResult ReplayCreateSwapchain( VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSwapchainKHR* pSwapchain) { if !(device in Devices) { vkErrorInvalidDevice(device) } if pCreateInfo == null { vkErrorNullPointer("VkSwapchainCreateInfoKHR") } create_info := pCreateInfo[0] queueFamilyIndices := create_info.pQueueFamilyIndices[0:create_info.queueFamilyIndexCount] - // TODO: pAllocator swapchainObject := new!SwapchainObject(Device: device, Info: ImageInfo( diff --git a/gapis/api/vulkan/windows/vulkan_windows.api b/gapis/api/vulkan/windows/vulkan_windows.api index 294a596ecd..12efde0ef5 100644 --- a/gapis/api/vulkan/windows/vulkan_windows.api +++ b/gapis/api/vulkan/windows/vulkan_windows.api @@ -41,7 +41,7 @@ class VkWin32SurfaceCreateInfoKHR { cmd VkResult vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, + AllocationCallbacks pAllocator, VkSurfaceKHR* pSurface) { surface := createWin32SurfaceObject(pCreateInfo)