mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 21:30:23 +01:00
panvk: Update panvk_get_desc_stride prototype
This will help set things up for multiplane samplers and textures. Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32563>
This commit is contained in:
parent
9e5b6370c0
commit
ddbbc1d217
4 changed files with 25 additions and 15 deletions
|
|
@ -64,10 +64,10 @@ to_panvk_descriptor_set_layout(const struct vk_descriptor_set_layout *layout)
|
|||
}
|
||||
|
||||
static inline const uint32_t
|
||||
panvk_get_desc_stride(VkDescriptorType type)
|
||||
panvk_get_desc_stride(const struct panvk_descriptor_set_binding_layout *layout)
|
||||
{
|
||||
/* One descriptor for the sampler, and one for the texture. */
|
||||
return type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ? 2 : 1;
|
||||
return layout->type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ? 2 : 1;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
|
|
@ -82,7 +82,7 @@ panvk_get_desc_index(const struct panvk_descriptor_set_binding_layout *layout,
|
|||
assert(!vk_descriptor_type_is_dynamic(layout->type));
|
||||
|
||||
uint32_t desc_idx =
|
||||
layout->desc_idx + elem * panvk_get_desc_stride(layout->type);
|
||||
layout->desc_idx + elem * panvk_get_desc_stride(layout);
|
||||
|
||||
/* In case of combined image-sampler, we put the texture first. */
|
||||
if (layout->type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER &&
|
||||
|
|
|
|||
|
|
@ -239,9 +239,13 @@ panvk_per_arch(CreateDescriptorPool)(
|
|||
|
||||
uint32_t desc_count = 0;
|
||||
for (unsigned i = 0; i < pCreateInfo->poolSizeCount; ++i) {
|
||||
if (!vk_descriptor_type_is_dynamic(pCreateInfo->pPoolSizes[i].type))
|
||||
desc_count += panvk_get_desc_stride(pCreateInfo->pPoolSizes[i].type) *
|
||||
if (!vk_descriptor_type_is_dynamic(pCreateInfo->pPoolSizes[i].type)) {
|
||||
const struct panvk_descriptor_set_binding_layout layout = {
|
||||
.type = pCreateInfo->pPoolSizes[i].type,
|
||||
};
|
||||
desc_count += panvk_get_desc_stride(&layout) *
|
||||
pCreateInfo->pPoolSizes[i].descriptorCount;
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize to all ones to indicate all sets are free */
|
||||
|
|
@ -324,7 +328,7 @@ panvk_desc_pool_allocate_set(struct panvk_descriptor_pool *pool,
|
|||
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT) &&
|
||||
!vk_descriptor_type_is_dynamic(layout->bindings[last_binding].type)) {
|
||||
uint32_t desc_stride =
|
||||
panvk_get_desc_stride(layout->bindings[last_binding].type);
|
||||
panvk_get_desc_stride(&layout->bindings[last_binding]);
|
||||
|
||||
num_descs -= layout->bindings[last_binding].desc_count * desc_stride;
|
||||
num_descs += variable_count * desc_stride;
|
||||
|
|
@ -539,7 +543,7 @@ panvk_descriptor_set_copy(const VkCopyDescriptorSet *copy)
|
|||
|
||||
memcpy(dst, src,
|
||||
PANVK_DESCRIPTOR_SIZE *
|
||||
panvk_get_desc_stride(src_binding_layout->type));
|
||||
panvk_get_desc_stride(src_binding_layout));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ panvk_per_arch(CreateDescriptorSetLayout)(
|
|||
dyn_buf_idx += binding_layout->desc_count;
|
||||
} else {
|
||||
binding_layout->desc_idx = desc_idx;
|
||||
desc_idx += panvk_get_desc_stride(binding_layout->type) *
|
||||
desc_idx += panvk_get_desc_stride(binding_layout) *
|
||||
binding_layout->desc_count;
|
||||
}
|
||||
}
|
||||
|
|
@ -183,10 +183,16 @@ panvk_per_arch(GetDescriptorSetLayoutSupport)(
|
|||
const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[i];
|
||||
VkDescriptorType type = binding->descriptorType;
|
||||
|
||||
if (vk_descriptor_type_is_dynamic(type))
|
||||
if (vk_descriptor_type_is_dynamic(type)) {
|
||||
dyn_buf_count += binding->descriptorCount;
|
||||
else
|
||||
desc_count += panvk_get_desc_stride(type) * binding->descriptorCount;
|
||||
continue;
|
||||
}
|
||||
|
||||
const struct panvk_descriptor_set_binding_layout layout = {
|
||||
.type = type,
|
||||
};
|
||||
|
||||
desc_count += panvk_get_desc_stride(&layout) * binding->descriptorCount;
|
||||
}
|
||||
|
||||
if (desc_count > PANVK_MAX_DESCS_PER_SET ||
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ load_resource_deref_desc(nir_builder *b, nir_deref_instr *deref,
|
|||
if (index_ssa == NULL)
|
||||
index_ssa = nir_imm_int(b, index_imm);
|
||||
|
||||
unsigned desc_stride = panvk_get_desc_stride(bind_layout->type);
|
||||
unsigned desc_stride = panvk_get_desc_stride(bind_layout);
|
||||
nir_def *set_offset =
|
||||
nir_imul_imm(b,
|
||||
nir_iadd_imm(b, nir_imul_imm(b, index_ssa, desc_stride),
|
||||
|
|
@ -682,7 +682,7 @@ get_desc_array_stride(const struct panvk_descriptor_set_binding_layout *layout)
|
|||
/* On Bifrost, descriptors are copied from the sets to the final
|
||||
* descriptor tables which are per-type, making the stride one in
|
||||
* this context. */
|
||||
return PAN_ARCH >= 9 ? panvk_get_desc_stride(layout->type) : 1;
|
||||
return PAN_ARCH >= 9 ? panvk_get_desc_stride(layout) : 1;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -885,7 +885,7 @@ record_binding(struct lower_desc_ctx *ctx, unsigned set, unsigned binding,
|
|||
const struct panvk_descriptor_set_binding_layout *binding_layout =
|
||||
&set_layout->bindings[binding];
|
||||
uint32_t subdesc_idx = get_subdesc_idx(binding_layout, subdesc_type);
|
||||
uint32_t desc_stride = panvk_get_desc_stride(binding_layout->type);
|
||||
uint32_t desc_stride = panvk_get_desc_stride(binding_layout);
|
||||
|
||||
assert(desc_stride == 1 || desc_stride == 2);
|
||||
ctx->desc_info.used_set_mask |= BITFIELD_BIT(set);
|
||||
|
|
@ -951,7 +951,7 @@ fill_copy_descs_for_binding(struct lower_desc_ctx *ctx, unsigned set,
|
|||
const struct panvk_descriptor_set_layout *set_layout = ctx->set_layouts[set];
|
||||
const struct panvk_descriptor_set_binding_layout *binding_layout =
|
||||
&set_layout->bindings[binding];
|
||||
uint32_t desc_stride = panvk_get_desc_stride(binding_layout->type);
|
||||
uint32_t desc_stride = panvk_get_desc_stride(binding_layout);
|
||||
uint32_t *first_entry = NULL;
|
||||
|
||||
assert(desc_count <= binding_layout->desc_count);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue