mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 15:40:11 +01:00
zink: remove ZINK_RESOURCE_USAGE_STREAMOUT
we can use a bool flag for this instead to be more sensible Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12822>
This commit is contained in:
parent
13114ff712
commit
18866dc733
4 changed files with 11 additions and 12 deletions
|
|
@ -3076,7 +3076,7 @@ zink_create_stream_output_target(struct pipe_context *pctx,
|
|||
t->base.buffer_offset = buffer_offset;
|
||||
t->base.buffer_size = buffer_size;
|
||||
|
||||
zink_resource(t->base.buffer)->bind_history |= ZINK_RESOURCE_USAGE_STREAMOUT;
|
||||
zink_resource(t->base.buffer)->so_valid = true;
|
||||
|
||||
return &t->base;
|
||||
}
|
||||
|
|
@ -3386,7 +3386,7 @@ bool
|
|||
zink_resource_rebind(struct zink_context *ctx, struct zink_resource *res)
|
||||
{
|
||||
/* force counter buffer reset */
|
||||
res->bind_history &= ~ZINK_RESOURCE_USAGE_STREAMOUT;
|
||||
res->so_valid = false;
|
||||
if (!zink_resource_has_binds(res))
|
||||
return true;
|
||||
if (res->base.b.target == PIPE_BUFFER)
|
||||
|
|
@ -3455,7 +3455,7 @@ zink_context_replace_buffer_storage(struct pipe_context *pctx, struct pipe_resou
|
|||
d->access_stage = s->access_stage;
|
||||
d->unordered_barrier = s->unordered_barrier;
|
||||
/* force counter buffer reset */
|
||||
d->bind_history &= ~ZINK_RESOURCE_USAGE_STREAMOUT;
|
||||
d->so_valid = false;
|
||||
if (num_rebinds && rebind_buffer(ctx, d, rebind_mask, num_rebinds) != num_rebinds)
|
||||
ctx->buffer_rebind_counter = p_atomic_inc_return(&screen->buffer_rebind_counter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ zink_emit_stream_output_targets(struct pipe_context *pctx)
|
|||
continue;
|
||||
}
|
||||
struct zink_resource *res = zink_resource(t->base.buffer);
|
||||
if (!(res->bind_history & ZINK_RESOURCE_USAGE_STREAMOUT))
|
||||
if (!res->so_valid)
|
||||
/* resource has been rebound */
|
||||
t->counter_buffer_valid = false;
|
||||
buffers[i] = res->obj->buffer;
|
||||
|
|
@ -89,7 +89,7 @@ zink_emit_stream_output_targets(struct pipe_context *pctx)
|
|||
zink_batch_reference_resource_rw(batch, res, true);
|
||||
buffer_offsets[i] = t->base.buffer_offset;
|
||||
buffer_sizes[i] = t->base.buffer_size;
|
||||
res->bind_history |= ZINK_RESOURCE_USAGE_STREAMOUT;
|
||||
res->so_valid = true;
|
||||
util_range_add(t->base.buffer, &res->valid_buffer_range, t->base.buffer_offset,
|
||||
t->base.buffer_offset + t->base.buffer_size);
|
||||
}
|
||||
|
|
@ -372,8 +372,7 @@ update_barriers(struct zink_context *ctx, bool is_compute)
|
|||
pipeline = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
else {
|
||||
u_foreach_bit(stage, res->bind_history) {
|
||||
if ((1 << stage) != ZINK_RESOURCE_USAGE_STREAMOUT)
|
||||
pipeline |= zink_pipeline_flags_from_pipe_stage((enum pipe_shader_type)stage);
|
||||
pipeline |= zink_pipeline_flags_from_pipe_stage((enum pipe_shader_type)stage);
|
||||
}
|
||||
}
|
||||
if (res->base.b.target == PIPE_BUFFER)
|
||||
|
|
|
|||
|
|
@ -948,10 +948,10 @@ invalidate_buffer(struct zink_context *ctx, struct zink_resource *res)
|
|||
if (res->valid_buffer_range.start > res->valid_buffer_range.end)
|
||||
return false;
|
||||
|
||||
if (res->bind_history & ZINK_RESOURCE_USAGE_STREAMOUT)
|
||||
if (res->so_valid)
|
||||
ctx->dirty_so_targets = true;
|
||||
/* force counter buffer reset */
|
||||
res->bind_history &= ~ZINK_RESOURCE_USAGE_STREAMOUT;
|
||||
res->so_valid = false;
|
||||
|
||||
util_range_set_empty(&res->valid_buffer_range);
|
||||
if (!zink_resource_has_usage(res))
|
||||
|
|
@ -1211,10 +1211,10 @@ zink_buffer_map(struct pipe_context *pctx,
|
|||
|
||||
if (!ptr) {
|
||||
/* if writing to a streamout buffer, ensure synchronization next time it's used */
|
||||
if (usage & PIPE_MAP_WRITE && res->bind_history & ZINK_RESOURCE_USAGE_STREAMOUT) {
|
||||
if (usage & PIPE_MAP_WRITE && res->so_valid) {
|
||||
ctx->dirty_so_targets = true;
|
||||
/* force counter buffer reset */
|
||||
res->bind_history &= ~ZINK_RESOURCE_USAGE_STREAMOUT;
|
||||
res->so_valid = false;
|
||||
}
|
||||
ptr = map_resource(screen, res);
|
||||
if (!ptr)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ struct sw_displaytarget;
|
|||
struct zink_batch;
|
||||
struct zink_context;
|
||||
struct zink_bo;
|
||||
#define ZINK_RESOURCE_USAGE_STREAMOUT (1 << 10) //much greater than ZINK_DESCRIPTOR_TYPES
|
||||
|
||||
#include "util/simple_mtx.h"
|
||||
#include "util/u_transfer.h"
|
||||
|
|
@ -103,6 +102,7 @@ struct zink_resource {
|
|||
uint32_t vbo_bind_mask : PIPE_MAX_ATTRIBS;
|
||||
uint8_t ubo_bind_count[2];
|
||||
uint8_t so_bind_count;
|
||||
bool so_valid;
|
||||
uint32_t ubo_bind_mask[PIPE_SHADER_TYPES];
|
||||
uint32_t ssbo_bind_mask[PIPE_SHADER_TYPES];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue