aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2020-04-29 14:57:20 +0200
committerSamuel Pitoiset <[email protected]>2020-05-13 08:23:23 +0200
commit178adfa6a8e5694a077c3e11fdcc5bc0802839ab (patch)
treef0824454312a0d167f7306436a964fc88df6d3fd
parent65458528fc169ab80c99cb115bc6f86ae7b43d12 (diff)
radv: use the base object struct types
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4886>
-rw-r--r--src/amd/vulkan/radv_cmd_buffer.c11
-rw-r--r--src/amd/vulkan/radv_descriptor_set.c33
-rw-r--r--src/amd/vulkan/radv_descriptor_set.h5
-rw-r--r--src/amd/vulkan/radv_device.c29
-rw-r--r--src/amd/vulkan/radv_image.c12
-rw-r--r--src/amd/vulkan/radv_pass.c10
-rw-r--r--src/amd/vulkan/radv_pipeline.c8
-rw-r--r--src/amd/vulkan/radv_pipeline_cache.c4
-rw-r--r--src/amd/vulkan/radv_private.h23
-rw-r--r--src/amd/vulkan/radv_query.c4
-rw-r--r--src/amd/vulkan/radv_shader.c4
-rw-r--r--src/amd/vulkan/radv_shader.h2
12 files changed, 138 insertions, 7 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index a5846460455..896bb63b08c 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -277,7 +277,9 @@ static VkResult radv_create_cmd_buffer(
if (cmd_buffer == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
- cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
+ vk_object_base_init(&device->vk, &cmd_buffer->base,
+ VK_OBJECT_TYPE_COMMAND_BUFFER);
+
cmd_buffer->device = device;
cmd_buffer->pool = pool;
cmd_buffer->level = level;
@@ -328,6 +330,8 @@ radv_cmd_buffer_destroy(struct radv_cmd_buffer *cmd_buffer)
for (unsigned i = 0; i < MAX_BIND_POINTS; i++)
free(cmd_buffer->descriptors[i].push_set.set.mapped_ptr);
+ vk_object_base_finish(&cmd_buffer->base);
+
vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
}
@@ -3318,7 +3322,6 @@ VkResult radv_AllocateCommandBuffers(
list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
result = radv_reset_cmd_buffer(cmd_buffer);
- cmd_buffer->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
cmd_buffer->level = pAllocateInfo->level;
pCommandBuffers[i] = radv_cmd_buffer_to_handle(cmd_buffer);
@@ -4261,6 +4264,9 @@ VkResult radv_CreateCommandPool(
if (pool == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &pool->base,
+ VK_OBJECT_TYPE_COMMAND_POOL);
+
if (pAllocator)
pool->alloc = *pAllocator;
else
@@ -4298,6 +4304,7 @@ void radv_DestroyCommandPool(
radv_cmd_buffer_destroy(cmd_buffer);
}
+ vk_object_base_finish(&pool->base);
vk_free2(&device->vk.alloc, pAllocator, pool);
}
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index f537a89db40..8d1343d2d8b 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -114,6 +114,9 @@ VkResult radv_CreateDescriptorSetLayout(
if (!set_layout)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &set_layout->base,
+ VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
+
set_layout->flags = pCreateInfo->flags;
set_layout->layout_size = size;
@@ -132,6 +135,7 @@ VkResult radv_CreateDescriptorSetLayout(
VkDescriptorSetLayoutBinding *bindings = create_sorted_bindings(pCreateInfo->pBindings,
pCreateInfo->bindingCount);
if (!bindings) {
+ vk_object_base_finish(&set_layout->base);
vk_free2(&device->vk.alloc, pAllocator, set_layout);
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
}
@@ -295,6 +299,7 @@ void radv_DestroyDescriptorSetLayout(
if (!set_layout)
return;
+ vk_object_base_finish(&set_layout->base);
vk_free2(&device->vk.alloc, pAllocator, set_layout);
}
@@ -413,6 +418,9 @@ VkResult radv_CreatePipelineLayout(
if (layout == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &layout->base,
+ VK_OBJECT_TYPE_PIPELINE_LAYOUT);
+
layout->num_sets = pCreateInfo->setLayoutCount;
unsigned dynamic_offset_count = 0;
@@ -462,6 +470,8 @@ void radv_DestroyPipelineLayout(
if (!pipeline_layout)
return;
+
+ vk_object_base_finish(&pipeline_layout->base);
vk_free2(&device->vk.alloc, pAllocator, pipeline_layout);
}
@@ -505,6 +515,9 @@ radv_descriptor_set_create(struct radv_device *device,
memset(set, 0, mem_size);
+ vk_object_base_init(&device->vk, &set->base,
+ VK_OBJECT_TYPE_DESCRIPTOR_SET);
+
if (layout->dynamic_offset_count) {
set->dynamic_descriptors = (struct radv_descriptor_range*)((uint8_t*)set + range_offset);
}
@@ -612,6 +625,7 @@ radv_descriptor_set_destroy(struct radv_device *device,
}
}
}
+ vk_object_base_finish(&set->base);
vk_free2(&device->vk.alloc, NULL, set);
}
@@ -691,6 +705,9 @@ VkResult radv_CreateDescriptorPool(
memset(pool, 0, sizeof(*pool));
+ vk_object_base_init(&device->vk, &pool->base,
+ VK_OBJECT_TYPE_DESCRIPTOR_POOL);
+
if (!(pCreateInfo->flags & VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT)) {
pool->host_memory_base = (uint8_t*)pool + sizeof(struct radv_descriptor_pool);
pool->host_memory_ptr = pool->host_memory_base;
@@ -732,6 +749,8 @@ void radv_DestroyDescriptorPool(
if (pool->bo)
device->ws->buffer_destroy(pool->bo);
+
+ vk_object_base_finish(&pool->base);
vk_free2(&device->vk.alloc, pAllocator, pool);
}
@@ -1183,6 +1202,9 @@ VkResult radv_CreateDescriptorUpdateTemplate(VkDevice _device,
if (!templ)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &templ->base,
+ VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE);
+
templ->entry_count = entry_count;
if (pCreateInfo->templateType == VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR) {
@@ -1266,6 +1288,7 @@ void radv_DestroyDescriptorUpdateTemplate(VkDevice _device,
if (!templ)
return;
+ vk_object_base_finish(&templ->base);
vk_free2(&device->vk.alloc, pAllocator, templ);
}
@@ -1368,6 +1391,9 @@ VkResult radv_CreateSamplerYcbcrConversion(VkDevice _device,
if (conversion == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &conversion->base,
+ VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION);
+
conversion->format = pCreateInfo->format;
conversion->ycbcr_model = pCreateInfo->ycbcrModel;
conversion->ycbcr_range = pCreateInfo->ycbcrRange;
@@ -1388,6 +1414,9 @@ void radv_DestroySamplerYcbcrConversion(VkDevice _device,
RADV_FROM_HANDLE(radv_device, device, _device);
RADV_FROM_HANDLE(radv_sampler_ycbcr_conversion, ycbcr_conversion, ycbcrConversion);
- if (ycbcr_conversion)
- vk_free2(&device->vk.alloc, pAllocator, ycbcr_conversion);
+ if (!ycbcr_conversion)
+ return;
+
+ vk_object_base_finish(&ycbcr_conversion->base);
+ vk_free2(&device->vk.alloc, pAllocator, ycbcr_conversion);
}
diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h
index 3397acaa092..ee213fbb6a0 100644
--- a/src/amd/vulkan/radv_descriptor_set.h
+++ b/src/amd/vulkan/radv_descriptor_set.h
@@ -26,6 +26,8 @@
#include "radv_constants.h"
+#include "vulkan/util/vk_object.h"
+
#include <vulkan/vulkan.h>
struct radv_descriptor_set_binding_layout {
@@ -49,6 +51,8 @@ struct radv_descriptor_set_binding_layout {
};
struct radv_descriptor_set_layout {
+ struct vk_object_base base;
+
/* The create flags for this descriptor set layout */
VkDescriptorSetLayoutCreateFlags flags;
@@ -81,6 +85,7 @@ struct radv_descriptor_set_layout {
};
struct radv_pipeline_layout {
+ struct vk_object_base base;
struct {
struct radv_descriptor_set_layout *layout;
uint32_t size;
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 803f344224a..c2a3223ea96 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -606,7 +606,7 @@ VkResult radv_CreateInstance(
if (!instance)
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)
instance->alloc = *pAllocator;
@@ -755,6 +755,7 @@ void radv_DestroyInstance(
vk_debug_report_instance_destroy(&instance->debug_report_callbacks);
+ vk_object_base_finish(&instance->base);
vk_free(&instance->alloc, instance);
}
@@ -5100,6 +5101,7 @@ static void radv_free_memory(struct radv_device *device,
mem->bo = NULL;
}
+ vk_object_base_finish(&mem->base);
vk_free2(&device->vk.alloc, pAllocator, mem);
}
@@ -5142,6 +5144,9 @@ static VkResult radv_alloc_memory(struct radv_device *device,
if (mem == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &mem->base,
+ VK_OBJECT_TYPE_DEVICE_MEMORY);
+
if (wsi_info && wsi_info->implicit_sync)
flags |= RADEON_FLAG_IMPLICIT_SYNC;
@@ -5601,6 +5606,8 @@ VkResult radv_CreateFence(
if (!fence)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &fence->base, VK_OBJECT_TYPE_FENCE);
+
fence->fence_wsi = NULL;
fence->temp_syncobj = 0;
if (device->always_use_syncobj || handleTypes) {
@@ -5648,6 +5655,8 @@ void radv_DestroyFence(
device->ws->destroy_fence(fence->fence);
if (fence->fence_wsi)
fence->fence_wsi->destroy(fence->fence_wsi);
+
+ vk_object_base_finish(&fence->base);
vk_free2(&device->vk.alloc, pAllocator, fence);
}
@@ -6066,6 +6075,9 @@ VkResult radv_CreateSemaphore(
if (!sem)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &sem->base,
+ VK_OBJECT_TYPE_SEMAPHORE);
+
sem->temporary.kind = RADV_SEMAPHORE_NONE;
sem->permanent.kind = RADV_SEMAPHORE_NONE;
@@ -6105,6 +6117,7 @@ void radv_DestroySemaphore(
radv_destroy_semaphore_part(device, &sem->temporary);
radv_destroy_semaphore_part(device, &sem->permanent);
+ vk_object_base_finish(&sem->base);
vk_free2(&device->vk.alloc, pAllocator, sem);
}
@@ -6226,6 +6239,8 @@ VkResult radv_CreateEvent(
if (!event)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &event->base, VK_OBJECT_TYPE_EVENT);
+
event->bo = device->ws->buffer_create(device->ws, 8, 8,
RADEON_DOMAIN_GTT,
RADEON_FLAG_VA_UNCACHED | RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING,
@@ -6253,6 +6268,7 @@ void radv_DestroyEvent(
if (!event)
return;
device->ws->buffer_destroy(event->bo);
+ vk_object_base_finish(&event->base);
vk_free2(&device->vk.alloc, pAllocator, event);
}
@@ -6306,6 +6322,8 @@ VkResult radv_CreateBuffer(
if (buffer == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &buffer->base, VK_OBJECT_TYPE_BUFFER);
+
buffer->size = pCreateInfo->size;
buffer->usage = pCreateInfo->usage;
buffer->bo = NULL;
@@ -6345,6 +6363,7 @@ void radv_DestroyBuffer(
if (buffer->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT)
device->ws->buffer_destroy(buffer->bo);
+ vk_object_base_finish(&buffer->base);
vk_free2(&device->vk.alloc, pAllocator, buffer);
}
@@ -6914,6 +6933,9 @@ VkResult radv_CreateFramebuffer(
if (framebuffer == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &framebuffer->base,
+ VK_OBJECT_TYPE_FRAMEBUFFER);
+
framebuffer->attachment_count = pCreateInfo->attachmentCount;
framebuffer->width = pCreateInfo->width;
framebuffer->height = pCreateInfo->height;
@@ -6951,6 +6973,7 @@ void radv_DestroyFramebuffer(
if (!fb)
return;
+ vk_object_base_finish(&fb->base);
vk_free2(&device->vk.alloc, pAllocator, fb);
}
@@ -7172,6 +7195,9 @@ VkResult radv_CreateSampler(
if (!sampler)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &sampler->base,
+ VK_OBJECT_TYPE_SAMPLER);
+
radv_init_sampler(device, sampler, pCreateInfo);
sampler->ycbcr_sampler = ycbcr_conversion ? radv_sampler_ycbcr_conversion_from_handle(ycbcr_conversion->conversion): NULL;
@@ -7190,6 +7216,7 @@ void radv_DestroySampler(
if (!sampler)
return;
+ vk_object_base_finish(&sampler->base);
vk_free2(&device->vk.alloc, pAllocator, sampler);
}
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 1ed5dc668d2..76099252290 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -1449,6 +1449,8 @@ radv_image_create(VkDevice _device,
if (!image)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &image->base, VK_OBJECT_TYPE_IMAGE);
+
image->type = pCreateInfo->imageType;
image->info.width = pCreateInfo->extent.width;
image->info.height = pCreateInfo->extent.height;
@@ -1844,6 +1846,7 @@ radv_DestroyImage(VkDevice _device, VkImage _image,
if (image->owned_memory != VK_NULL_HANDLE)
radv_FreeMemory(_device, image->owned_memory, pAllocator);
+ vk_object_base_finish(&image->base);
vk_free2(&device->vk.alloc, pAllocator, image);
}
@@ -1913,6 +1916,9 @@ radv_CreateImageView(VkDevice _device,
if (view == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &view->base,
+ VK_OBJECT_TYPE_IMAGE_VIEW);
+
radv_image_view_init(view, device, pCreateInfo, NULL);
*pView = radv_image_view_to_handle(view);
@@ -1929,6 +1935,8 @@ radv_DestroyImageView(VkDevice _device, VkImageView _iview,
if (!iview)
return;
+
+ vk_object_base_finish(&iview->base);
vk_free2(&device->vk.alloc, pAllocator, iview);
}
@@ -1961,6 +1969,9 @@ radv_CreateBufferView(VkDevice _device,
if (!view)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &view->base,
+ VK_OBJECT_TYPE_BUFFER_VIEW);
+
radv_buffer_view_init(view, device, pCreateInfo);
*pView = radv_buffer_view_to_handle(view);
@@ -1978,5 +1989,6 @@ radv_DestroyBufferView(VkDevice _device, VkBufferView bufferView,
if (!view)
return;
+ vk_object_base_finish(&view->base);
vk_free2(&device->vk.alloc, pAllocator, view);
}
diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c
index 41e8d3f4d0e..0c1ab154cb6 100644
--- a/src/amd/vulkan/radv_pass.c
+++ b/src/amd/vulkan/radv_pass.c
@@ -325,6 +325,10 @@ VkResult radv_CreateRenderPass(
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
memset(pass, 0, size);
+
+ vk_object_base_init(&device->vk, &pass->base,
+ VK_OBJECT_TYPE_RENDER_PASS);
+
pass->attachment_count = pCreateInfo->attachmentCount;
pass->subpass_count = pCreateInfo->subpassCount;
pass->attachments = (void *) pass + attachments_offset;
@@ -507,6 +511,10 @@ VkResult radv_CreateRenderPass2(
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
memset(pass, 0, size);
+
+ vk_object_base_init(&device->vk, &pass->base,
+ VK_OBJECT_TYPE_RENDER_PASS);
+
pass->attachment_count = pCreateInfo->attachmentCount;
pass->subpass_count = pCreateInfo->subpassCount;
pass->attachments = (void *) pass + attachments_offset;
@@ -681,6 +689,8 @@ void radv_DestroyRenderPass(
if (!_pass)
return;
+
+ vk_object_base_finish(&pass->base);
vk_free2(&device->vk.alloc, pAllocator, pass->subpass_attachments);
vk_free2(&device->vk.alloc, pAllocator, pass);
}
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 7e2f4c04980..80d218716ea 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -191,6 +191,8 @@ radv_pipeline_destroy(struct radv_device *device,
if(pipeline->cs.buf)
free(pipeline->cs.buf);
+
+ vk_object_base_finish(&pipeline->base);
vk_free2(&device->vk.alloc, allocator, pipeline);
}
@@ -5265,6 +5267,9 @@ radv_graphics_pipeline_create(
if (pipeline == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &pipeline->base,
+ VK_OBJECT_TYPE_PIPELINE);
+
result = radv_pipeline_init(pipeline, device, cache,
pCreateInfo, extra);
if (result != VK_SUCCESS) {
@@ -5403,6 +5408,9 @@ static VkResult radv_compute_pipeline_create(
if (pipeline == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &pipeline->base,
+ VK_OBJECT_TYPE_PIPELINE);
+
pipeline->device = device;
pipeline->layout = radv_pipeline_layout_from_handle(pCreateInfo->layout);
assert(pipeline->layout);
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index fb83f073405..074c5acb7f4 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -578,6 +578,9 @@ VkResult radv_CreatePipelineCache(
if (cache == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &cache->base,
+ VK_OBJECT_TYPE_PIPELINE_CACHE);
+
if (pAllocator)
cache->alloc = *pAllocator;
else
@@ -608,6 +611,7 @@ void radv_DestroyPipelineCache(
return;
radv_pipeline_cache_finish(cache);
+ vk_object_base_finish(&cache->base);
vk_free2(&device->vk.alloc, pAllocator, cache);
}
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 073fd97ca8f..27d512a5f49 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -341,7 +341,7 @@ struct radv_physical_device {
};
struct radv_instance {
- VK_LOADER_DATA _loader_data;
+ struct vk_object_base base;
VkAllocationCallbacks alloc;
@@ -385,6 +385,7 @@ bool radv_physical_device_extension_supported(struct radv_physical_device *dev,
struct cache_entry;
struct radv_pipeline_cache {
+ struct vk_object_base base;
struct radv_device * device;
pthread_mutex_t mutex;
@@ -871,6 +872,7 @@ struct radv_device {
};
struct radv_device_memory {
+ struct vk_object_base base;
struct radeon_winsys_bo *bo;
/* for dedicated allocations */
struct radv_image *image;
@@ -892,6 +894,7 @@ struct radv_descriptor_range {
};
struct radv_descriptor_set {
+ struct vk_object_base base;
const struct radv_descriptor_set_layout *layout;
uint32_t size;
uint32_t buffer_count;
@@ -917,6 +920,7 @@ struct radv_descriptor_pool_entry {
};
struct radv_descriptor_pool {
+ struct vk_object_base base;
struct radeon_winsys_bo *bo;
uint8_t *mapped_ptr;
uint64_t current_offset;
@@ -958,12 +962,14 @@ struct radv_descriptor_update_template_entry {
};
struct radv_descriptor_update_template {
+ struct vk_object_base base;
uint32_t entry_count;
VkPipelineBindPoint bind_point;
struct radv_descriptor_update_template_entry entry[0];
};
struct radv_buffer {
+ struct vk_object_base base;
VkDeviceSize size;
VkBufferUsageFlags usage;
@@ -1316,6 +1322,7 @@ struct radv_cmd_state {
};
struct radv_cmd_pool {
+ struct vk_object_base base;
VkAllocationCallbacks alloc;
struct list_head cmd_buffers;
struct list_head free_cmd_buffers;
@@ -1339,7 +1346,7 @@ enum radv_cmd_buffer_status {
};
struct radv_cmd_buffer {
- VK_LOADER_DATA _loader_data;
+ struct vk_object_base base;
struct radv_device * device;
@@ -1553,6 +1560,7 @@ void radv_unaligned_dispatch(
uint32_t z);
struct radv_event {
+ struct vk_object_base base;
struct radeon_winsys_bo *bo;
uint64_t *map;
};
@@ -1632,6 +1640,7 @@ struct radv_binning_state {
#define SI_GS_PER_ES 128
struct radv_pipeline {
+ struct vk_object_base base;
struct radv_device * device;
struct radv_dynamic_state dynamic_state;
@@ -1768,6 +1777,7 @@ struct radv_image_plane {
};
struct radv_image {
+ struct vk_object_base base;
VkImageType type;
/* The original VkFormat provided by the client. This may not match any
* of the actual surface formats.
@@ -2006,6 +2016,7 @@ union radv_descriptor {
};
struct radv_image_view {
+ struct vk_object_base base;
struct radv_image *image; /**< VkImageViewCreateInfo::image */
struct radeon_winsys_bo *bo;
@@ -2084,6 +2095,7 @@ void radv_image_view_init(struct radv_image_view *view,
VkFormat radv_get_aspect_format(struct radv_image *image, VkImageAspectFlags mask);
struct radv_sampler_ycbcr_conversion {
+ struct vk_object_base base;
VkFormat format;
VkSamplerYcbcrModelConversion ycbcr_model;
VkSamplerYcbcrRange ycbcr_range;
@@ -2093,6 +2105,7 @@ struct radv_sampler_ycbcr_conversion {
};
struct radv_buffer_view {
+ struct vk_object_base base;
struct radeon_winsys_bo *bo;
VkFormat vk_format;
uint64_t range; /**< VkBufferViewCreateInfo::range */
@@ -2146,11 +2159,13 @@ radv_image_extent_compare(const struct radv_image *image,
}
struct radv_sampler {
+ struct vk_object_base base;
uint32_t state[4];
struct radv_sampler_ycbcr_conversion *ycbcr_sampler;
};
struct radv_framebuffer {
+ struct vk_object_base base;
uint32_t width;
uint32_t height;
uint32_t layers;
@@ -2223,6 +2238,7 @@ struct radv_render_pass_attachment {
};
struct radv_render_pass {
+ struct vk_object_base base;
uint32_t attachment_count;
uint32_t subpass_count;
struct radv_subpass_attachment * subpass_attachments;
@@ -2235,6 +2251,7 @@ VkResult radv_device_init_meta(struct radv_device *device);
void radv_device_finish_meta(struct radv_device *device);
struct radv_query_pool {
+ struct vk_object_base base;
struct radeon_winsys_bo *bo;
uint32_t stride;
uint32_t availability_offset;
@@ -2298,6 +2315,7 @@ struct radv_semaphore_part {
};
struct radv_semaphore {
+ struct vk_object_base base;
struct radv_semaphore_part permanent;
struct radv_semaphore_part temporary;
};
@@ -2342,6 +2360,7 @@ void radv_initialize_fmask(struct radv_cmd_buffer *cmd_buffer,
const VkImageSubresourceRange *range);
struct radv_fence {
+ struct vk_object_base base;
struct radeon_winsys_fence *fence;
struct wsi_fence *fence_wsi;
diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
index dd1291f3a84..ea2128fc4c0 100644
--- a/src/amd/vulkan/radv_query.c
+++ b/src/amd/vulkan/radv_query.c
@@ -1283,6 +1283,8 @@ VkResult radv_CreateQueryPool(
if (!pool)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &pool->base,
+ VK_OBJECT_TYPE_QUERY_POOL);
switch(pCreateInfo->queryType) {
case VK_QUERY_TYPE_OCCLUSION:
@@ -1341,6 +1343,8 @@ void radv_DestroyQueryPool(
return;
device->ws->buffer_destroy(pool->bo);
+
+ vk_object_base_finish(&pool->base);
vk_free2(&device->vk.alloc, pAllocator, pool);
}
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index e2a816f4a4d..217fc142de3 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -166,6 +166,9 @@ VkResult radv_CreateShaderModule(
if (module == NULL)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ vk_object_base_init(&device->vk, &module->base,
+ VK_OBJECT_TYPE_SHADER_MODULE);
+
module->nir = NULL;
module->size = pCreateInfo->codeSize;
memcpy(module->data, pCreateInfo->pCode, module->size);
@@ -188,6 +191,7 @@ void radv_DestroyShaderModule(
if (!module)
return;
+ vk_object_base_finish(&module->base);
vk_free2(&device->vk.alloc, pAllocator, module);
}
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index d7c8119cd24..1795273acf1 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -34,10 +34,12 @@
#include "nir/nir.h"
#include "vulkan/vulkan.h"
+#include "vulkan/util/vk_object.h"
struct radv_device;
struct radv_shader_module {
+ struct vk_object_base base;
struct nir_shader *nir;
unsigned char sha1[20];
uint32_t size;