mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 19:50:11 +01:00
zink: implement tc idalloc resource id stuff
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10882>
This commit is contained in:
parent
6f5037c9de
commit
a29688a0d1
4 changed files with 10 additions and 1 deletions
|
|
@ -2964,6 +2964,7 @@ zink_context_replace_buffer_storage(struct pipe_context *pctx, struct pipe_resou
|
|||
struct zink_resource *s = zink_resource(src);
|
||||
|
||||
assert(d->internal_format == s->internal_format);
|
||||
util_idalloc_mt_free(&zink_screen(pctx->screen)->buffer_ids, delete_buffer_id);
|
||||
zink_resource_object_reference(zink_screen(pctx->screen), &d->obj, s->obj);
|
||||
d->access = s->access;
|
||||
d->access_stage = s->access_stage;
|
||||
|
|
|
|||
|
|
@ -151,8 +151,10 @@ zink_resource_destroy(struct pipe_screen *pscreen,
|
|||
{
|
||||
struct zink_screen *screen = zink_screen(pscreen);
|
||||
struct zink_resource *res = zink_resource(pres);
|
||||
if (pres->target == PIPE_BUFFER)
|
||||
if (pres->target == PIPE_BUFFER) {
|
||||
util_range_destroy(&res->valid_buffer_range);
|
||||
util_idalloc_mt_free(&screen->buffer_ids, res->base.buffer_id_unique);
|
||||
}
|
||||
|
||||
zink_resource_object_reference(screen, &res->obj, NULL);
|
||||
zink_resource_object_reference(screen, &res->scanout_obj, NULL);
|
||||
|
|
@ -623,6 +625,8 @@ resource_create(struct pipe_screen *pscreen,
|
|||
64, NULL,
|
||||
&res->dt_stride);
|
||||
}
|
||||
if (res->obj->is_buffer)
|
||||
res->base.buffer_id_unique = util_idalloc_mt_alloc(&screen->buffer_ids);
|
||||
|
||||
return &res->base.b;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -991,6 +991,7 @@ zink_destroy_screen(struct pipe_screen *pscreen)
|
|||
|
||||
vkDestroyDevice(screen->dev, NULL);
|
||||
vkDestroyInstance(screen->instance, NULL);
|
||||
util_idalloc_mt_fini(&screen->buffer_ids);
|
||||
|
||||
slab_destroy_parent(&screen->transfer_pool);
|
||||
ralloc_free(screen);
|
||||
|
|
@ -1685,6 +1686,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
|
|||
_mesa_hash_table_init(&screen->bufferview_cache, screen, NULL, equals_bvci);
|
||||
|
||||
zink_screen_init_descriptor_funcs(screen, false);
|
||||
util_idalloc_mt_init_tc(&screen->buffer_ids);
|
||||
|
||||
return screen;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "zink_device_info.h"
|
||||
#include "zink_instance.h"
|
||||
|
||||
#include "util/u_idalloc.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/slab.h"
|
||||
#include "compiler/nir/nir.h"
|
||||
|
|
@ -93,6 +94,7 @@ struct zink_screen {
|
|||
|
||||
VkPhysicalDevice pdev;
|
||||
uint32_t vk_version;
|
||||
struct util_idalloc_mt buffer_ids;
|
||||
|
||||
struct zink_device_info info;
|
||||
struct nir_shader_compiler_options nir_options;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue