mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
zink: implement resource_get_address
Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32942>
This commit is contained in:
parent
a04569b2ea
commit
c449d1d063
2 changed files with 22 additions and 0 deletions
|
|
@ -1067,6 +1067,14 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
|
|||
|
||||
if (BATCH_CHANGED) {
|
||||
zink_update_descriptor_refs(ctx, true);
|
||||
|
||||
for (unsigned i = 0; i < info->num_globals; i++) {
|
||||
struct zink_resource *res = zink_resource(info->globals[i]);
|
||||
util_range_add(&res->base.b, &res->valid_buffer_range, 0, res->base.b.width0);
|
||||
zink_batch_reference_resource_rw(ctx, res, true);
|
||||
zink_screen(ctx->base.screen)->buffer_barrier(ctx, res, VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT);
|
||||
res->obj->unordered_read = res->obj->unordered_write = false;
|
||||
}
|
||||
}
|
||||
if (ctx->compute_dirty) {
|
||||
/* update inlinable constants */
|
||||
|
|
|
|||
|
|
@ -2134,6 +2134,10 @@ invalidate_buffer(struct zink_context *ctx, struct zink_resource *res)
|
|||
if (res->base.b.flags & PIPE_RESOURCE_FLAG_SPARSE)
|
||||
return false;
|
||||
|
||||
/* never invalidate a resource with a fixed address */
|
||||
if (res->base.b.flags & PIPE_RESOURCE_FLAG_FIXED_ADDRESS)
|
||||
return false;
|
||||
|
||||
struct pipe_box box;
|
||||
u_box_3d(0, 0, 0, res->base.b.width0, 0, 0, &box);
|
||||
if (res->valid_buffer_range.start > res->valid_buffer_range.end &&
|
||||
|
|
@ -3079,6 +3083,14 @@ zink_buffer_subdata(struct pipe_context *ctx, struct pipe_resource *buffer,
|
|||
zink_buffer_unmap(ctx, transfer);
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
zink_resource_get_address_gallium(struct pipe_screen *pscreen, struct pipe_resource *pres)
|
||||
{
|
||||
if (pres->flags & PIPE_RESOURCE_FLAG_FIXED_ADDRESS)
|
||||
return zink_resource_get_address(zink_screen(pres->screen), zink_resource(pres));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pipe_resource *
|
||||
zink_resource_get_separate_stencil(struct pipe_resource *pres)
|
||||
{
|
||||
|
|
@ -3247,6 +3259,8 @@ zink_screen_resource_init(struct pipe_screen *pscreen)
|
|||
pscreen->memobj_destroy = zink_memobj_destroy;
|
||||
pscreen->resource_from_memobj = zink_resource_from_memobj;
|
||||
}
|
||||
if (screen->info.have_KHR_buffer_device_address)
|
||||
pscreen->resource_get_address = zink_resource_get_address_gallium;
|
||||
pscreen->resource_get_param = zink_resource_get_param;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue