Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remap the allocator during replay. #1837

Merged
merged 1 commit into from
Apr 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions gapis/api/vulkan/android/vulkan_android.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions gapis/api/vulkan/api/buffer.api
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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(
Expand All @@ -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)
}
Expand Down
5 changes: 2 additions & 3 deletions gapis/api/vulkan/api/command_buffer_control.api
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand All @@ -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) }
Expand Down
13 changes: 4 additions & 9 deletions gapis/api/vulkan/api/descriptor.api
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down Expand Up @@ -94,8 +94,6 @@ cmd VkResult vkCreateDescriptorSetLayout(
}
descriptorSetLayout.MaximumBinding = largestBinding.Val

// TODO: pAllocator

handle := ?
if pSetLayout == null { vkErrorNullPointer("VkDescriptorSetLayout") }
pSetLayout[0] = handle
Expand All @@ -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)
}
Expand All @@ -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") }
Expand All @@ -151,8 +148,6 @@ cmd VkResult vkCreateDescriptorPool(
}
// TODO: info.pNext

// TODO: pAllocator

handle := ?
if pDescriptorPool == null { vkErrorNullPointer("VkDescriptorPool") }
pDescriptorPool[0] = handle
Expand All @@ -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) }
Expand Down
6 changes: 2 additions & 4 deletions gapis/api/vulkan/api/device.api
Original file line number Diff line number Diff line change
Expand Up @@ -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*") }
Expand All @@ -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 {
Expand All @@ -112,7 +111,6 @@ cmd void vkDestroyDevice(
}
}

// TODO: pAllocator
delete(Devices, device)
}

Expand Down
17 changes: 6 additions & 11 deletions gapis/api/vulkan/api/image.api
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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) }
Expand All @@ -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 {
Expand Down Expand Up @@ -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") }
Expand Down Expand Up @@ -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)
}

6 changes: 2 additions & 4 deletions gapis/api/vulkan/api/instance.api
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -71,8 +70,7 @@ cmd VkResult vkCreateInstance(
@custom
cmd void vkDestroyInstance(
VkInstance instance,
const VkAllocationCallbacks* pAllocator) {
// TODO: pAllocator
AllocationCallbacks pAllocator) {
delete(Instances, instance)
}

Expand Down
4 changes: 2 additions & 2 deletions gapis/api/vulkan/api/memory.api
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down Expand Up @@ -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]
Expand Down
21 changes: 9 additions & 12 deletions gapis/api/vulkan/api/pipeline.api
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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)
}

Expand Down Expand Up @@ -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) }
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -495,7 +493,6 @@ cmd VkResult vkCreateComputePipelines(
}
created_pipelines.Objects[i] = obj
}
// TODO: pAllocator

pipelines := pPipelines[0:createInfoCount]
for i in (0 .. createInfoCount) {
Expand All @@ -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)
Expand All @@ -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") }
Expand All @@ -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)
}
Expand All @@ -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) }
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions gapis/api/vulkan/api/query_pool.api
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down Expand Up @@ -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)
}
Expand Down
Loading