lavapipe: create a desc set for immutable sampler layouts

this is necessary in order to bind an all-immutable set as a buffer

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
This commit is contained in:
Mike Blumenkrantz 2023-04-26 17:06:29 -04:00 committed by Marge Bot
parent 12a7fc51c7
commit 180f0090e5
2 changed files with 22 additions and 0 deletions

View file

@ -27,6 +27,18 @@
#include "util/u_math.h"
#include "util/u_inlines.h"
static void
lvp_descriptor_set_layout_destroy(struct vk_device *_device, struct vk_descriptor_set_layout *_layout)
{
struct lvp_device *device = container_of(_device, struct lvp_device, vk);
struct lvp_descriptor_set_layout *set_layout = (void*)vk_to_lvp_descriptor_set_layout(_layout);
_layout->ref_cnt = UINT32_MAX;
lvp_descriptor_set_destroy(device, set_layout->immutable_set);
vk_descriptor_set_layout_destroy(_device, _layout);
}
VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
VkDevice _device,
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
@ -165,6 +177,13 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
set_layout->dynamic_offset_count = dynamic_offset_count;
if (set_layout->binding_count == set_layout->immutable_sampler_count) {
/* create a bindable set with all the immutable samplers */
lvp_descriptor_set_create(device, set_layout, &set_layout->immutable_set);
vk_descriptor_set_layout_unref(&device->vk, &set_layout->vk);
set_layout->vk.destroy = lvp_descriptor_set_layout_destroy;
}
*pSetLayout = lvp_descriptor_set_layout_to_handle(set_layout);
return VK_SUCCESS;

View file

@ -313,6 +313,9 @@ struct lvp_descriptor_set_layout {
/* Number of dynamic offsets used by this descriptor set */
uint32_t dynamic_offset_count;
/* if this layout is comprised solely of immutable samplers, this will be a bindable set */
struct lvp_descriptor_set *immutable_set;
/* Bindings in this descriptor set */
struct lvp_descriptor_set_binding_layout binding[0];
};