mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
zink: fix bindless texture barrier generation
whenever I redid barriers I forgot to handle bindless textures, which meant they weren't getting barriers added Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21522>
This commit is contained in:
parent
75e9ba85de
commit
fb4fd03db9
2 changed files with 42 additions and 12 deletions
|
|
@ -1385,7 +1385,7 @@ zink_set_inlinable_constants(struct pipe_context *pctx,
|
||||||
ALWAYS_INLINE static void
|
ALWAYS_INLINE static void
|
||||||
unbind_descriptor_stage(struct zink_resource *res, gl_shader_stage pstage)
|
unbind_descriptor_stage(struct zink_resource *res, gl_shader_stage pstage)
|
||||||
{
|
{
|
||||||
if (!res->sampler_binds[pstage] && !res->image_binds[pstage])
|
if (!res->sampler_binds[pstage] && !res->image_binds[pstage] && !res->all_bindless)
|
||||||
res->gfx_barrier &= ~zink_pipeline_flags_from_pipe_stage(pstage);
|
res->gfx_barrier &= ~zink_pipeline_flags_from_pipe_stage(pstage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1506,14 +1506,14 @@ zink_set_constant_buffer(struct pipe_context *pctx,
|
||||||
ALWAYS_INLINE static void
|
ALWAYS_INLINE static void
|
||||||
unbind_descriptor_reads(struct zink_resource *res, bool is_compute)
|
unbind_descriptor_reads(struct zink_resource *res, bool is_compute)
|
||||||
{
|
{
|
||||||
if (!res->sampler_bind_count[is_compute] && !res->image_bind_count[is_compute])
|
if (!res->sampler_bind_count[is_compute] && !res->image_bind_count[is_compute] && !res->all_bindless)
|
||||||
res->barrier_access[is_compute] &= ~VK_ACCESS_SHADER_READ_BIT;
|
res->barrier_access[is_compute] &= ~VK_ACCESS_SHADER_READ_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE static void
|
ALWAYS_INLINE static void
|
||||||
unbind_buffer_descriptor_reads(struct zink_resource *res, bool is_compute)
|
unbind_buffer_descriptor_reads(struct zink_resource *res, bool is_compute)
|
||||||
{
|
{
|
||||||
if (!res->ssbo_bind_count[is_compute])
|
if (!res->ssbo_bind_count[is_compute] && !res->all_bindless)
|
||||||
unbind_descriptor_reads(res, is_compute);
|
unbind_descriptor_reads(res, is_compute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2172,6 +2172,33 @@ zero_bindless_descriptor(struct zink_context *ctx, uint32_t handle, bool is_buff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unbind_bindless_descriptor(struct zink_context *ctx, struct zink_resource *res)
|
||||||
|
{
|
||||||
|
if (!res->bindless[1]) {
|
||||||
|
/* check to remove write access */
|
||||||
|
for (unsigned i = 0; i < 2; i++) {
|
||||||
|
if (!res->write_bind_count[i])
|
||||||
|
res->barrier_access[i] &= ~VK_ACCESS_SHADER_WRITE_BIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool is_buffer = res->base.b.target == PIPE_BUFFER;
|
||||||
|
if (!res->all_bindless) {
|
||||||
|
/* check to remove read access */
|
||||||
|
if (is_buffer) {
|
||||||
|
for (unsigned i = 0; i < 2; i++)
|
||||||
|
unbind_buffer_descriptor_reads(res, i);
|
||||||
|
} else {
|
||||||
|
for (unsigned i = 0; i < 2; i++)
|
||||||
|
unbind_descriptor_reads(res, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (unsigned i = 0; i < 2; i++) {
|
||||||
|
if (!res->image_bind_count[i])
|
||||||
|
check_for_layout_update(ctx, res, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
zink_make_texture_handle_resident(struct pipe_context *pctx, uint64_t handle, bool resident)
|
zink_make_texture_handle_resident(struct pipe_context *pctx, uint64_t handle, bool resident)
|
||||||
{
|
{
|
||||||
|
|
@ -2212,6 +2239,9 @@ zink_make_texture_handle_resident(struct pipe_context *pctx, uint64_t handle, bo
|
||||||
zink_batch_resource_usage_set(&ctx->batch, res, false, false);
|
zink_batch_resource_usage_set(&ctx->batch, res, false, false);
|
||||||
res->obj->unordered_write = false;
|
res->obj->unordered_write = false;
|
||||||
}
|
}
|
||||||
|
res->gfx_barrier |= VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||||
|
res->barrier_access[0] |= VK_ACCESS_SHADER_READ_BIT;
|
||||||
|
res->barrier_access[1] |= VK_ACCESS_SHADER_READ_BIT;
|
||||||
util_dynarray_append(&ctx->di.bindless[0].resident, struct zink_bindless_descriptor *, bd);
|
util_dynarray_append(&ctx->di.bindless[0].resident, struct zink_bindless_descriptor *, bd);
|
||||||
uint32_t h = is_buffer ? handle + ZINK_MAX_BINDLESS_HANDLES : handle;
|
uint32_t h = is_buffer ? handle + ZINK_MAX_BINDLESS_HANDLES : handle;
|
||||||
util_dynarray_append(&ctx->di.bindless[0].updates, uint32_t, h);
|
util_dynarray_append(&ctx->di.bindless[0].updates, uint32_t, h);
|
||||||
|
|
@ -2222,10 +2252,7 @@ zink_make_texture_handle_resident(struct pipe_context *pctx, uint64_t handle, bo
|
||||||
update_res_bind_count(ctx, res, false, true);
|
update_res_bind_count(ctx, res, false, true);
|
||||||
update_res_bind_count(ctx, res, true, true);
|
update_res_bind_count(ctx, res, true, true);
|
||||||
res->bindless[0]--;
|
res->bindless[0]--;
|
||||||
for (unsigned i = 0; i < 2; i++) {
|
unbind_bindless_descriptor(ctx, res);
|
||||||
if (!res->image_bind_count[i])
|
|
||||||
check_for_layout_update(ctx, res, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ctx->di.bindless_dirty[0] = true;
|
ctx->di.bindless_dirty[0] = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2345,6 +2372,9 @@ zink_make_image_handle_resident(struct pipe_context *pctx, uint64_t handle, unsi
|
||||||
zink_batch_resource_usage_set(&ctx->batch, res, zink_resource_access_is_write(access), false);
|
zink_batch_resource_usage_set(&ctx->batch, res, zink_resource_access_is_write(access), false);
|
||||||
res->obj->unordered_write = false;
|
res->obj->unordered_write = false;
|
||||||
}
|
}
|
||||||
|
res->gfx_barrier |= VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||||
|
res->barrier_access[0] |= access;
|
||||||
|
res->barrier_access[1] |= access;
|
||||||
util_dynarray_append(&ctx->di.bindless[1].resident, struct zink_bindless_descriptor *, bd);
|
util_dynarray_append(&ctx->di.bindless[1].resident, struct zink_bindless_descriptor *, bd);
|
||||||
uint32_t h = is_buffer ? handle + ZINK_MAX_BINDLESS_HANDLES : handle;
|
uint32_t h = is_buffer ? handle + ZINK_MAX_BINDLESS_HANDLES : handle;
|
||||||
util_dynarray_append(&ctx->di.bindless[1].updates, uint32_t, h);
|
util_dynarray_append(&ctx->di.bindless[1].updates, uint32_t, h);
|
||||||
|
|
@ -2358,10 +2388,7 @@ zink_make_image_handle_resident(struct pipe_context *pctx, uint64_t handle, unsi
|
||||||
unbind_shader_image_counts(ctx, res, false, false);
|
unbind_shader_image_counts(ctx, res, false, false);
|
||||||
unbind_shader_image_counts(ctx, res, true, false);
|
unbind_shader_image_counts(ctx, res, true, false);
|
||||||
res->bindless[1]--;
|
res->bindless[1]--;
|
||||||
for (unsigned i = 0; i < 2; i++) {
|
unbind_bindless_descriptor(ctx, res);
|
||||||
if (!res->image_bind_count[i])
|
|
||||||
check_for_layout_update(ctx, res, i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ctx->di.bindless_dirty[1] = true;
|
ctx->di.bindless_dirty[1] = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1208,7 +1208,10 @@ struct zink_resource {
|
||||||
uint16_t sampler_bind_count[2]; //gfx, compute
|
uint16_t sampler_bind_count[2]; //gfx, compute
|
||||||
uint16_t image_bind_count[2]; //gfx, compute
|
uint16_t image_bind_count[2]; //gfx, compute
|
||||||
uint16_t write_bind_count[2]; //gfx, compute
|
uint16_t write_bind_count[2]; //gfx, compute
|
||||||
uint16_t bindless[2]; //tex, img
|
union {
|
||||||
|
uint16_t bindless[2]; //tex, img
|
||||||
|
uint32_t all_bindless;
|
||||||
|
};
|
||||||
union {
|
union {
|
||||||
uint16_t bind_count[2]; //gfx, compute
|
uint16_t bind_count[2]; //gfx, compute
|
||||||
uint32_t all_binds;
|
uint32_t all_binds;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue