venus: Update mutable descriptor struct type

Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18766>
This commit is contained in:
Dawn Han
2022-09-20 17:24:32 +00:00
committed by Marge Bot
parent 0737ad8f86
commit 23f5936ec6
4 changed files with 24 additions and 26 deletions

View File

@@ -91,8 +91,8 @@ vn_descriptor_type_index(VkDescriptorType type)
return VN_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK:
return VN_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK;
case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
return VN_DESCRIPTOR_TYPE_MUTABLE_VALVE;
case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
return VN_DESCRIPTOR_TYPE_MUTABLE_EXT;
default:
break;
}
@@ -129,9 +129,9 @@ vn_descriptor_set_layout_init(
vk_find_struct_const(create_info->pNext,
DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO);
const VkMutableDescriptorTypeCreateInfoVALVE *mutable_descriptor_info =
const VkMutableDescriptorTypeCreateInfoEXT *mutable_descriptor_info =
vk_find_struct_const(create_info->pNext,
MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE);
MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
/* 14.2.1. Descriptor Set Layout
*
@@ -180,12 +180,12 @@ vn_descriptor_set_layout_init(
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
binding->has_immutable_samplers = binding_info->pImmutableSamplers;
break;
case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
assert(mutable_descriptor_info->mutableDescriptorTypeListCount &&
mutable_descriptor_info->pMutableDescriptorTypeLists[i]
.descriptorTypeCount);
const VkMutableDescriptorTypeListVALVE *list =
const VkMutableDescriptorTypeListEXT *list =
&mutable_descriptor_info->pMutableDescriptorTypeLists[i];
for (uint32_t j = 0; j < list->descriptorTypeCount; j++) {
BITSET_SET(binding->mutable_descriptor_types,
@@ -307,7 +307,7 @@ vn_CreateDescriptorPool(VkDevice device,
uint32_t mutable_states_count = 0;
for (uint32_t i = 0; i < pCreateInfo->poolSizeCount; i++) {
const VkDescriptorPoolSize *pool_size = &pCreateInfo->pPoolSizes[i];
if (pool_size->type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE)
if (pool_size->type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT)
mutable_states_count++;
}
struct vn_descriptor_pool *pool;
@@ -327,9 +327,9 @@ vn_CreateDescriptorPool(VkDevice device,
pool->allocator = *alloc;
pool->mutable_states = mutable_states;
const VkMutableDescriptorTypeCreateInfoVALVE *mutable_descriptor_info =
const VkMutableDescriptorTypeCreateInfoEXT *mutable_descriptor_info =
vk_find_struct_const(pCreateInfo->pNext,
MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE);
MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
/* Without VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, the set
* allocation must not fail due to a fragmented pool per spec. In this
@@ -352,14 +352,14 @@ vn_CreateDescriptorPool(VkDevice device,
assert(type_index < VN_NUM_DESCRIPTOR_TYPES);
if (type_index == VN_DESCRIPTOR_TYPE_MUTABLE_VALVE) {
if (type_index == VN_DESCRIPTOR_TYPE_MUTABLE_EXT) {
struct vn_descriptor_pool_state_mutable *mutable_state = NULL;
BITSET_DECLARE(mutable_types, VN_NUM_DESCRIPTOR_TYPES);
if (!mutable_descriptor_info ||
i >= mutable_descriptor_info->mutableDescriptorTypeListCount) {
BITSET_ONES(mutable_types);
} else {
const VkMutableDescriptorTypeListVALVE *list =
const VkMutableDescriptorTypeListEXT *list =
&mutable_descriptor_info->pMutableDescriptorTypeLists[i];
for (uint32_t j = 0; j < list->descriptorTypeCount; j++) {
@@ -467,7 +467,7 @@ vn_pool_restore_mutable_states(struct vn_descriptor_pool *pool,
uint32_t last_binding_descriptor_count)
{
for (uint32_t i = 0; i <= max_binding_index; i++) {
if (layout->bindings[i].type != VK_DESCRIPTOR_TYPE_MUTABLE_VALVE)
if (layout->bindings[i].type != VK_DESCRIPTOR_TYPE_MUTABLE_EXT)
continue;
const uint32_t count = i == layout->last_binding
@@ -519,7 +519,7 @@ vn_descriptor_pool_alloc_descriptors(
goto fail;
}
if (type == VK_DESCRIPTOR_TYPE_MUTABLE_VALVE) {
if (type == VK_DESCRIPTOR_TYPE_MUTABLE_EXT) {
/* A mutable descriptor can be allocated if below are satisfied:
* - vn_descriptor_pool_state_mutable::types is a superset
* - vn_descriptor_pool_state_mutable::{max - used} is enough
@@ -573,7 +573,7 @@ vn_descriptor_pool_free_descriptors(
? last_binding_descriptor_count
: layout->bindings[i].count;
if (layout->bindings[i].type != VK_DESCRIPTOR_TYPE_MUTABLE_VALVE) {
if (layout->bindings[i].type != VK_DESCRIPTOR_TYPE_MUTABLE_EXT) {
pool->used.descriptor_counts[vn_descriptor_type_index(
layout->bindings[i].type)] -= count;
@@ -895,7 +895,7 @@ vn_update_descriptor_sets_parse_writes(uint32_t write_count,
write->pTexelBufferView = NULL;
break;
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK:
case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
default:
write->pImageInfo = NULL;
write->pBufferInfo = NULL;
@@ -971,7 +971,7 @@ vn_update_descriptor_sets_parse_template(
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK:
iub_count += 1;
break;
case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
break;
default:
unreachable("unhandled descriptor type");
@@ -1194,7 +1194,7 @@ vn_UpdateDescriptorSetWithTemplate(
write->pNext, WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK);
iub_data->pData = pData + entry->offset;
break;
case VK_DESCRIPTOR_TYPE_MUTABLE_VALVE:
case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
break;
default:
unreachable("unhandled descriptor type");

View File

@@ -26,7 +26,7 @@ enum vn_descriptor_type {
VN_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC,
VN_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
VN_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK,
VN_DESCRIPTOR_TYPE_MUTABLE_VALVE,
VN_DESCRIPTOR_TYPE_MUTABLE_EXT,
/* add new enum types before this line */
VN_NUM_DESCRIPTOR_TYPES,

View File

@@ -200,8 +200,9 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
VN_ADD_EXT_TO_PNEXT_OF(features2, VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT, feats->vertex_attribute_divisor, EXT_vertex_attribute_divisor);
VN_ADD_EXT_TO_PNEXT_OF(features2, YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT, feats->ycbcr_2plane_444_formats, EXT_ycbcr_2plane_444_formats);
/* Vendor */
VN_ADD_EXT_TO_PNEXT_OF(features2, MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE, feats->mutable_descriptor_type, VALVE_mutable_descriptor_type);
if (exts->EXT_mutable_descriptor_type || exts->VALVE_mutable_descriptor_type) {
VN_ADD_TO_PNEXT_OF(features2, MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT, feats->mutable_descriptor_type);
}
/* clang-format on */
@@ -1075,6 +1076,7 @@ vn_physical_device_get_passthrough_extensions(
.EXT_conservative_rasterization = true,
.EXT_custom_border_color = true,
.EXT_depth_clip_enable = true,
.EXT_mutable_descriptor_type = true,
/* vendor */
.VALVE_mutable_descriptor_type = true,
@@ -1713,15 +1715,13 @@ vn_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
CASE(INDEX_TYPE_UINT8_FEATURES_EXT, index_type_uint8);
CASE(LINE_RASTERIZATION_FEATURES_EXT, line_rasterization);
CASE(MULTI_DRAW_FEATURES_EXT, multi_draw);
CASE(MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT, mutable_descriptor_type);
CASE(PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT, primitive_topology_list_restart);
CASE(PROVOKING_VERTEX_FEATURES_EXT, provoking_vertex);
CASE(ROBUSTNESS_2_FEATURES_EXT, robustness_2);
CASE(TRANSFORM_FEEDBACK_FEATURES_EXT, transform_feedback);
CASE(VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT, vertex_attribute_divisor);
/* vendor */
CASE(MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE, mutable_descriptor_type);
/* clang-format on */
default:

View File

@@ -40,15 +40,13 @@ struct vn_physical_device_features {
VkPhysicalDeviceIndexTypeUint8FeaturesEXT index_type_uint8;
VkPhysicalDeviceLineRasterizationFeaturesEXT line_rasterization;
VkPhysicalDeviceMultiDrawFeaturesEXT multi_draw;
VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT mutable_descriptor_type;
VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT
primitive_topology_list_restart;
VkPhysicalDeviceProvokingVertexFeaturesEXT provoking_vertex;
VkPhysicalDeviceRobustness2FeaturesEXT robustness_2;
VkPhysicalDeviceTransformFeedbackFeaturesEXT transform_feedback;
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_attribute_divisor;
/* vendor */
VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE mutable_descriptor_type;
};
struct vn_physical_device_properties {