mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 06:10:13 +01:00
freedreno/ir3: split out per-stage emit_consts fxns
This makes it easier to deal with adding additional stages which have their own driver-params. The duplicated code this introduces can be refactored out after a later patch moves to per-shader-stage dirty flags. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
df37902e34
commit
b662f71d9c
5 changed files with 41 additions and 21 deletions
|
|
@ -713,9 +713,9 @@ fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
OUT_RING(ring, HLSQ_FLUSH);
|
||||
|
||||
if (emit->prog == &ctx->prog) { /* evil hack to deal sanely with clear path */
|
||||
ir3_emit_consts(vp, ring, ctx, emit->info, dirty);
|
||||
ir3_emit_vs_consts(vp, ring, ctx, emit->info);
|
||||
if (!emit->key.binning_pass)
|
||||
ir3_emit_consts(fp, ring, ctx, emit->info, dirty);
|
||||
ir3_emit_fs_consts(fp, ring, ctx);
|
||||
}
|
||||
|
||||
if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) {
|
||||
|
|
|
|||
|
|
@ -677,9 +677,9 @@ fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
}
|
||||
|
||||
if (emit->prog == &ctx->prog) { /* evil hack to deal sanely with clear path */
|
||||
ir3_emit_consts(vp, ring, ctx, emit->info, dirty);
|
||||
ir3_emit_vs_consts(vp, ring, ctx, emit->info);
|
||||
if (!emit->key.binning_pass)
|
||||
ir3_emit_consts(fp, ring, ctx, emit->info, dirty);
|
||||
ir3_emit_fs_consts(fp, ring, ctx);
|
||||
}
|
||||
|
||||
if ((dirty & FD_DIRTY_BLEND)) {
|
||||
|
|
|
|||
|
|
@ -551,9 +551,9 @@ fd5_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
|
|||
}
|
||||
|
||||
if (emit->prog == &ctx->prog) { /* evil hack to deal sanely with clear path */
|
||||
ir3_emit_consts(vp, ring, ctx, emit->info, dirty);
|
||||
ir3_emit_vs_consts(vp, ring, ctx, emit->info);
|
||||
if (!emit->key.binning_pass)
|
||||
ir3_emit_consts(fp, ring, ctx, emit->info, dirty);
|
||||
ir3_emit_fs_consts(fp, ring, ctx);
|
||||
|
||||
struct pipe_stream_output_info *info = &vp->shader->stream_output;
|
||||
if (info->num_outputs) {
|
||||
|
|
|
|||
|
|
@ -655,23 +655,19 @@ max_tf_vtx(struct fd_context *ctx, const struct ir3_shader_variant *v)
|
|||
}
|
||||
|
||||
void
|
||||
ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
||||
struct fd_context *ctx, const struct pipe_draw_info *info, uint32_t dirty)
|
||||
ir3_emit_vs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
||||
struct fd_context *ctx, const struct pipe_draw_info *info)
|
||||
{
|
||||
uint32_t dirty = ctx->dirty;
|
||||
|
||||
debug_assert(v->type == SHADER_VERTEX);
|
||||
|
||||
if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONSTBUF)) {
|
||||
struct fd_constbuf_stateobj *constbuf;
|
||||
bool shader_dirty;
|
||||
|
||||
if (v->type == SHADER_VERTEX) {
|
||||
constbuf = &ctx->constbuf[PIPE_SHADER_VERTEX];
|
||||
shader_dirty = !!(dirty & FD_SHADER_DIRTY_VP);
|
||||
} else if (v->type == SHADER_FRAGMENT) {
|
||||
constbuf = &ctx->constbuf[PIPE_SHADER_FRAGMENT];
|
||||
shader_dirty = !!(dirty & FD_SHADER_DIRTY_FP);
|
||||
} else {
|
||||
unreachable("bad shader type");
|
||||
return;
|
||||
}
|
||||
constbuf = &ctx->constbuf[PIPE_SHADER_VERTEX];
|
||||
shader_dirty = !!(dirty & FD_SHADER_DIRTY_VP);
|
||||
|
||||
emit_user_consts(ctx, v, ring, constbuf);
|
||||
emit_ubos(ctx, v, ring, constbuf);
|
||||
|
|
@ -681,7 +677,7 @@ ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
|||
|
||||
/* emit driver params every time: */
|
||||
/* TODO skip emit if shader doesn't use driver params to avoid WFI.. */
|
||||
if (info && (v->type == SHADER_VERTEX)) {
|
||||
if (info) {
|
||||
uint32_t offset = v->constbase.driver_param;
|
||||
if (v->constlen > offset) {
|
||||
uint32_t vertex_params[IR3_DP_COUNT] = {
|
||||
|
|
@ -717,3 +713,25 @@ ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ir3_emit_fs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
||||
struct fd_context *ctx)
|
||||
{
|
||||
uint32_t dirty = ctx->dirty;
|
||||
|
||||
debug_assert(v->type == SHADER_FRAGMENT);
|
||||
|
||||
if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONSTBUF)) {
|
||||
struct fd_constbuf_stateobj *constbuf;
|
||||
bool shader_dirty;
|
||||
|
||||
constbuf = &ctx->constbuf[PIPE_SHADER_FRAGMENT];
|
||||
shader_dirty = !!(dirty & FD_SHADER_DIRTY_FP);
|
||||
|
||||
emit_user_consts(ctx, v, ring, constbuf);
|
||||
emit_ubos(ctx, v, ring, constbuf);
|
||||
if (shader_dirty)
|
||||
emit_immediates(ctx, v, ring);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,8 +318,10 @@ uint64_t ir3_shader_outputs(const struct ir3_shader *so);
|
|||
|
||||
struct fd_ringbuffer;
|
||||
struct fd_context;
|
||||
void ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
||||
struct fd_context *ctx, const struct pipe_draw_info *info, uint32_t dirty);
|
||||
void ir3_emit_vs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
||||
struct fd_context *ctx, const struct pipe_draw_info *info);
|
||||
void ir3_emit_fs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
|
||||
struct fd_context *ctx);
|
||||
|
||||
static inline const char *
|
||||
ir3_shader_stage(struct ir3_shader *shader)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue