v3dv: implement vkCreateCommandPool
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
committed by
Marge Bot
parent
e07b657f01
commit
1d8d8c06b8
@@ -52,6 +52,7 @@ v3dv_extensions_h = custom_target(
|
||||
)
|
||||
|
||||
libv3dv_files = files(
|
||||
'v3dv_cmd_buffer.c',
|
||||
'v3dv_debug.c',
|
||||
'v3dv_debug.h',
|
||||
'v3dv_descriptor_set.c',
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright © 2019 Raspberry Pi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "v3dv_private.h"
|
||||
|
||||
VkResult
|
||||
v3dv_CreateCommandPool(VkDevice _device,
|
||||
const VkCommandPoolCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkCommandPool *pCmdPool)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
struct v3dv_cmd_pool *pool;
|
||||
|
||||
/* We only support one queue */
|
||||
assert(pCreateInfo->queueFamilyIndex == 0);
|
||||
|
||||
pool = vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (pool == NULL)
|
||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
if (pAllocator)
|
||||
pool->alloc = *pAllocator;
|
||||
else
|
||||
pool->alloc = device->alloc;
|
||||
|
||||
list_inithead(&pool->cmd_buffers);
|
||||
|
||||
*pCmdPool = v3dv_cmd_pool_to_handle(pool);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_DestroyCommandPool(VkDevice _device,
|
||||
VkCommandPool commandPool,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
V3DV_FROM_HANDLE(v3dv_cmd_pool, pool, commandPool);
|
||||
|
||||
if (!pool)
|
||||
return;
|
||||
|
||||
vk_free2(&device->alloc, pAllocator, pool);
|
||||
}
|
||||
@@ -343,6 +343,11 @@ struct v3dv_framebuffer {
|
||||
struct v3dv_image_view *attachments[0];
|
||||
};
|
||||
|
||||
struct v3dv_cmd_pool {
|
||||
VkAllocationCallbacks alloc;
|
||||
struct list_head cmd_buffers;
|
||||
};
|
||||
|
||||
struct v3dv_shader_module {
|
||||
unsigned char sha1[20];
|
||||
uint32_t size;
|
||||
@@ -440,6 +445,7 @@ V3DV_DEFINE_HANDLE_CASTS(v3dv_instance, VkInstance)
|
||||
V3DV_DEFINE_HANDLE_CASTS(v3dv_physical_device, VkPhysicalDevice)
|
||||
V3DV_DEFINE_HANDLE_CASTS(v3dv_queue, VkQueue)
|
||||
|
||||
V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_cmd_pool, VkCommandPool)
|
||||
V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_buffer, VkBuffer)
|
||||
V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_device_memory, VkDeviceMemory)
|
||||
V3DV_DEFINE_NONDISP_HANDLE_CASTS(v3dv_framebuffer, VkFramebuffer)
|
||||
|
||||
Reference in New Issue
Block a user