VkDescriptorSetLayoutBindingFlagsCreateInfo fci = {0};
VkDescriptorBindingFlags flags[ZINK_MAX_DESCRIPTORS_PER_TYPE];
dcslci.pNext = &fci;
- if (t == ZINK_DESCRIPTOR_BASE_TYPES)
+ if (t == ZINK_DESCRIPTOR_TYPE_UNIFORMS)
dcslci.flags = VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR;
fci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO;
fci.bindingCount = num_bindings;
.bindings = bindings,
};
- if (type != ZINK_DESCRIPTOR_BASE_TYPES) {
+ if (type != ZINK_DESCRIPTOR_TYPE_UNIFORMS) {
hash = hash_descriptor_layout(&key);
simple_mtx_lock(&screen->desc_set_layouts_lock);
struct hash_entry *he = _mesa_hash_table_search_pre_hashed(&screen->desc_set_layouts[type], hash, &key);
}
struct zink_descriptor_layout *layout = create_layout(screen, type, bindings, num_bindings, layout_key);
- if (layout && type != ZINK_DESCRIPTOR_BASE_TYPES) {
+ if (layout && type != ZINK_DESCRIPTOR_TYPE_UNIFORMS) {
simple_mtx_lock(&screen->desc_set_layouts_lock);
_mesa_hash_table_insert_pre_hashed(&screen->desc_set_layouts[type], hash, *layout_key, layout);
simple_mtx_unlock(&screen->desc_set_layouts_lock);
uint32_t hash = 0;
struct zink_descriptor_pool_key key;
key.num_type_sizes = num_type_sizes;
- if (type != ZINK_DESCRIPTOR_BASE_TYPES) {
+ if (type != ZINK_DESCRIPTOR_TYPE_UNIFORMS) {
key.layout = layout_key;
memcpy(key.sizes, sizes, num_type_sizes * sizeof(VkDescriptorPoolSize));
hash = hash_descriptor_pool_key(&key);
pool_key->num_type_sizes = num_type_sizes;
assert(pool_key->num_type_sizes);
memcpy(pool_key->sizes, sizes, num_type_sizes * sizeof(VkDescriptorPoolSize));
- if (type != ZINK_DESCRIPTOR_BASE_TYPES) {
+ if (type != ZINK_DESCRIPTOR_TYPE_UNIFORMS) {
simple_mtx_lock(&screen->desc_pool_keys_lock);
_mesa_set_add_pre_hashed(&screen->desc_pool_keys[type], hash, pool_key);
pool_key->id = screen->desc_pool_keys[type].entries - 1;
static VkDescriptorType
get_push_types(struct zink_screen *screen, enum zink_descriptor_type *dsl_type)
{
- *dsl_type = screen->info.have_KHR_push_descriptor ? ZINK_DESCRIPTOR_BASE_TYPES : ZINK_DESCRIPTOR_TYPE_UBO;
+ *dsl_type = screen->info.have_KHR_push_descriptor ? ZINK_DESCRIPTOR_TYPE_UNIFORMS : ZINK_DESCRIPTOR_TYPE_UBO;
return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
}
if (!pg->dsl[i]) {
/* inject a null dsl */
pg->dsl[i] = ctx->dd.dummy_dsl->layout;
- if (i != screen->desc_set_id[ZINK_DESCRIPTOR_BASE_TYPES])
+ if (i != screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_UNIFORMS])
pg->dd.binding_usage |= BITFIELD_BIT(i);
}
}
if (!pg->layout)
return false;
- VkDescriptorUpdateTemplateCreateInfo template[ZINK_DESCRIPTOR_BASE_TYPES + 1] = {0};
+ VkDescriptorUpdateTemplateCreateInfo template[ZINK_DESCRIPTOR_NON_BINDLESS_TYPES] = {0};
/* type of template */
- VkDescriptorUpdateTemplateType types[ZINK_DESCRIPTOR_BASE_TYPES + 1] = {VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET};
+ VkDescriptorUpdateTemplateType types[ZINK_DESCRIPTOR_NON_BINDLESS_TYPES] = {VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET};
if (have_push)
types[0] = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR;
/* number of descriptors in template */
- unsigned wd_count[ZINK_DESCRIPTOR_BASE_TYPES + 1];
+ unsigned wd_count[ZINK_DESCRIPTOR_NON_BINDLESS_TYPES];
if (push_count)
wd_count[0] = pg->is_compute ? 1 : (ZINK_GFX_SHADER_COUNT + !!ctx->dd.has_fbfetch);
for (unsigned i = 0; i < ZINK_DESCRIPTOR_BASE_TYPES; i++)
static bool
set_pool(struct zink_batch_state *bs, struct zink_program *pg, struct zink_descriptor_pool_multi *mpool, enum zink_descriptor_type type)
{
- assert(type != ZINK_DESCRIPTOR_BASE_TYPES);
+ assert(type != ZINK_DESCRIPTOR_TYPE_UNIFORMS);
assert(mpool);
const struct zink_descriptor_pool_key *pool_key = pg->dd.pool_key[type];
size_t size = bs->dd.pools[type].capacity;
bool batch_changed = !bs->dd.pg[is_compute];
if (batch_changed) {
/* update all sets and bind null sets */
- ctx->dd.state_changed[is_compute] = pg->dd.binding_usage & BITFIELD_MASK(ZINK_DESCRIPTOR_BASE_TYPES);
+ ctx->dd.state_changed[is_compute] = pg->dd.binding_usage & BITFIELD_MASK(ZINK_DESCRIPTOR_TYPE_UNIFORMS);
ctx->dd.push_state_changed[is_compute] = !!pg->dd.push_usage;
}
if ((zink_debug & ZINK_DEBUG_COMPACT) ||
screen->info.props.limits.maxBoundDescriptorSets < ZINK_MAX_DESCRIPTOR_SETS) {
- screen->desc_set_id[ZINK_DESCRIPTOR_BASE_TYPES] = 0;
+ screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_UNIFORMS] = 0;
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_UBO] = 1;
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_SSBO] = 1;
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW] = 2;
screen->desc_set_id[ZINK_DESCRIPTOR_BINDLESS] = 3;
screen->compact_descriptors = true;
} else {
- screen->desc_set_id[ZINK_DESCRIPTOR_BASE_TYPES] = 0;
+ screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_UNIFORMS] = 0;
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_UBO] = 1;
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW] = 2;
screen->desc_set_id[ZINK_DESCRIPTOR_TYPE_SSBO] = 3;
};
/* descriptor types; also the ordering of the sets
- * ...except that ZINK_DESCRIPTOR_BASE_TYPES is actually set 0, which is the uniform data (UBO0) for all stages
+ * ...except that ZINK_DESCRIPTOR_BASE_TYPES is actually ZINK_DESCRIPTOR_TYPE_UNIFORMS,
+ * and all base type values are thus +1 to get the set id (using screen->desc_set_id[idx])
*/
enum zink_descriptor_type {
ZINK_DESCRIPTOR_TYPE_UBO,
ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW,
ZINK_DESCRIPTOR_TYPE_SSBO,
ZINK_DESCRIPTOR_TYPE_IMAGE,
- ZINK_DESCRIPTOR_BASE_TYPES,
+ ZINK_DESCRIPTOR_BASE_TYPES, /**< the count/iterator for basic descriptor types */
ZINK_DESCRIPTOR_BINDLESS,
+ ZINK_DESCRIPTOR_ALL_TYPES,
+ ZINK_DESCRIPTOR_TYPE_UNIFORMS = ZINK_DESCRIPTOR_BASE_TYPES, /**< this is aliased for convenience */
+ ZINK_DESCRIPTOR_NON_BINDLESS_TYPES = ZINK_DESCRIPTOR_BASE_TYPES + 1, /**< for struct sizing */
};
enum zink_descriptor_mode {
/* all the pool keys for the program */
struct zink_descriptor_pool_key *pool_key[ZINK_DESCRIPTOR_BASE_TYPES]; //push set doesn't need one
/* all the layouts for the program */
- struct zink_descriptor_layout *layouts[ZINK_DESCRIPTOR_BASE_TYPES + 1];
+ struct zink_descriptor_layout *layouts[ZINK_DESCRIPTOR_NON_BINDLESS_TYPES];
/* all the templates for the program */
- VkDescriptorUpdateTemplate templates[ZINK_DESCRIPTOR_BASE_TYPES + 1];
+ VkDescriptorUpdateTemplate templates[ZINK_DESCRIPTOR_NON_BINDLESS_TYPES];
};
struct zink_descriptor_pool {
/* the current set layout */
VkDescriptorSetLayout dsl[2][ZINK_DESCRIPTOR_BASE_TYPES]; //gfx, compute
/* the current set for a given type; used for rebinding if pipeline compat id changes and current set must be rebound */
- VkDescriptorSet sets[2][ZINK_DESCRIPTOR_BASE_TYPES + 1]; //gfx, compute
+ VkDescriptorSet sets[2][ZINK_DESCRIPTOR_NON_BINDLESS_TYPES]; //gfx, compute
/* mask of push descriptor usage */
unsigned push_usage[2]; //gfx, compute
};
uint32_t compat_id;
VkPipelineLayout layout;
- VkDescriptorSetLayout dsl[ZINK_DESCRIPTOR_BASE_TYPES + 2]; // one for each type + push + bindless
+ VkDescriptorSetLayout dsl[ZINK_DESCRIPTOR_ALL_TYPES]; // one for each type + push + bindless
unsigned num_dsl;
bool removed;