1 /*
2 * Copyright © 2020 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "vk_deferred_operation.h"
25
26 #include "vk_alloc.h"
27 #include "vk_common_entrypoints.h"
28 #include "vk_device.h"
29
30 VKAPI_ATTR VkResult VKAPI_CALL
vk_common_CreateDeferredOperationKHR(VkDevice _device,const VkAllocationCallbacks * pAllocator,VkDeferredOperationKHR * pDeferredOperation)31 vk_common_CreateDeferredOperationKHR(VkDevice _device,
32 const VkAllocationCallbacks *pAllocator,
33 VkDeferredOperationKHR *pDeferredOperation)
34 {
35 VK_FROM_HANDLE(vk_device, device, _device);
36
37 struct vk_deferred_operation *op =
38 vk_alloc2(&device->alloc, pAllocator, sizeof(*op), 8,
39 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
40 if (op == NULL)
41 return VK_ERROR_OUT_OF_HOST_MEMORY;
42
43 vk_object_base_init(device, &op->base,
44 VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR);
45
46 *pDeferredOperation = vk_deferred_operation_to_handle(op);
47
48 return VK_SUCCESS;
49 }
50
51 VKAPI_ATTR void VKAPI_CALL
vk_common_DestroyDeferredOperationKHR(VkDevice _device,VkDeferredOperationKHR operation,const VkAllocationCallbacks * pAllocator)52 vk_common_DestroyDeferredOperationKHR(VkDevice _device,
53 VkDeferredOperationKHR operation,
54 const VkAllocationCallbacks *pAllocator)
55 {
56 VK_FROM_HANDLE(vk_device, device, _device);
57 VK_FROM_HANDLE(vk_deferred_operation, op, operation);
58
59 if (op == NULL)
60 return;
61
62 vk_object_base_finish(&op->base);
63 vk_free2(&device->alloc, pAllocator, op);
64 }
65
66 VKAPI_ATTR uint32_t VKAPI_CALL
vk_common_GetDeferredOperationMaxConcurrencyKHR(UNUSED VkDevice device,UNUSED VkDeferredOperationKHR operation)67 vk_common_GetDeferredOperationMaxConcurrencyKHR(UNUSED VkDevice device,
68 UNUSED VkDeferredOperationKHR operation)
69 {
70 return 1;
71 }
72
73 VKAPI_ATTR VkResult VKAPI_CALL
vk_common_GetDeferredOperationResultKHR(UNUSED VkDevice device,UNUSED VkDeferredOperationKHR operation)74 vk_common_GetDeferredOperationResultKHR(UNUSED VkDevice device,
75 UNUSED VkDeferredOperationKHR operation)
76 {
77 return VK_SUCCESS;
78 }
79
80 VKAPI_ATTR VkResult VKAPI_CALL
vk_common_DeferredOperationJoinKHR(UNUSED VkDevice device,UNUSED VkDeferredOperationKHR operation)81 vk_common_DeferredOperationJoinKHR(UNUSED VkDevice device,
82 UNUSED VkDeferredOperationKHR operation)
83 {
84 return VK_SUCCESS;
85 }
86