panvk: use vk_descriptor_type_is_dynamic

No need to open-code this one now that we have a generic helper.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32627>
This commit is contained in:
Erik Faye-Lund
2024-12-13 13:09:15 +01:00
committed by Marge Bot
parent 6877ff7d9b
commit 3df7eda3a8
4 changed files with 6 additions and 14 deletions
@@ -79,8 +79,7 @@ panvk_get_desc_index(const struct panvk_descriptor_set_binding_layout *layout,
(type == VK_DESCRIPTOR_TYPE_SAMPLER ||
type == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)));
assert(layout->type != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC &&
layout->type != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC);
assert(!vk_descriptor_type_is_dynamic(layout->type));
uint32_t desc_idx =
layout->desc_idx + elem * panvk_get_desc_stride(layout->type);
@@ -47,8 +47,7 @@ cmd_desc_state_bind_sets(struct panvk_descriptor_state *desc_state,
for (unsigned b = 0; b < set->layout->binding_count; b++) {
VkDescriptorType type = set->layout->bindings[b].type;
if (type != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC &&
type != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)
if (!vk_descriptor_type_is_dynamic(type))
continue;
unsigned dyn_buf_idx = set->layout->bindings[b].desc_idx;
@@ -130,8 +130,7 @@ panvk_per_arch(CreateDescriptorSetLayout)(
}
}
if (binding_layout->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ||
binding_layout->type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) {
if (vk_descriptor_type_is_dynamic(binding_layout->type)) {
binding_layout->desc_idx = dyn_buf_idx;
dyn_buf_idx += binding_layout->desc_count;
} else {
@@ -184,8 +183,7 @@ panvk_per_arch(GetDescriptorSetLayoutSupport)(
const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[i];
VkDescriptorType type = binding->descriptorType;
if (type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ||
type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)
if (vk_descriptor_type_is_dynamic(type))
dyn_buf_count += binding->descriptorCount;
else
desc_count += panvk_get_desc_stride(type) * binding->descriptorCount;
@@ -187,9 +187,7 @@ shader_desc_idx(uint32_t set, uint32_t binding, VkDescriptorType subdesc_type,
/* On Valhall, all non-dynamic descriptors are accessed directly through
* their set. The vertex attribute table always comes first, so we always
* offset user sets by one if we're dealing with a vertex shader. */
if (PAN_ARCH >= 9 &&
bind_layout->type != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC &&
bind_layout->type != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)
if (PAN_ARCH >= 9 && !vk_descriptor_type_is_dynamic(bind_layout->type))
return pan_res_handle(set + 1, bind_layout->desc_idx + subdesc_idx);
/* On Bifrost, the SSBO descriptors are read directly from the set. */
@@ -911,9 +909,7 @@ record_binding(struct lower_desc_ctx *ctx, unsigned set, unsigned binding,
/* On valhall, we only record dynamic bindings, others are accessed directly
* from the set. */
if (PAN_ARCH >= 9 &&
binding_layout->type != VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC &&
binding_layout->type != VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
if (PAN_ARCH >= 9 && !vk_descriptor_type_is_dynamic(binding_layout->type))
return;
/* SSBOs are accessed directly from the sets, no need to record accesses