mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
zink: hook up resource bind history
seems like this should be a gallium thing with how many drivers copy/paste it Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9546>
This commit is contained in:
parent
806c612131
commit
2729513d29
2 changed files with 18 additions and 1 deletions
|
|
@ -826,8 +826,13 @@ zink_set_constant_buffer(struct pipe_context *pctx,
|
|||
cb->user_buffer, &offset, &buffer);
|
||||
}
|
||||
struct zink_resource *res = zink_resource(ctx->ubos[shader][index].buffer);
|
||||
struct zink_resource *new_res = zink_resource(buffer);
|
||||
if (new_res) {
|
||||
new_res->bind_history |= BITFIELD_BIT(ZINK_DESCRIPTOR_TYPE_UBO);
|
||||
new_res->bind_stages |= 1 << shader;
|
||||
}
|
||||
update |= (index && ctx->ubos[shader][index].buffer_offset != offset) ||
|
||||
!!res != !!buffer || (res && res->obj->buffer != zink_resource(buffer)->obj->buffer) ||
|
||||
!!res != !!buffer || (res && res->obj->buffer != new_res->obj->buffer) ||
|
||||
ctx->ubos[shader][index].buffer_size != cb->buffer_size;
|
||||
|
||||
if (take_ownership) {
|
||||
|
|
@ -872,6 +877,8 @@ zink_set_shader_buffers(struct pipe_context *pctx,
|
|||
struct pipe_shader_buffer *ssbo = &ctx->ssbos[p_stage][start_slot + i];
|
||||
if (buffers && buffers[i].buffer) {
|
||||
struct zink_resource *res = zink_resource(buffers[i].buffer);
|
||||
res->bind_history |= BITFIELD_BIT(ZINK_DESCRIPTOR_TYPE_SSBO);
|
||||
res->bind_stages |= 1 << p_stage;
|
||||
pipe_resource_reference(&ssbo->buffer, &res->base);
|
||||
ssbo->buffer_offset = buffers[i].buffer_offset;
|
||||
ssbo->buffer_size = MIN2(buffers[i].buffer_size, res->obj->size - ssbo->buffer_offset);
|
||||
|
|
@ -921,6 +928,8 @@ zink_set_shader_images(struct pipe_context *pctx,
|
|||
if (images && images[i].resource) {
|
||||
util_dynarray_init(&image_view->desc_set_refs.refs, NULL);
|
||||
struct zink_resource *res = zink_resource(images[i].resource);
|
||||
res->bind_history |= BITFIELD_BIT(ZINK_DESCRIPTOR_TYPE_IMAGE);
|
||||
res->bind_stages |= 1 << p_stage;
|
||||
util_copy_image_view(&image_view->base, images + i);
|
||||
if (images[i].resource->target == PIPE_BUFFER) {
|
||||
image_view->buffer_view = get_buffer_view(ctx, res, images[i].format, images[i].u.buf.offset, images[i].u.buf.size);
|
||||
|
|
@ -968,6 +977,11 @@ zink_set_sampler_views(struct pipe_context *pctx,
|
|||
struct pipe_sampler_view *pview = views ? views[i] : NULL;
|
||||
struct zink_sampler_view *a = zink_sampler_view(ctx->sampler_views[shader_type][start_slot + i]);
|
||||
struct zink_sampler_view *b = zink_sampler_view(pview);
|
||||
if (b && b->base.texture) {
|
||||
struct zink_resource *res = zink_resource(b->base.texture);
|
||||
res->bind_history |= BITFIELD_BIT(ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW);
|
||||
res->bind_stages |= 1 << shader_type;
|
||||
}
|
||||
uint32_t hash_a = get_sampler_view_hash(a);
|
||||
uint32_t hash_b = get_sampler_view_hash(b);
|
||||
update |= !!a != !!b || hash_a != hash_b;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ struct zink_resource {
|
|||
|
||||
struct sw_displaytarget *dt;
|
||||
unsigned dt_stride;
|
||||
|
||||
uint32_t bind_history; // enum zink_descriptor_type bitmask
|
||||
uint32_t bind_stages;
|
||||
};
|
||||
|
||||
struct zink_transfer {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue