Path: blob/21.2-virgl/src/vulkan/util/vk_deferred_operation.c
7233 views
/*1* Copyright © 2020 Intel Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#include "vk_deferred_operation.h"2425#include "vk_alloc.h"26#include "vk_common_entrypoints.h"27#include "vk_device.h"2829VKAPI_ATTR VkResult VKAPI_CALL30vk_common_CreateDeferredOperationKHR(VkDevice _device,31const VkAllocationCallbacks *pAllocator,32VkDeferredOperationKHR *pDeferredOperation)33{34VK_FROM_HANDLE(vk_device, device, _device);3536struct vk_deferred_operation *op =37vk_alloc2(&device->alloc, pAllocator, sizeof(*op), 8,38VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);39if (op == NULL)40return VK_ERROR_OUT_OF_HOST_MEMORY;4142vk_object_base_init(device, &op->base,43VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR);4445*pDeferredOperation = vk_deferred_operation_to_handle(op);4647return VK_SUCCESS;48}4950VKAPI_ATTR void VKAPI_CALL51vk_common_DestroyDeferredOperationKHR(VkDevice _device,52VkDeferredOperationKHR operation,53const VkAllocationCallbacks *pAllocator)54{55VK_FROM_HANDLE(vk_device, device, _device);56VK_FROM_HANDLE(vk_deferred_operation, op, operation);5758if (op == NULL)59return;6061vk_object_base_finish(&op->base);62vk_free2(&device->alloc, pAllocator, op);63}6465VKAPI_ATTR uint32_t VKAPI_CALL66vk_common_GetDeferredOperationMaxConcurrencyKHR(UNUSED VkDevice device,67UNUSED VkDeferredOperationKHR operation)68{69return 1;70}7172VKAPI_ATTR VkResult VKAPI_CALL73vk_common_GetDeferredOperationResultKHR(UNUSED VkDevice device,74UNUSED VkDeferredOperationKHR operation)75{76return VK_SUCCESS;77}7879VKAPI_ATTR VkResult VKAPI_CALL80vk_common_DeferredOperationJoinKHR(UNUSED VkDevice device,81UNUSED VkDeferredOperationKHR operation)82{83return VK_SUCCESS;84}858687