mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
vulkan/runtime: store flags on descriptor set layouts
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33799>
This commit is contained in:
parent
9c97b2bf9b
commit
f8af4b597e
9 changed files with 22 additions and 14 deletions
|
|
@ -168,7 +168,7 @@ radv_CreateDescriptorSetLayout(VkDevice _device, const VkDescriptorSetLayoutCrea
|
|||
* they are reference counted and may not be destroyed when vkDestroyDescriptorSetLayout is
|
||||
* called.
|
||||
*/
|
||||
set_layout = vk_descriptor_set_layout_zalloc(&device->vk, size);
|
||||
set_layout = vk_descriptor_set_layout_zalloc(&device->vk, size, pCreateInfo);
|
||||
if (!set_layout)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ hk_CreateDescriptorSetLayout(VkDevice device,
|
|||
VK_MULTIALLOC_DECL(&ma, struct hk_sampler *, samplers,
|
||||
immutable_sampler_count);
|
||||
|
||||
if (!vk_descriptor_set_layout_multizalloc(&dev->vk, &ma))
|
||||
if (!vk_descriptor_set_layout_multizalloc(&dev->vk, &ma, pCreateInfo))
|
||||
return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
layout->binding_count = num_bindings;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ tu_CreateDescriptorSetLayout(
|
|||
|
||||
set_layout =
|
||||
(struct tu_descriptor_set_layout *) vk_descriptor_set_layout_zalloc(
|
||||
&device->vk, size);
|
||||
&device->vk, size, pCreateInfo);
|
||||
if (!set_layout)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
|
|||
num_bindings * sizeof(set_layout->binding[0]) +
|
||||
immutable_sampler_count * sizeof(struct lvp_sampler *);
|
||||
|
||||
set_layout = vk_descriptor_set_layout_zalloc(&device->vk, size);
|
||||
set_layout = vk_descriptor_set_layout_zalloc(&device->vk, size, pCreateInfo);
|
||||
if (!set_layout)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ dzn_descriptor_set_layout_create(struct dzn_device *device,
|
|||
VK_MULTIALLOC_DECL(&ma, struct dzn_descriptor_set_layout_binding, binfos,
|
||||
binding_count);
|
||||
|
||||
if (!vk_descriptor_set_layout_multizalloc(&device->vk, &ma))
|
||||
if (!vk_descriptor_set_layout_multizalloc(&device->vk, &ma, pCreateInfo))
|
||||
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
set_layout->static_samplers = static_samplers;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ nvk_CreateDescriptorSetLayout(VkDevice device,
|
|||
VK_MULTIALLOC_DECL(&ma, struct nvk_sampler *, samplers,
|
||||
immutable_sampler_count);
|
||||
|
||||
if (!vk_descriptor_set_layout_multizalloc(&dev->vk, &ma))
|
||||
if (!vk_descriptor_set_layout_multizalloc(&dev->vk, &ma, pCreateInfo))
|
||||
return vk_error(dev, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
layout->vk.destroy = nvk_descriptor_set_layout_destroy;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ panvk_per_arch(CreateDescriptorSetLayout)(
|
|||
VK_MULTIALLOC_DECL(&ma, struct panvk_sampler *, samplers,
|
||||
immutable_sampler_count);
|
||||
|
||||
if (!vk_descriptor_set_layout_multizalloc(&device->vk, &ma)) {
|
||||
if (!vk_descriptor_set_layout_multizalloc(&device->vk, &ma, pCreateInfo)) {
|
||||
free(bindings);
|
||||
return panvk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,17 +29,20 @@
|
|||
|
||||
static void
|
||||
vk_descriptor_set_layout_init(struct vk_device *device,
|
||||
struct vk_descriptor_set_layout *layout)
|
||||
struct vk_descriptor_set_layout *layout,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo)
|
||||
{
|
||||
vk_object_base_init(device, &layout->base,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
|
||||
|
||||
layout->ref_cnt = 1;
|
||||
layout->flags = pCreateInfo->flags;
|
||||
layout->destroy = vk_descriptor_set_layout_destroy;
|
||||
}
|
||||
|
||||
void *
|
||||
vk_descriptor_set_layout_zalloc(struct vk_device *device, size_t size)
|
||||
vk_descriptor_set_layout_zalloc(struct vk_device *device, size_t size,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo)
|
||||
{
|
||||
/* Because we're reference counting and lifetimes may not be what the
|
||||
* client expects, these have to be allocated off the device and not as
|
||||
|
|
@ -50,14 +53,15 @@ vk_descriptor_set_layout_zalloc(struct vk_device *device, size_t size)
|
|||
if (!layout)
|
||||
return NULL;
|
||||
|
||||
vk_descriptor_set_layout_init(device, layout);
|
||||
vk_descriptor_set_layout_init(device, layout, pCreateInfo);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
void *
|
||||
vk_descriptor_set_layout_multizalloc(struct vk_device *device,
|
||||
struct vk_multialloc *ma)
|
||||
struct vk_multialloc *ma,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo)
|
||||
{
|
||||
/* Because we're reference counting and lifetimes may not be what the
|
||||
* client expects, these have to be allocated off the device and not as
|
||||
|
|
@ -69,7 +73,7 @@ vk_descriptor_set_layout_multizalloc(struct vk_device *device,
|
|||
if (!layout)
|
||||
return NULL;
|
||||
|
||||
vk_descriptor_set_layout_init(device, layout);
|
||||
vk_descriptor_set_layout_init(device, layout, pCreateInfo);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ extern "C" {
|
|||
struct vk_descriptor_set_layout {
|
||||
struct vk_object_base base;
|
||||
|
||||
VkDescriptorSetLayoutCreateFlags flags;
|
||||
|
||||
/* BLAKE3 hash of the descriptor set layout. This is used by the common
|
||||
* pipeline code to properly cache shaders, including handling pipeline
|
||||
* layouts. It must be populated by the driver or you risk pipeline cache
|
||||
|
|
@ -66,10 +68,12 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(vk_descriptor_set_layout, base,
|
|||
VkDescriptorSetLayout,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
|
||||
|
||||
void *vk_descriptor_set_layout_zalloc(struct vk_device *device, size_t size);
|
||||
void *vk_descriptor_set_layout_zalloc(struct vk_device *device, size_t size,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo);
|
||||
|
||||
void *vk_descriptor_set_layout_multizalloc(struct vk_device *device,
|
||||
struct vk_multialloc *ma);
|
||||
struct vk_multialloc *ma,
|
||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo);
|
||||
|
||||
void vk_descriptor_set_layout_destroy(struct vk_device *device,
|
||||
struct vk_descriptor_set_layout *layout);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue