mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
zink: split resource tracking into two sets for buffer/texture
this will make the hash lookups slightly faster to cut down overhead Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
This commit is contained in:
parent
8b93f157de
commit
8a5b3658df
2 changed files with 14 additions and 11 deletions
|
|
@ -30,14 +30,16 @@ zink_reset_batch_state(struct zink_context *ctx, struct zink_batch_state *bs)
|
||||||
mesa_loge("ZINK: vkResetCommandPool failed (%s)", vk_Result_to_str(result));
|
mesa_loge("ZINK: vkResetCommandPool failed (%s)", vk_Result_to_str(result));
|
||||||
|
|
||||||
/* unref all used resources */
|
/* unref all used resources */
|
||||||
set_foreach_remove(&bs->resources, entry) {
|
for (unsigned i = 0; i < ARRAY_SIZE(bs->resources); i++) {
|
||||||
struct zink_resource_object *obj = (struct zink_resource_object *)entry->key;
|
set_foreach_remove(&bs->resources[i], entry) {
|
||||||
if (!zink_resource_object_usage_unset(obj, bs)) {
|
struct zink_resource_object *obj = (struct zink_resource_object *)entry->key;
|
||||||
obj->unordered_read = obj->unordered_write = false;
|
if (!zink_resource_object_usage_unset(obj, bs)) {
|
||||||
obj->access = 0;
|
obj->unordered_read = obj->unordered_write = false;
|
||||||
obj->access_stage = 0;
|
obj->access = 0;
|
||||||
|
obj->access_stage = 0;
|
||||||
|
}
|
||||||
|
util_dynarray_append(&bs->unref_resources, struct zink_resource_object*, obj);
|
||||||
}
|
}
|
||||||
util_dynarray_append(&bs->unref_resources, struct zink_resource_object*, obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < 2; i++) {
|
for (unsigned i = 0; i < 2; i++) {
|
||||||
|
|
@ -220,7 +222,8 @@ create_batch_state(struct zink_context *ctx)
|
||||||
|
|
||||||
bs->ctx = ctx;
|
bs->ctx = ctx;
|
||||||
|
|
||||||
SET_CREATE_OR_FAIL(&bs->resources);
|
SET_CREATE_OR_FAIL(&bs->resources[0]);
|
||||||
|
SET_CREATE_OR_FAIL(&bs->resources[1]);
|
||||||
SET_CREATE_OR_FAIL(&bs->surfaces);
|
SET_CREATE_OR_FAIL(&bs->surfaces);
|
||||||
SET_CREATE_OR_FAIL(&bs->bufferviews);
|
SET_CREATE_OR_FAIL(&bs->bufferviews);
|
||||||
SET_CREATE_OR_FAIL(&bs->programs);
|
SET_CREATE_OR_FAIL(&bs->programs);
|
||||||
|
|
@ -554,7 +557,7 @@ check_oom_flush(struct zink_context *ctx, const struct zink_batch *batch)
|
||||||
void
|
void
|
||||||
zink_batch_reference_resource(struct zink_batch *batch, struct zink_resource *res)
|
zink_batch_reference_resource(struct zink_batch *batch, struct zink_resource *res)
|
||||||
{
|
{
|
||||||
if (!batch_ptr_add_usage(batch, &batch->state->resources, res->obj))
|
if (!batch_ptr_add_usage(batch, &batch->state->resources[res->obj->is_buffer], res->obj))
|
||||||
return;
|
return;
|
||||||
pipe_reference(NULL, &res->obj->reference);
|
pipe_reference(NULL, &res->obj->reference);
|
||||||
batch->state->resource_size += res->obj->size;
|
batch->state->resource_size += res->obj->size;
|
||||||
|
|
@ -565,7 +568,7 @@ zink_batch_reference_resource(struct zink_batch *batch, struct zink_resource *re
|
||||||
void
|
void
|
||||||
zink_batch_reference_resource_move(struct zink_batch *batch, struct zink_resource *res)
|
zink_batch_reference_resource_move(struct zink_batch *batch, struct zink_resource *res)
|
||||||
{
|
{
|
||||||
if (!batch_ptr_add_usage(batch, &batch->state->resources, res->obj))
|
if (!batch_ptr_add_usage(batch, &batch->state->resources[res->obj->is_buffer], res->obj))
|
||||||
return;
|
return;
|
||||||
batch->state->resource_size += res->obj->size;
|
batch->state->resource_size += res->obj->size;
|
||||||
check_oom_flush(batch->state->ctx, batch);
|
check_oom_flush(batch->state->ctx, batch);
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,7 @@ struct zink_batch_state {
|
||||||
|
|
||||||
struct set programs;
|
struct set programs;
|
||||||
|
|
||||||
struct set resources;
|
struct set resources[2];
|
||||||
struct set surfaces;
|
struct set surfaces;
|
||||||
struct set bufferviews;
|
struct set bufferviews;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue