lavapipe: Store immutable_samplers as lvp_sampler array

We will need this to access the ycbcr conversion.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>
This commit is contained in:
Konstantin Seurer 2023-07-22 18:53:27 +02:00 committed by Marge Bot
parent 7dc6c4b581
commit da95f64a6f
3 changed files with 7 additions and 7 deletions

View file

@ -73,7 +73,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
size_t size = sizeof(struct lvp_descriptor_set_layout) +
num_bindings * sizeof(set_layout->binding[0]) +
immutable_sampler_count * sizeof(struct lp_descriptor*);
immutable_sampler_count * sizeof(struct lvp_sampler *);
set_layout = vk_descriptor_set_layout_zalloc(&device->vk, size);
if (!set_layout)
@ -81,8 +81,8 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
set_layout->immutable_sampler_count = immutable_sampler_count;
/* We just allocate all the samplers at the end of the struct */
struct lp_descriptor **samplers =
(struct lp_descriptor **)&set_layout->binding[num_bindings];
struct lvp_sampler **samplers =
(struct lvp_sampler **)&set_layout->binding[num_bindings];
set_layout->binding_count = num_bindings;
set_layout->shader_stages = 0;
@ -132,7 +132,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDescriptorSetLayout(
for (uint32_t i = 0; i < binding->descriptorCount; i++) {
if (binding->pImmutableSamplers[i])
set_layout->binding[b].immutable_samplers[i] =
&lvp_sampler_from_handle(binding->pImmutableSamplers[i])->desc;
lvp_sampler_from_handle(binding->pImmutableSamplers[i]);
else
set_layout->binding[b].immutable_samplers[i] = NULL;
}
@ -351,7 +351,7 @@ lvp_descriptor_set_create(struct lvp_device *device,
for (uint32_t sampler_index = 0; sampler_index < bind_layout->array_size; sampler_index++) {
if (bind_layout->immutable_samplers[sampler_index])
desc[sampler_index] = *bind_layout->immutable_samplers[sampler_index];
desc[sampler_index] = bind_layout->immutable_samplers[sampler_index]->desc;
}
}

View file

@ -4011,7 +4011,7 @@ bind_db_samplers(struct rendering_state *state, bool is_compute, unsigned set)
for (uint32_t sampler_index = 0; sampler_index < bind_layout->array_size; sampler_index++) {
if (bind_layout->immutable_samplers[sampler_index]) {
desc[sampler_index].sampler = bind_layout->immutable_samplers[sampler_index]->sampler;
desc[sampler_index].sampler = bind_layout->immutable_samplers[sampler_index]->desc.sampler;
u_foreach_bit(stage, set_layout->shader_stages)
did_update |= BITFIELD_BIT(vk_to_mesa_shader_stage(1<<stage));
}

View file

@ -294,7 +294,7 @@ struct lvp_descriptor_set_binding_layout {
uint32_t uniform_block_size;
/* Immutable samplers (or NULL if no immutable samplers) */
struct lp_descriptor **immutable_samplers;
struct lvp_sampler **immutable_samplers;
};
struct lvp_descriptor_set_layout {