dzn: Use the vk_descriptor_set_layout base struct

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17286>
This commit is contained in:
Boris Brezillon
2022-06-29 04:37:43 -07:00
committed by Marge Bot
parent 73eecffabd
commit 88f287a1d0
2 changed files with 4 additions and 27 deletions

View File

@@ -130,19 +130,6 @@ num_descs_for_type(VkDescriptorType type, bool static_sampler)
return num_descs;
}
static void
dzn_descriptor_set_layout_destroy(struct dzn_descriptor_set_layout *set_layout,
const VkAllocationCallbacks *pAllocator)
{
if (!set_layout)
return;
struct dzn_device *device = container_of(set_layout->base.device, struct dzn_device, vk);
vk_object_base_finish(&set_layout->base);
vk_free2(&device->vk.alloc, pAllocator, set_layout);
}
static VkResult
dzn_descriptor_set_layout_create(struct dzn_device *device,
const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
@@ -230,11 +217,9 @@ dzn_descriptor_set_layout_create(struct dzn_device *device,
VK_MULTIALLOC_DECL(&ma, struct dzn_descriptor_set_layout_binding, binfos,
binding_count);
if (!vk_multialloc_zalloc2(&ma, &device->vk.alloc, pAllocator,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT))
if (!vk_descriptor_set_layout_multizalloc(&device->vk, &ma))
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
vk_object_base_init(&device->vk, &set_layout->base, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
set_layout->static_samplers = static_samplers;
set_layout->static_sampler_count = static_sampler_count;
set_layout->immutable_samplers = immutable_samplers;
@@ -472,15 +457,6 @@ dzn_CreateDescriptorSetLayout(VkDevice device,
pCreateInfo, pAllocator, pSetLayout);
}
VKAPI_ATTR void VKAPI_CALL
dzn_DestroyDescriptorSetLayout(VkDevice device,
VkDescriptorSetLayout descriptorSetLayout,
const VkAllocationCallbacks *pAllocator)
{
dzn_descriptor_set_layout_destroy(dzn_descriptor_set_layout_from_handle(descriptorSetLayout),
pAllocator);
}
VKAPI_ATTR void VKAPI_CALL
dzn_GetDescriptorSetLayoutSupport(VkDevice device,
const VkDescriptorSetLayoutCreateInfo *pCreateInfo,

View File

@@ -28,6 +28,7 @@
#include "vk_command_buffer.h"
#include "vk_cmd_queue.h"
#include "vk_debug_report.h"
#include "vk_descriptor_set_layout.h"
#include "vk_device.h"
#include "vk_image.h"
#include "vk_log.h"
@@ -615,7 +616,7 @@ struct dzn_descriptor_set_layout_binding {
};
struct dzn_descriptor_set_layout {
struct vk_object_base base;
struct vk_descriptor_set_layout vk;
uint32_t range_count[MAX_SHADER_VISIBILITIES][NUM_POOL_TYPES];
const D3D12_DESCRIPTOR_RANGE1 *ranges[MAX_SHADER_VISIBILITIES][NUM_POOL_TYPES];
uint32_t range_desc_count[NUM_POOL_TYPES];
@@ -1108,7 +1109,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_buffer_view, base, VkBufferView, VK_OBJECT_TY
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_device_memory, base, VkDeviceMemory, VK_OBJECT_TYPE_DEVICE_MEMORY)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_descriptor_pool, base, VkDescriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_descriptor_set, base, VkDescriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_descriptor_set_layout, base, VkDescriptorSetLayout, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_descriptor_set_layout, vk.base, VkDescriptorSetLayout, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_descriptor_update_template, base, VkDescriptorUpdateTemplate, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_event, base, VkEvent, VK_OBJECT_TYPE_EVENT)
VK_DEFINE_NONDISP_HANDLE_CASTS(dzn_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)