turnip: Use the common base object type and struct.
v2. Define new helper function to avoid duplicated a pair of function calls. v3. Move new helper functions to vk_object.h and call them. v4. Merge 2 commits to use commomn base object type and struct into one. Signed-off-by: Hyunjun Ko <zzoon@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5539>
This commit is contained in:
@@ -1333,12 +1333,12 @@ tu_create_cmd_buffer(struct tu_device *device,
|
|||||||
VkCommandBuffer *pCommandBuffer)
|
VkCommandBuffer *pCommandBuffer)
|
||||||
{
|
{
|
||||||
struct tu_cmd_buffer *cmd_buffer;
|
struct tu_cmd_buffer *cmd_buffer;
|
||||||
cmd_buffer = vk_zalloc(&pool->alloc, sizeof(*cmd_buffer), 8,
|
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
cmd_buffer = vk_object_zalloc(&device->vk, NULL, sizeof(*cmd_buffer),
|
||||||
|
VK_OBJECT_TYPE_COMMAND_BUFFER);
|
||||||
if (cmd_buffer == NULL)
|
if (cmd_buffer == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
|
||||||
cmd_buffer->device = device;
|
cmd_buffer->device = device;
|
||||||
cmd_buffer->pool = pool;
|
cmd_buffer->pool = pool;
|
||||||
cmd_buffer->level = level;
|
cmd_buffer->level = level;
|
||||||
@@ -1379,7 +1379,7 @@ tu_cmd_buffer_destroy(struct tu_cmd_buffer *cmd_buffer)
|
|||||||
tu_cs_finish(&cmd_buffer->sub_cs);
|
tu_cs_finish(&cmd_buffer->sub_cs);
|
||||||
|
|
||||||
tu_bo_list_destroy(&cmd_buffer->bo_list);
|
tu_bo_list_destroy(&cmd_buffer->bo_list);
|
||||||
vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
|
vk_object_free(&cmd_buffer->device->vk, &cmd_buffer->pool->alloc, cmd_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkResult
|
static VkResult
|
||||||
@@ -1422,7 +1422,6 @@ tu_AllocateCommandBuffers(VkDevice _device,
|
|||||||
list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
|
list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
|
||||||
|
|
||||||
result = tu_reset_cmd_buffer(cmd_buffer);
|
result = tu_reset_cmd_buffer(cmd_buffer);
|
||||||
cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
|
||||||
cmd_buffer->level = pAllocateInfo->level;
|
cmd_buffer->level = pAllocateInfo->level;
|
||||||
|
|
||||||
pCommandBuffers[i] = tu_cmd_buffer_to_handle(cmd_buffer);
|
pCommandBuffers[i] = tu_cmd_buffer_to_handle(cmd_buffer);
|
||||||
@@ -2481,15 +2480,15 @@ tu_CreateCommandPool(VkDevice _device,
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
struct tu_cmd_pool *pool;
|
struct tu_cmd_pool *pool;
|
||||||
|
|
||||||
pool = vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
|
pool = vk_object_alloc(&device->vk, pAllocator, sizeof(*pool),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_COMMAND_POOL);
|
||||||
if (pool == NULL)
|
if (pool == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
if (pAllocator)
|
if (pAllocator)
|
||||||
pool->alloc = *pAllocator;
|
pool->alloc = *pAllocator;
|
||||||
else
|
else
|
||||||
pool->alloc = device->alloc;
|
pool->alloc = device->vk.alloc;
|
||||||
|
|
||||||
list_inithead(&pool->cmd_buffers);
|
list_inithead(&pool->cmd_buffers);
|
||||||
list_inithead(&pool->free_cmd_buffers);
|
list_inithead(&pool->free_cmd_buffers);
|
||||||
@@ -2524,7 +2523,7 @@ tu_DestroyCommandPool(VkDevice _device,
|
|||||||
tu_cmd_buffer_destroy(cmd_buffer);
|
tu_cmd_buffer_destroy(cmd_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, pool);
|
vk_object_free(&device->vk, pAllocator, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
|
@@ -148,8 +148,8 @@ tu_CreateDescriptorSetLayout(
|
|||||||
immutable_sampler_count * sizeof(struct tu_sampler) +
|
immutable_sampler_count * sizeof(struct tu_sampler) +
|
||||||
ycbcr_sampler_count * sizeof(struct tu_sampler_ycbcr_conversion);
|
ycbcr_sampler_count * sizeof(struct tu_sampler_ycbcr_conversion);
|
||||||
|
|
||||||
set_layout = vk_zalloc2(&device->alloc, pAllocator, size, 8,
|
set_layout = vk_object_zalloc(&device->vk, pAllocator, size,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
|
||||||
if (!set_layout)
|
if (!set_layout)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ tu_CreateDescriptorSetLayout(
|
|||||||
VkDescriptorSetLayoutBinding *bindings = create_sorted_bindings(
|
VkDescriptorSetLayoutBinding *bindings = create_sorted_bindings(
|
||||||
pCreateInfo->pBindings, pCreateInfo->bindingCount);
|
pCreateInfo->pBindings, pCreateInfo->bindingCount);
|
||||||
if (!bindings) {
|
if (!bindings) {
|
||||||
vk_free2(&device->alloc, pAllocator, set_layout);
|
vk_object_free(&device->vk, pAllocator, set_layout);
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ tu_DestroyDescriptorSetLayout(VkDevice _device,
|
|||||||
if (!set_layout)
|
if (!set_layout)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, set_layout);
|
vk_object_free(&device->vk, pAllocator, set_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -353,8 +353,8 @@ tu_CreatePipelineLayout(VkDevice _device,
|
|||||||
assert(pCreateInfo->sType ==
|
assert(pCreateInfo->sType ==
|
||||||
VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
|
VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
|
||||||
|
|
||||||
layout = vk_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8,
|
layout = vk_object_alloc(&device->vk, pAllocator, sizeof(*layout),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_PIPELINE_LAYOUT);
|
||||||
if (layout == NULL)
|
if (layout == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -411,7 +411,8 @@ tu_DestroyPipelineLayout(VkDevice _device,
|
|||||||
|
|
||||||
if (!pipeline_layout)
|
if (!pipeline_layout)
|
||||||
return;
|
return;
|
||||||
vk_free2(&device->alloc, pAllocator, pipeline_layout);
|
|
||||||
|
vk_object_free(&device->vk, pAllocator, pipeline_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EMPTY 1
|
#define EMPTY 1
|
||||||
@@ -445,7 +446,7 @@ tu_descriptor_set_create(struct tu_device *device,
|
|||||||
set = (struct tu_descriptor_set*)pool->host_memory_ptr;
|
set = (struct tu_descriptor_set*)pool->host_memory_ptr;
|
||||||
pool->host_memory_ptr += mem_size;
|
pool->host_memory_ptr += mem_size;
|
||||||
} else {
|
} else {
|
||||||
set = vk_alloc2(&device->alloc, NULL, mem_size, 8,
|
set = vk_alloc2(&device->vk.alloc, NULL, mem_size, 8,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||||
|
|
||||||
if (!set)
|
if (!set)
|
||||||
@@ -453,6 +454,7 @@ tu_descriptor_set_create(struct tu_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(set, 0, mem_size);
|
memset(set, 0, mem_size);
|
||||||
|
vk_object_base_init(&device->vk, &set->base, VK_OBJECT_TYPE_DESCRIPTOR_SET);
|
||||||
|
|
||||||
if (layout->dynamic_offset_count) {
|
if (layout->dynamic_offset_count) {
|
||||||
set->dynamic_descriptors = (uint32_t *)((uint8_t*)set + dynamic_offset);
|
set->dynamic_descriptors = (uint32_t *)((uint8_t*)set + dynamic_offset);
|
||||||
@@ -472,7 +474,7 @@ tu_descriptor_set_create(struct tu_device *device,
|
|||||||
set->size = layout_size;
|
set->size = layout_size;
|
||||||
|
|
||||||
if (!pool->host_memory_base && pool->entry_count == pool->max_entry_count) {
|
if (!pool->host_memory_base && pool->entry_count == pool->max_entry_count) {
|
||||||
vk_free2(&device->alloc, NULL, set);
|
vk_object_free(&device->vk, NULL, set);
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_POOL_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_POOL_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,7 +502,7 @@ tu_descriptor_set_create(struct tu_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pool->size - offset < layout_size) {
|
if (pool->size - offset < layout_size) {
|
||||||
vk_free2(&device->alloc, NULL, set);
|
vk_object_free(&device->vk, NULL, set);
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_POOL_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_POOL_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +561,8 @@ tu_descriptor_set_destroy(struct tu_device *device,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vk_free2(&device->alloc, NULL, set);
|
|
||||||
|
vk_object_free(&device->vk, NULL, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -598,13 +601,11 @@ tu_CreateDescriptorPool(VkDevice _device,
|
|||||||
size += sizeof(struct tu_descriptor_pool_entry) * pCreateInfo->maxSets;
|
size += sizeof(struct tu_descriptor_pool_entry) * pCreateInfo->maxSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = vk_alloc2(&device->alloc, pAllocator, size, 8,
|
pool = vk_object_zalloc(&device->vk, pAllocator, size,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_DESCRIPTOR_POOL);
|
||||||
if (!pool)
|
if (!pool)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
memset(pool, 0, sizeof(*pool));
|
|
||||||
|
|
||||||
if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) {
|
if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) {
|
||||||
pool->host_memory_base = (uint8_t*)pool + sizeof(struct tu_descriptor_pool);
|
pool->host_memory_base = (uint8_t*)pool + sizeof(struct tu_descriptor_pool);
|
||||||
pool->host_memory_ptr = pool->host_memory_base;
|
pool->host_memory_ptr = pool->host_memory_base;
|
||||||
@@ -646,7 +647,8 @@ tu_DestroyDescriptorPool(VkDevice _device,
|
|||||||
|
|
||||||
if (pool->size)
|
if (pool->size)
|
||||||
tu_bo_finish(device, &pool->bo);
|
tu_bo_finish(device, &pool->bo);
|
||||||
vk_free2(&device->alloc, pAllocator, pool);
|
|
||||||
|
vk_object_free(&device->vk, pAllocator, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -1036,8 +1038,8 @@ tu_CreateDescriptorUpdateTemplate(
|
|||||||
sizeof(struct tu_descriptor_update_template_entry) * entry_count;
|
sizeof(struct tu_descriptor_update_template_entry) * entry_count;
|
||||||
struct tu_descriptor_update_template *templ;
|
struct tu_descriptor_update_template *templ;
|
||||||
|
|
||||||
templ = vk_alloc2(&device->alloc, pAllocator, size, 8,
|
templ = vk_object_alloc(&device->vk, pAllocator, size,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE);
|
||||||
if (!templ)
|
if (!templ)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -1109,7 +1111,7 @@ tu_DestroyDescriptorUpdateTemplate(
|
|||||||
if (!templ)
|
if (!templ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, templ);
|
vk_object_free(&device->vk, pAllocator, templ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1213,8 +1215,8 @@ tu_CreateSamplerYcbcrConversion(
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
struct tu_sampler_ycbcr_conversion *conversion;
|
struct tu_sampler_ycbcr_conversion *conversion;
|
||||||
|
|
||||||
conversion = vk_alloc2(&device->alloc, pAllocator, sizeof(*conversion), 8,
|
conversion = vk_object_alloc(&device->vk, pAllocator, sizeof(*conversion),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION);
|
||||||
if (!conversion)
|
if (!conversion)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -1238,6 +1240,8 @@ tu_DestroySamplerYcbcrConversion(VkDevice _device,
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
TU_FROM_HANDLE(tu_sampler_ycbcr_conversion, ycbcr_conversion, ycbcrConversion);
|
TU_FROM_HANDLE(tu_sampler_ycbcr_conversion, ycbcr_conversion, ycbcrConversion);
|
||||||
|
|
||||||
if (ycbcr_conversion)
|
if (!ycbcr_conversion)
|
||||||
vk_free2(&device->alloc, pAllocator, ycbcr_conversion);
|
return;
|
||||||
|
|
||||||
|
vk_object_free(&device->vk, pAllocator, ycbcr_conversion);
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,8 @@ struct tu_descriptor_set_binding_layout
|
|||||||
|
|
||||||
struct tu_descriptor_set_layout
|
struct tu_descriptor_set_layout
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
/* The create flags for this descriptor set layout */
|
/* The create flags for this descriptor set layout */
|
||||||
VkDescriptorSetLayoutCreateFlags flags;
|
VkDescriptorSetLayoutCreateFlags flags;
|
||||||
|
|
||||||
@@ -99,6 +101,8 @@ struct tu_descriptor_set_layout
|
|||||||
|
|
||||||
struct tu_pipeline_layout
|
struct tu_pipeline_layout
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct tu_descriptor_set_layout *layout;
|
struct tu_descriptor_set_layout *layout;
|
||||||
|
@@ -218,7 +218,7 @@ tu_physical_device_init(struct tu_physical_device *device,
|
|||||||
if (instance->debug_flags & TU_DEBUG_STARTUP)
|
if (instance->debug_flags & TU_DEBUG_STARTUP)
|
||||||
tu_logi("Found compatible device '%s'.", path);
|
tu_logi("Found compatible device '%s'.", path);
|
||||||
|
|
||||||
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
vk_object_base_init(NULL, &device->base, VK_OBJECT_TYPE_PHYSICAL_DEVICE);
|
||||||
device->instance = instance;
|
device->instance = instance;
|
||||||
assert(strlen(path) < ARRAY_SIZE(device->path));
|
assert(strlen(path) < ARRAY_SIZE(device->path));
|
||||||
strncpy(device->path, path, ARRAY_SIZE(device->path));
|
strncpy(device->path, path, ARRAY_SIZE(device->path));
|
||||||
@@ -339,6 +339,8 @@ tu_physical_device_finish(struct tu_physical_device *device)
|
|||||||
close(device->local_fd);
|
close(device->local_fd);
|
||||||
if (device->master_fd != -1)
|
if (device->master_fd != -1)
|
||||||
close(device->master_fd);
|
close(device->master_fd);
|
||||||
|
|
||||||
|
vk_object_base_finish(&device->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VKAPI_ATTR void *
|
static VKAPI_ATTR void *
|
||||||
@@ -421,10 +423,11 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||||||
|
|
||||||
instance = vk_zalloc2(&default_alloc, pAllocator, sizeof(*instance), 8,
|
instance = vk_zalloc2(&default_alloc, pAllocator, sizeof(*instance), 8,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||||
|
|
||||||
if (!instance)
|
if (!instance)
|
||||||
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
instance->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
vk_object_base_init(NULL, &instance->base, VK_OBJECT_TYPE_INSTANCE);
|
||||||
|
|
||||||
if (pAllocator)
|
if (pAllocator)
|
||||||
instance->alloc = *pAllocator;
|
instance->alloc = *pAllocator;
|
||||||
@@ -445,6 +448,7 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||||||
int index = tu_get_instance_extension_index(ext_name);
|
int index = tu_get_instance_extension_index(ext_name);
|
||||||
|
|
||||||
if (index < 0 || !tu_instance_extensions_supported.extensions[index]) {
|
if (index < 0 || !tu_instance_extensions_supported.extensions[index]) {
|
||||||
|
vk_object_base_finish(&instance->base);
|
||||||
vk_free2(&default_alloc, pAllocator, instance);
|
vk_free2(&default_alloc, pAllocator, instance);
|
||||||
return vk_error(instance, VK_ERROR_EXTENSION_NOT_PRESENT);
|
return vk_error(instance, VK_ERROR_EXTENSION_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
@@ -454,6 +458,7 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||||||
|
|
||||||
result = vk_debug_report_instance_init(&instance->debug_report_callbacks);
|
result = vk_debug_report_instance_init(&instance->debug_report_callbacks);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
|
vk_object_base_finish(&instance->base);
|
||||||
vk_free2(&default_alloc, pAllocator, instance);
|
vk_free2(&default_alloc, pAllocator, instance);
|
||||||
return vk_error(instance, result);
|
return vk_error(instance, result);
|
||||||
}
|
}
|
||||||
@@ -486,6 +491,7 @@ tu_DestroyInstance(VkInstance _instance,
|
|||||||
|
|
||||||
vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
|
vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
|
||||||
|
|
||||||
|
vk_object_base_finish(&instance->base);
|
||||||
vk_free(&instance->alloc, instance);
|
vk_free(&instance->alloc, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1096,7 +1102,8 @@ tu_queue_init(struct tu_device *device,
|
|||||||
int idx,
|
int idx,
|
||||||
VkDeviceQueueCreateFlags flags)
|
VkDeviceQueueCreateFlags flags)
|
||||||
{
|
{
|
||||||
queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
vk_object_base_init(&device->vk, &queue->base, VK_OBJECT_TYPE_QUEUE);
|
||||||
|
|
||||||
queue->device = device;
|
queue->device = device;
|
||||||
queue->queue_family_index = queue_family_index;
|
queue->queue_family_index = queue_family_index;
|
||||||
queue->queue_idx = idx;
|
queue->queue_idx = idx;
|
||||||
@@ -1212,22 +1219,19 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||||||
if (!device)
|
if (!device)
|
||||||
return vk_error(physical_device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(physical_device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
vk_device_init(&device->vk, pCreateInfo,
|
||||||
|
&physical_device->instance->alloc, pAllocator);
|
||||||
|
|
||||||
device->instance = physical_device->instance;
|
device->instance = physical_device->instance;
|
||||||
device->physical_device = physical_device;
|
device->physical_device = physical_device;
|
||||||
device->_lost = false;
|
device->_lost = false;
|
||||||
|
|
||||||
if (pAllocator)
|
|
||||||
device->alloc = *pAllocator;
|
|
||||||
else
|
|
||||||
device->alloc = physical_device->instance->alloc;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
|
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
|
||||||
const char *ext_name = pCreateInfo->ppEnabledExtensionNames[i];
|
const char *ext_name = pCreateInfo->ppEnabledExtensionNames[i];
|
||||||
int index = tu_get_device_extension_index(ext_name);
|
int index = tu_get_device_extension_index(ext_name);
|
||||||
if (index < 0 ||
|
if (index < 0 ||
|
||||||
!physical_device->supported_extensions.extensions[index]) {
|
!physical_device->supported_extensions.extensions[index]) {
|
||||||
vk_free(&device->alloc, device);
|
vk_free(&device->vk.alloc, device);
|
||||||
return vk_error(physical_device->instance,
|
return vk_error(physical_device->instance,
|
||||||
VK_ERROR_EXTENSION_NOT_PRESENT);
|
VK_ERROR_EXTENSION_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
@@ -1240,7 +1244,7 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||||||
&pCreateInfo->pQueueCreateInfos[i];
|
&pCreateInfo->pQueueCreateInfos[i];
|
||||||
uint32_t qfi = queue_create->queueFamilyIndex;
|
uint32_t qfi = queue_create->queueFamilyIndex;
|
||||||
device->queues[qfi] = vk_alloc(
|
device->queues[qfi] = vk_alloc(
|
||||||
&device->alloc, queue_create->queueCount * sizeof(struct tu_queue),
|
&device->vk.alloc, queue_create->queueCount * sizeof(struct tu_queue),
|
||||||
8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||||
if (!device->queues[qfi]) {
|
if (!device->queues[qfi]) {
|
||||||
result = VK_ERROR_OUT_OF_HOST_MEMORY;
|
result = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
@@ -1314,10 +1318,10 @@ fail_queues:
|
|||||||
for (unsigned q = 0; q < device->queue_count[i]; q++)
|
for (unsigned q = 0; q < device->queue_count[i]; q++)
|
||||||
tu_queue_finish(&device->queues[i][q]);
|
tu_queue_finish(&device->queues[i][q]);
|
||||||
if (device->queue_count[i])
|
if (device->queue_count[i])
|
||||||
vk_free(&device->alloc, device->queues[i]);
|
vk_object_free(&device->vk, NULL, device->queues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk_free(&device->alloc, device);
|
vk_free(&device->vk.alloc, device);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1333,7 +1337,7 @@ tu_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
|
|||||||
for (unsigned q = 0; q < device->queue_count[i]; q++)
|
for (unsigned q = 0; q < device->queue_count[i]; q++)
|
||||||
tu_queue_finish(&device->queues[i][q]);
|
tu_queue_finish(&device->queues[i][q]);
|
||||||
if (device->queue_count[i])
|
if (device->queue_count[i])
|
||||||
vk_free(&device->alloc, device->queues[i]);
|
vk_object_free(&device->vk, NULL, device->queues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < ARRAY_SIZE(device->scratch_bos); i++) {
|
for (unsigned i = 0; i < ARRAY_SIZE(device->scratch_bos); i++) {
|
||||||
@@ -1346,7 +1350,7 @@ tu_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
|
|||||||
VkPipelineCache pc = tu_pipeline_cache_to_handle(device->mem_cache);
|
VkPipelineCache pc = tu_pipeline_cache_to_handle(device->mem_cache);
|
||||||
tu_DestroyPipelineCache(tu_device_to_handle(device), pc, NULL);
|
tu_DestroyPipelineCache(tu_device_to_handle(device), pc, NULL);
|
||||||
|
|
||||||
vk_free(&device->alloc, device);
|
vk_free(&device->vk.alloc, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -1774,8 +1778,8 @@ tu_alloc_memory(struct tu_device *device,
|
|||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
|
mem = vk_object_alloc(&device->vk, pAllocator, sizeof(*mem),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_DEVICE_MEMORY);
|
||||||
if (mem == NULL)
|
if (mem == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -1807,7 +1811,7 @@ tu_alloc_memory(struct tu_device *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
vk_free2(&device->alloc, pAllocator, mem);
|
vk_object_free(&device->vk, pAllocator, mem);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1844,7 +1848,7 @@ tu_FreeMemory(VkDevice _device,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tu_bo_finish(device, &mem->bo);
|
tu_bo_finish(device, &mem->bo);
|
||||||
vk_free2(&device->alloc, pAllocator, mem);
|
vk_object_free(&device->vk, pAllocator, mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -2092,8 +2096,8 @@ tu_CreateSemaphore(VkDevice _device,
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
|
|
||||||
struct tu_semaphore *sem =
|
struct tu_semaphore *sem =
|
||||||
vk_alloc2(&device->alloc, pAllocator, sizeof(*sem), 8,
|
vk_object_alloc(&device->vk, pAllocator, sizeof(*sem),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_SEMAPHORE);
|
||||||
if (!sem)
|
if (!sem)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -2107,7 +2111,7 @@ tu_CreateSemaphore(VkDevice _device,
|
|||||||
|
|
||||||
if (handleTypes) {
|
if (handleTypes) {
|
||||||
if (drmSyncobjCreate(device->physical_device->local_fd, 0, &sem->permanent.syncobj) < 0) {
|
if (drmSyncobjCreate(device->physical_device->local_fd, 0, &sem->permanent.syncobj) < 0) {
|
||||||
vk_free2(&device->alloc, pAllocator, sem);
|
vk_free2(&device->vk.alloc, pAllocator, sem);
|
||||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
}
|
}
|
||||||
sem->permanent.kind = TU_SEMAPHORE_SYNCOBJ;
|
sem->permanent.kind = TU_SEMAPHORE_SYNCOBJ;
|
||||||
@@ -2129,7 +2133,7 @@ tu_DestroySemaphore(VkDevice _device,
|
|||||||
tu_semaphore_part_destroy(device, &sem->permanent);
|
tu_semaphore_part_destroy(device, &sem->permanent);
|
||||||
tu_semaphore_part_destroy(device, &sem->temporary);
|
tu_semaphore_part_destroy(device, &sem->temporary);
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, sem);
|
vk_object_free(&device->vk, pAllocator, sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -2139,10 +2143,10 @@ tu_CreateEvent(VkDevice _device,
|
|||||||
VkEvent *pEvent)
|
VkEvent *pEvent)
|
||||||
{
|
{
|
||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
struct tu_event *event =
|
|
||||||
vk_alloc2(&device->alloc, pAllocator, sizeof(*event), 8,
|
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
|
||||||
|
|
||||||
|
struct tu_event *event =
|
||||||
|
vk_object_alloc(&device->vk, pAllocator, sizeof(*event),
|
||||||
|
VK_OBJECT_TYPE_EVENT);
|
||||||
if (!event)
|
if (!event)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -2161,7 +2165,7 @@ tu_CreateEvent(VkDevice _device,
|
|||||||
fail_map:
|
fail_map:
|
||||||
tu_bo_finish(device, &event->bo);
|
tu_bo_finish(device, &event->bo);
|
||||||
fail_alloc:
|
fail_alloc:
|
||||||
vk_free2(&device->alloc, pAllocator, event);
|
vk_object_free(&device->vk, pAllocator, event);
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2177,7 +2181,7 @@ tu_DestroyEvent(VkDevice _device,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tu_bo_finish(device, &event->bo);
|
tu_bo_finish(device, &event->bo);
|
||||||
vk_free2(&device->alloc, pAllocator, event);
|
vk_object_free(&device->vk, pAllocator, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -2219,8 +2223,8 @@ tu_CreateBuffer(VkDevice _device,
|
|||||||
|
|
||||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
|
||||||
|
|
||||||
buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
|
buffer = vk_object_alloc(&device->vk, pAllocator, sizeof(*buffer),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_BUFFER);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -2244,7 +2248,7 @@ tu_DestroyBuffer(VkDevice _device,
|
|||||||
if (!buffer)
|
if (!buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, buffer);
|
vk_object_free(&device->vk, pAllocator, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -2261,8 +2265,8 @@ tu_CreateFramebuffer(VkDevice _device,
|
|||||||
|
|
||||||
size_t size = sizeof(*framebuffer) + sizeof(struct tu_attachment_info) *
|
size_t size = sizeof(*framebuffer) + sizeof(struct tu_attachment_info) *
|
||||||
pCreateInfo->attachmentCount;
|
pCreateInfo->attachmentCount;
|
||||||
framebuffer = vk_alloc2(&device->alloc, pAllocator, size, 8,
|
framebuffer = vk_object_alloc(&device->vk, pAllocator, size,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_FRAMEBUFFER);
|
||||||
if (framebuffer == NULL)
|
if (framebuffer == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -2292,7 +2296,8 @@ tu_DestroyFramebuffer(VkDevice _device,
|
|||||||
|
|
||||||
if (!fb)
|
if (!fb)
|
||||||
return;
|
return;
|
||||||
vk_free2(&device->alloc, pAllocator, fb);
|
|
||||||
|
vk_object_free(&device->vk, pAllocator, fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2365,8 +2370,8 @@ tu_CreateSampler(VkDevice _device,
|
|||||||
|
|
||||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
|
||||||
|
|
||||||
sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,
|
sampler = vk_object_alloc(&device->vk, pAllocator, sizeof(*sampler),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_SAMPLER);
|
||||||
if (!sampler)
|
if (!sampler)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -2386,7 +2391,8 @@ tu_DestroySampler(VkDevice _device,
|
|||||||
|
|
||||||
if (!sampler)
|
if (!sampler)
|
||||||
return;
|
return;
|
||||||
vk_free2(&device->alloc, pAllocator, sampler);
|
|
||||||
|
vk_object_free(&device->vk, pAllocator, sampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vk_icd.h does not declare this function, so we declare it here to
|
/* vk_icd.h does not declare this function, so we declare it here to
|
||||||
|
@@ -170,9 +170,8 @@ tu_CreateFence(VkDevice _device,
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
|
|
||||||
struct tu_fence *fence =
|
struct tu_fence *fence =
|
||||||
vk_alloc2(&device->alloc, pAllocator, sizeof(*fence), 8,
|
vk_object_alloc(&device->vk, pAllocator, sizeof(*fence),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_FENCE);
|
||||||
|
|
||||||
if (!fence)
|
if (!fence)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -196,7 +195,7 @@ tu_DestroyFence(VkDevice _device,
|
|||||||
|
|
||||||
tu_fence_finish(fence);
|
tu_fence_finish(fence);
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, fence);
|
vk_object_free(&device->vk, pAllocator, fence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -344,7 +343,7 @@ tu_WaitForFences(VkDevice _device,
|
|||||||
struct pollfd stack_fds[8];
|
struct pollfd stack_fds[8];
|
||||||
struct pollfd *fds = stack_fds;
|
struct pollfd *fds = stack_fds;
|
||||||
if (fenceCount > ARRAY_SIZE(stack_fds)) {
|
if (fenceCount > ARRAY_SIZE(stack_fds)) {
|
||||||
fds = vk_alloc(&device->alloc, sizeof(*fds) * fenceCount, 8,
|
fds = vk_alloc(&device->vk.alloc, sizeof(*fds) * fenceCount, 8,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||||
if (!fds)
|
if (!fds)
|
||||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
@@ -362,7 +361,7 @@ tu_WaitForFences(VkDevice _device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fds != stack_fds)
|
if (fds != stack_fds)
|
||||||
vk_free(&device->alloc, fds);
|
vk_free(&device->vk.alloc, fds);
|
||||||
|
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
@@ -95,8 +95,8 @@ tu_image_create(VkDevice _device,
|
|||||||
assert(pCreateInfo->extent.height > 0);
|
assert(pCreateInfo->extent.height > 0);
|
||||||
assert(pCreateInfo->extent.depth > 0);
|
assert(pCreateInfo->extent.depth > 0);
|
||||||
|
|
||||||
image = vk_zalloc2(&device->alloc, alloc, sizeof(*image), 8,
|
image = vk_object_zalloc(&device->vk, alloc, sizeof(*image),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_IMAGE);
|
||||||
if (!image)
|
if (!image)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ tu_image_create(VkDevice _device,
|
|||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
|
||||||
invalid_layout:
|
invalid_layout:
|
||||||
vk_free2(&device->alloc, alloc, image);
|
vk_object_free(&device->vk, alloc, image);
|
||||||
return vk_error(device->instance, VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT);
|
return vk_error(device->instance, VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,7 +667,7 @@ tu_DestroyImage(VkDevice _device,
|
|||||||
if (image->owned_memory != VK_NULL_HANDLE)
|
if (image->owned_memory != VK_NULL_HANDLE)
|
||||||
tu_FreeMemory(_device, image->owned_memory, pAllocator);
|
tu_FreeMemory(_device, image->owned_memory, pAllocator);
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, image);
|
vk_object_free(&device->vk, pAllocator, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -729,8 +729,8 @@ tu_CreateImageView(VkDevice _device,
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
struct tu_image_view *view;
|
struct tu_image_view *view;
|
||||||
|
|
||||||
view = vk_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
|
view = vk_object_alloc(&device->vk, pAllocator, sizeof(*view),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_IMAGE_VIEW);
|
||||||
if (view == NULL)
|
if (view == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -751,7 +751,8 @@ tu_DestroyImageView(VkDevice _device,
|
|||||||
|
|
||||||
if (!iview)
|
if (!iview)
|
||||||
return;
|
return;
|
||||||
vk_free2(&device->alloc, pAllocator, iview);
|
|
||||||
|
vk_object_free(&device->vk, pAllocator, iview);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -811,8 +812,8 @@ tu_CreateBufferView(VkDevice _device,
|
|||||||
TU_FROM_HANDLE(tu_device, device, _device);
|
TU_FROM_HANDLE(tu_device, device, _device);
|
||||||
struct tu_buffer_view *view;
|
struct tu_buffer_view *view;
|
||||||
|
|
||||||
view = vk_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
|
view = vk_object_alloc(&device->vk, pAllocator, sizeof(*view),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_BUFFER_VIEW);
|
||||||
if (!view)
|
if (!view)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -834,5 +835,5 @@ tu_DestroyBufferView(VkDevice _device,
|
|||||||
if (!view)
|
if (!view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, view);
|
vk_object_free(&device->vk, pAllocator, view);
|
||||||
}
|
}
|
||||||
|
@@ -533,8 +533,8 @@ tu_CreateRenderPass2(VkDevice _device,
|
|||||||
attachments_offset = size;
|
attachments_offset = size;
|
||||||
size += pCreateInfo->attachmentCount * sizeof(pass->attachments[0]);
|
size += pCreateInfo->attachmentCount * sizeof(pass->attachments[0]);
|
||||||
|
|
||||||
pass = vk_zalloc2(&device->alloc, pAllocator, size, 8,
|
pass = vk_object_zalloc(&device->vk, pAllocator, size,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_RENDER_PASS);
|
||||||
if (pass == NULL)
|
if (pass == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -568,11 +568,11 @@ tu_CreateRenderPass2(VkDevice _device,
|
|||||||
|
|
||||||
if (subpass_attachment_count) {
|
if (subpass_attachment_count) {
|
||||||
pass->subpass_attachments = vk_alloc2(
|
pass->subpass_attachments = vk_alloc2(
|
||||||
&device->alloc, pAllocator,
|
&device->vk.alloc, pAllocator,
|
||||||
subpass_attachment_count * sizeof(struct tu_subpass_attachment), 8,
|
subpass_attachment_count * sizeof(struct tu_subpass_attachment), 8,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||||
if (pass->subpass_attachments == NULL) {
|
if (pass->subpass_attachments == NULL) {
|
||||||
vk_free2(&device->alloc, pAllocator, pass);
|
vk_object_free(&device->vk, pAllocator, pass);
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -672,8 +672,8 @@ tu_DestroyRenderPass(VkDevice _device,
|
|||||||
if (!_pass)
|
if (!_pass)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, pass->subpass_attachments);
|
vk_free2(&device->vk.alloc, pAllocator, pass->subpass_attachments);
|
||||||
vk_free2(&device->alloc, pAllocator, pass);
|
vk_object_free(&device->vk, pAllocator, pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -2396,9 +2396,8 @@ tu_pipeline_builder_build(struct tu_pipeline_builder *builder,
|
|||||||
{
|
{
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
*pipeline =
|
*pipeline = vk_object_zalloc(&builder->device->vk, builder->alloc,
|
||||||
vk_zalloc2(&builder->device->alloc, builder->alloc, sizeof(**pipeline),
|
sizeof(**pipeline), VK_OBJECT_TYPE_PIPELINE);
|
||||||
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
|
||||||
if (!*pipeline)
|
if (!*pipeline)
|
||||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
|
|
||||||
@@ -2407,13 +2406,13 @@ tu_pipeline_builder_build(struct tu_pipeline_builder *builder,
|
|||||||
/* compile and upload shaders */
|
/* compile and upload shaders */
|
||||||
result = tu_pipeline_builder_compile_shaders(builder, *pipeline);
|
result = tu_pipeline_builder_compile_shaders(builder, *pipeline);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
vk_free2(&builder->device->alloc, builder->alloc, *pipeline);
|
vk_object_free(&builder->device->vk, builder->alloc, *pipeline);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = tu_pipeline_allocate_cs(builder->device, *pipeline, builder, NULL);
|
result = tu_pipeline_allocate_cs(builder->device, *pipeline, builder, NULL);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
vk_free2(&builder->device->alloc, builder->alloc, *pipeline);
|
vk_object_free(&builder->device->vk, builder->alloc, *pipeline);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2575,9 +2574,8 @@ tu_compute_pipeline_create(VkDevice device,
|
|||||||
|
|
||||||
*pPipeline = VK_NULL_HANDLE;
|
*pPipeline = VK_NULL_HANDLE;
|
||||||
|
|
||||||
pipeline =
|
pipeline = vk_object_zalloc(&dev->vk, pAllocator, sizeof(*pipeline),
|
||||||
vk_zalloc2(&dev->alloc, pAllocator, sizeof(*pipeline), 8,
|
VK_OBJECT_TYPE_PIPELINE);
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
|
||||||
if (!pipeline)
|
if (!pipeline)
|
||||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
|
|
||||||
@@ -2628,7 +2626,7 @@ fail:
|
|||||||
if (shader)
|
if (shader)
|
||||||
tu_shader_destroy(dev, shader, pAllocator);
|
tu_shader_destroy(dev, shader, pAllocator);
|
||||||
|
|
||||||
vk_free2(&dev->alloc, pAllocator, pipeline);
|
vk_object_free(&dev->vk, pAllocator, pipeline);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2666,5 +2664,5 @@ tu_DestroyPipeline(VkDevice _device,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tu_pipeline_finish(pipeline, dev, pAllocator);
|
tu_pipeline_finish(pipeline, dev, pAllocator);
|
||||||
vk_free2(&dev->alloc, pAllocator, pipeline);
|
vk_object_free(&dev->vk, pAllocator, pipeline);
|
||||||
}
|
}
|
||||||
|
@@ -262,15 +262,15 @@ tu_CreatePipelineCache(VkDevice _device,
|
|||||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
|
||||||
assert(pCreateInfo->flags == 0);
|
assert(pCreateInfo->flags == 0);
|
||||||
|
|
||||||
cache = vk_alloc2(&device->alloc, pAllocator, sizeof(*cache), 8,
|
cache = vk_object_alloc(&device->vk, pAllocator, sizeof(*cache),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_PIPELINE_CACHE);
|
||||||
if (cache == NULL)
|
if (cache == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
if (pAllocator)
|
if (pAllocator)
|
||||||
cache->alloc = *pAllocator;
|
cache->alloc = *pAllocator;
|
||||||
else
|
else
|
||||||
cache->alloc = device->alloc;
|
cache->alloc = device->vk.alloc;
|
||||||
|
|
||||||
tu_pipeline_cache_init(cache, device);
|
tu_pipeline_cache_init(cache, device);
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ tu_DestroyPipelineCache(VkDevice _device,
|
|||||||
return;
|
return;
|
||||||
tu_pipeline_cache_finish(cache);
|
tu_pipeline_cache_finish(cache);
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, cache);
|
vk_object_free(&device->vk, pAllocator, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
#include "util/macros.h"
|
#include "util/macros.h"
|
||||||
#include "util/u_atomic.h"
|
#include "util/u_atomic.h"
|
||||||
#include "vk_alloc.h"
|
#include "vk_alloc.h"
|
||||||
|
#include "vk_object.h"
|
||||||
#include "vk_debug_report.h"
|
#include "vk_debug_report.h"
|
||||||
#include "wsi_common.h"
|
#include "wsi_common.h"
|
||||||
|
|
||||||
@@ -189,7 +190,7 @@ tu_lookup_entrypoint_checked(
|
|||||||
|
|
||||||
struct tu_physical_device
|
struct tu_physical_device
|
||||||
{
|
{
|
||||||
VK_LOADER_DATA _loader_data;
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_instance *instance;
|
struct tu_instance *instance;
|
||||||
|
|
||||||
@@ -245,7 +246,7 @@ enum tu_debug_flags
|
|||||||
|
|
||||||
struct tu_instance
|
struct tu_instance
|
||||||
{
|
{
|
||||||
VK_LOADER_DATA _loader_data;
|
struct vk_object_base base;
|
||||||
|
|
||||||
VkAllocationCallbacks alloc;
|
VkAllocationCallbacks alloc;
|
||||||
|
|
||||||
@@ -277,6 +278,8 @@ struct cache_entry;
|
|||||||
|
|
||||||
struct tu_pipeline_cache
|
struct tu_pipeline_cache
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_device *device;
|
struct tu_device *device;
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
|
|
||||||
@@ -301,6 +304,7 @@ struct tu_pipeline_key
|
|||||||
|
|
||||||
struct tu_fence
|
struct tu_fence
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
struct wsi_fence *fence_wsi;
|
struct wsi_fence *fence_wsi;
|
||||||
bool signaled;
|
bool signaled;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -321,7 +325,8 @@ tu_fence_wait_idle(struct tu_fence *fence);
|
|||||||
|
|
||||||
struct tu_queue
|
struct tu_queue
|
||||||
{
|
{
|
||||||
VK_LOADER_DATA _loader_data;
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_device *device;
|
struct tu_device *device;
|
||||||
uint32_t queue_family_index;
|
uint32_t queue_family_index;
|
||||||
int queue_idx;
|
int queue_idx;
|
||||||
@@ -381,10 +386,7 @@ void tu_init_clear_blit_shaders(struct tu6_global *global);
|
|||||||
|
|
||||||
struct tu_device
|
struct tu_device
|
||||||
{
|
{
|
||||||
VK_LOADER_DATA _loader_data;
|
struct vk_device vk;
|
||||||
|
|
||||||
VkAllocationCallbacks alloc;
|
|
||||||
|
|
||||||
struct tu_instance *instance;
|
struct tu_instance *instance;
|
||||||
|
|
||||||
struct tu_queue *queues[TU_MAX_QUEUE_FAMILIES];
|
struct tu_queue *queues[TU_MAX_QUEUE_FAMILIES];
|
||||||
@@ -565,6 +567,8 @@ struct tu_cs
|
|||||||
|
|
||||||
struct tu_device_memory
|
struct tu_device_memory
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_bo bo;
|
struct tu_bo bo;
|
||||||
VkDeviceSize size;
|
VkDeviceSize size;
|
||||||
|
|
||||||
@@ -585,6 +589,8 @@ struct tu_descriptor_range
|
|||||||
|
|
||||||
struct tu_descriptor_set
|
struct tu_descriptor_set
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
const struct tu_descriptor_set_layout *layout;
|
const struct tu_descriptor_set_layout *layout;
|
||||||
struct tu_descriptor_pool *pool;
|
struct tu_descriptor_pool *pool;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
@@ -612,6 +618,8 @@ struct tu_descriptor_pool_entry
|
|||||||
|
|
||||||
struct tu_descriptor_pool
|
struct tu_descriptor_pool
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_bo bo;
|
struct tu_bo bo;
|
||||||
uint64_t current_offset;
|
uint64_t current_offset;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
@@ -654,12 +662,16 @@ struct tu_descriptor_update_template_entry
|
|||||||
|
|
||||||
struct tu_descriptor_update_template
|
struct tu_descriptor_update_template
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
uint32_t entry_count;
|
uint32_t entry_count;
|
||||||
struct tu_descriptor_update_template_entry entry[0];
|
struct tu_descriptor_update_template_entry entry[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tu_buffer
|
struct tu_buffer
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
VkDeviceSize size;
|
VkDeviceSize size;
|
||||||
|
|
||||||
VkBufferUsageFlags usage;
|
VkBufferUsageFlags usage;
|
||||||
@@ -877,6 +889,8 @@ struct tu_cmd_state
|
|||||||
|
|
||||||
struct tu_cmd_pool
|
struct tu_cmd_pool
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
VkAllocationCallbacks alloc;
|
VkAllocationCallbacks alloc;
|
||||||
struct list_head cmd_buffers;
|
struct list_head cmd_buffers;
|
||||||
struct list_head free_cmd_buffers;
|
struct list_head free_cmd_buffers;
|
||||||
@@ -924,7 +938,7 @@ tu_bo_list_merge(struct tu_bo_list *list, const struct tu_bo_list *other);
|
|||||||
|
|
||||||
struct tu_cmd_buffer
|
struct tu_cmd_buffer
|
||||||
{
|
{
|
||||||
VK_LOADER_DATA _loader_data;
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_device *device;
|
struct tu_device *device;
|
||||||
|
|
||||||
@@ -997,11 +1011,14 @@ tu_get_descriptors_state(struct tu_cmd_buffer *cmd_buffer,
|
|||||||
|
|
||||||
struct tu_event
|
struct tu_event
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
struct tu_bo bo;
|
struct tu_bo bo;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tu_shader_module
|
struct tu_shader_module
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
|
|
||||||
uint32_t code_size;
|
uint32_t code_size;
|
||||||
@@ -1045,6 +1062,8 @@ struct tu_program_descriptor_linkage
|
|||||||
|
|
||||||
struct tu_pipeline
|
struct tu_pipeline
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_cs cs;
|
struct tu_cs cs;
|
||||||
|
|
||||||
struct tu_pipeline_layout *layout;
|
struct tu_pipeline_layout *layout;
|
||||||
@@ -1222,6 +1241,8 @@ tu6_base_format(VkFormat format)
|
|||||||
|
|
||||||
struct tu_image
|
struct tu_image
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
VkImageType type;
|
VkImageType type;
|
||||||
/* The original VkFormat provided by the client. This may not match any
|
/* The original VkFormat provided by the client. This may not match any
|
||||||
* of the actual surface formats.
|
* of the actual surface formats.
|
||||||
@@ -1271,6 +1292,8 @@ tu_get_levelCount(const struct tu_image *image,
|
|||||||
|
|
||||||
struct tu_image_view
|
struct tu_image_view
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_image *image; /**< VkImageViewCreateInfo::image */
|
struct tu_image *image; /**< VkImageViewCreateInfo::image */
|
||||||
|
|
||||||
uint64_t base_addr;
|
uint64_t base_addr;
|
||||||
@@ -1307,6 +1330,8 @@ struct tu_image_view
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct tu_sampler_ycbcr_conversion {
|
struct tu_sampler_ycbcr_conversion {
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
VkFormat format;
|
VkFormat format;
|
||||||
VkSamplerYcbcrModelConversion ycbcr_model;
|
VkSamplerYcbcrModelConversion ycbcr_model;
|
||||||
VkSamplerYcbcrRange ycbcr_range;
|
VkSamplerYcbcrRange ycbcr_range;
|
||||||
@@ -1316,6 +1341,8 @@ struct tu_sampler_ycbcr_conversion {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct tu_sampler {
|
struct tu_sampler {
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
uint32_t descriptor[A6XX_TEX_SAMP_DWORDS];
|
uint32_t descriptor[A6XX_TEX_SAMP_DWORDS];
|
||||||
struct tu_sampler_ycbcr_conversion *ycbcr_sampler;
|
struct tu_sampler_ycbcr_conversion *ycbcr_sampler;
|
||||||
};
|
};
|
||||||
@@ -1350,6 +1377,8 @@ tu_image_view_init(struct tu_image_view *view,
|
|||||||
|
|
||||||
struct tu_buffer_view
|
struct tu_buffer_view
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
uint32_t descriptor[A6XX_TEX_CONST_DWORDS];
|
uint32_t descriptor[A6XX_TEX_CONST_DWORDS];
|
||||||
|
|
||||||
struct tu_buffer *buffer;
|
struct tu_buffer *buffer;
|
||||||
@@ -1366,6 +1395,8 @@ struct tu_attachment_info
|
|||||||
|
|
||||||
struct tu_framebuffer
|
struct tu_framebuffer
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
uint32_t height;
|
uint32_t height;
|
||||||
uint32_t layers;
|
uint32_t layers;
|
||||||
@@ -1434,6 +1465,8 @@ struct tu_render_pass_attachment
|
|||||||
|
|
||||||
struct tu_render_pass
|
struct tu_render_pass
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
uint32_t attachment_count;
|
uint32_t attachment_count;
|
||||||
uint32_t subpass_count;
|
uint32_t subpass_count;
|
||||||
uint32_t gmem_pixels;
|
uint32_t gmem_pixels;
|
||||||
@@ -1446,6 +1479,8 @@ struct tu_render_pass
|
|||||||
|
|
||||||
struct tu_query_pool
|
struct tu_query_pool
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
VkQueryType type;
|
VkQueryType type;
|
||||||
uint32_t stride;
|
uint32_t stride;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
@@ -1469,6 +1504,8 @@ struct tu_semaphore_part
|
|||||||
|
|
||||||
struct tu_semaphore
|
struct tu_semaphore
|
||||||
{
|
{
|
||||||
|
struct vk_object_base base;
|
||||||
|
|
||||||
struct tu_semaphore_part permanent;
|
struct tu_semaphore_part permanent;
|
||||||
struct tu_semaphore_part temporary;
|
struct tu_semaphore_part temporary;
|
||||||
};
|
};
|
||||||
|
@@ -129,23 +129,22 @@ tu_CreateQueryPool(VkDevice _device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct tu_query_pool *pool =
|
struct tu_query_pool *pool =
|
||||||
vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
|
vk_object_alloc(&device->vk, pAllocator, sizeof(*pool),
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_QUERY_POOL);
|
||||||
|
|
||||||
if (!pool)
|
if (!pool)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
VkResult result = tu_bo_init_new(device, &pool->bo,
|
VkResult result = tu_bo_init_new(device, &pool->bo,
|
||||||
pCreateInfo->queryCount * slot_size);
|
pCreateInfo->queryCount * slot_size);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
vk_free2(&device->alloc, pAllocator, pool);
|
vk_object_free(&device->vk, pAllocator, pool);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = tu_bo_map(device, &pool->bo);
|
result = tu_bo_map(device, &pool->bo);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
tu_bo_finish(device, &pool->bo);
|
tu_bo_finish(device, &pool->bo);
|
||||||
vk_free2(&device->alloc, pAllocator, pool);
|
vk_object_free(&device->vk, pAllocator, pool);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +172,7 @@ tu_DestroyQueryPool(VkDevice _device,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tu_bo_finish(device, &pool->bo);
|
tu_bo_finish(device, &pool->bo);
|
||||||
vk_free2(&device->alloc, pAllocator, pool);
|
vk_object_free(&device->vk, pAllocator, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
|
@@ -673,7 +673,7 @@ tu_shader_create(struct tu_device *dev,
|
|||||||
struct tu_shader *shader;
|
struct tu_shader *shader;
|
||||||
|
|
||||||
shader = vk_zalloc2(
|
shader = vk_zalloc2(
|
||||||
&dev->alloc, alloc,
|
&dev->vk.alloc, alloc,
|
||||||
sizeof(*shader),
|
sizeof(*shader),
|
||||||
8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||||
if (!shader)
|
if (!shader)
|
||||||
@@ -699,7 +699,7 @@ tu_shader_create(struct tu_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!nir) {
|
if (!nir) {
|
||||||
vk_free2(&dev->alloc, alloc, shader);
|
vk_free2(&dev->vk.alloc, alloc, shader);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,7 +804,7 @@ tu_shader_destroy(struct tu_device *dev,
|
|||||||
{
|
{
|
||||||
ir3_shader_destroy(shader->ir3_shader);
|
ir3_shader_destroy(shader->ir3_shader);
|
||||||
|
|
||||||
vk_free2(&dev->alloc, alloc, shader);
|
vk_free2(&dev->vk.alloc, alloc, shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -820,9 +820,9 @@ tu_CreateShaderModule(VkDevice _device,
|
|||||||
assert(pCreateInfo->flags == 0);
|
assert(pCreateInfo->flags == 0);
|
||||||
assert(pCreateInfo->codeSize % 4 == 0);
|
assert(pCreateInfo->codeSize % 4 == 0);
|
||||||
|
|
||||||
module = vk_alloc2(&device->alloc, pAllocator,
|
module = vk_object_alloc(&device->vk, pAllocator,
|
||||||
sizeof(*module) + pCreateInfo->codeSize, 8,
|
sizeof(*module) + pCreateInfo->codeSize,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_OBJECT_TYPE_SHADER_MODULE);
|
||||||
if (module == NULL)
|
if (module == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
@@ -847,5 +847,5 @@ tu_DestroyShaderModule(VkDevice _device,
|
|||||||
if (!module)
|
if (!module)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vk_free2(&device->alloc, pAllocator, module);
|
vk_object_free(&device->vk, pAllocator, module);
|
||||||
}
|
}
|
||||||
|
@@ -168,7 +168,7 @@ tu_CreateSwapchainKHR(VkDevice _device,
|
|||||||
if (pAllocator)
|
if (pAllocator)
|
||||||
alloc = pAllocator;
|
alloc = pAllocator;
|
||||||
else
|
else
|
||||||
alloc = &device->alloc;
|
alloc = &device->vk.alloc;
|
||||||
|
|
||||||
return wsi_common_create_swapchain(&device->physical_device->wsi_device,
|
return wsi_common_create_swapchain(&device->physical_device->wsi_device,
|
||||||
tu_device_to_handle(device),
|
tu_device_to_handle(device),
|
||||||
@@ -186,7 +186,7 @@ tu_DestroySwapchainKHR(VkDevice _device,
|
|||||||
if (pAllocator)
|
if (pAllocator)
|
||||||
alloc = pAllocator;
|
alloc = pAllocator;
|
||||||
else
|
else
|
||||||
alloc = &device->alloc;
|
alloc = &device->vk.alloc;
|
||||||
|
|
||||||
wsi_common_destroy_swapchain(_device, swapchain, alloc);
|
wsi_common_destroy_swapchain(_device, swapchain, alloc);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user