freedreno/a6xx: Tighten up fd6_emit

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20572>
This commit is contained in:
Rob Clark
2023-01-02 12:14:06 -08:00
committed by Marge Bot
parent 2128607014
commit dfd16c489a
3 changed files with 11 additions and 20 deletions

View File

@@ -142,9 +142,7 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
struct shader_info *gs_info = ir3_get_shader_info(ctx->prog.gs);
struct fd6_emit emit = {
.ctx = ctx,
.vtx = &ctx->vtx,
.info = info,
.drawid_offset = drawid_offset,
.indirect = indirect,
.draw = draw,
.key = {
@@ -207,10 +205,8 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
fixup_draw_state(ctx, &emit);
/* *after* fixup_shader_state(): */
emit.dirty = ctx->dirty;
emit.dirty_groups = ctx->gen_dirty;
emit.bs = fd6_emit_get_prog(&emit)->bs;
emit.vs = fd6_emit_get_prog(&emit)->vs;
emit.hs = fd6_emit_get_prog(&emit)->hs;
emit.ds = fd6_emit_get_prog(&emit)->ds;

View File

@@ -315,7 +315,7 @@ fd6_emit_combined_textures(struct fd6_emit *emit,
static struct fd_ringbuffer *
build_vbo_state(struct fd6_emit *emit) assert_dt
{
const struct fd_vertex_state *vtx = emit->vtx;
const struct fd_vertex_state *vtx = &emit->ctx->vtx;
/* Limit PKT4 size, because at max count (32) we would overflow the
* size of the PKT4 size field:
@@ -635,8 +635,7 @@ fd6_emit_streamout(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt
const struct fd6_program_state *prog = fd6_emit_get_prog(emit);
const struct ir3_stream_output_info *info = prog->stream_output;
struct fd_streamout_stateobj *so = &ctx->streamout;
emit->streamout_mask = 0;
unsigned streamout_mask = 0;
if (!info)
return;
@@ -680,10 +679,10 @@ fd6_emit_streamout(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt
so->reset &= ~(1 << i);
emit->streamout_mask |= (1 << i);
streamout_mask |= (1 << i);
}
if (emit->streamout_mask) {
if (streamout_mask) {
fd6_state_add_group(&emit->state, prog->streamout_stateobj, FD6_GROUP_SO);
} else if (ctx->last.streamout_mask != 0) {
/* If we transition from a draw with streamout to one without, turn
@@ -710,7 +709,8 @@ fd6_emit_streamout(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt
if (ctx->dirty & FD_DIRTY_STREAMOUT)
fd_wfi(ctx->batch, ring);
ctx->last.streamout_mask = emit->streamout_mask;
ctx->last.streamout_mask = streamout_mask;
emit->streamout_mask = streamout_mask;
}
/**
@@ -720,7 +720,7 @@ static void
fd6_emit_non_ring(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt
{
struct fd_context *ctx = emit->ctx;
const enum fd_dirty_3d_state dirty = emit->dirty;
const enum fd_dirty_3d_state dirty = ctx->dirty;
unsigned num_viewports = emit->prog->num_viewports;
if (dirty & FD_DIRTY_STENCIL_REF) {

View File

@@ -145,32 +145,27 @@ fd6_state_add_group(struct fd6_state *state, struct fd_ringbuffer *stateobj,
/* grouped together emit-state for prog/vertex/state emit: */
struct fd6_emit {
struct fd_context *ctx;
const struct fd_vertex_state *vtx;
const struct pipe_draw_info *info;
unsigned drawid_offset;
const struct pipe_draw_indirect_info *indirect;
const struct pipe_draw_start_count_bias *draw;
struct ir3_cache_key key;
enum fd_dirty_3d_state dirty;
uint32_t dirty_groups;
uint32_t sprite_coord_enable; /* bitmask */
bool sprite_coord_mode;
bool rasterflat;
bool primitive_restart;
bool sprite_coord_mode : 1;
bool rasterflat : 1;
bool primitive_restart : 1;
uint8_t streamout_mask;
/* cached to avoid repeated lookups: */
const struct fd6_program_state *prog;
struct ir3_shader_variant *bs;
struct ir3_shader_variant *vs;
struct ir3_shader_variant *hs;
struct ir3_shader_variant *ds;
struct ir3_shader_variant *gs;
struct ir3_shader_variant *fs;
unsigned streamout_mask;
struct fd6_state state;
};