mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
st/mesa: update st_context::active_states in _mesa_update_state
just a code movement to a better place Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19859>
This commit is contained in:
parent
aaa4b0e618
commit
4bc0edd1cf
3 changed files with 35 additions and 36 deletions
|
|
@ -150,6 +150,33 @@ _mesa_update_allow_draw_out_of_order(struct gl_context *ctx)
|
||||||
FLUSH_VERTICES(ctx, 0, 0);
|
FLUSH_VERTICES(ctx, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t
|
||||||
|
_mesa_get_active_states(struct gl_context *ctx)
|
||||||
|
{
|
||||||
|
struct gl_program *vp = ctx->VertexProgram._Current;
|
||||||
|
struct gl_program *tcp = ctx->TessCtrlProgram._Current;
|
||||||
|
struct gl_program *tep = ctx->TessEvalProgram._Current;
|
||||||
|
struct gl_program *gp = ctx->GeometryProgram._Current;
|
||||||
|
struct gl_program *fp = ctx->FragmentProgram._Current;
|
||||||
|
struct gl_program *cp = ctx->ComputeProgram._Current;
|
||||||
|
uint64_t active_shader_states = 0;
|
||||||
|
|
||||||
|
if (vp)
|
||||||
|
active_shader_states |= vp->affected_states;
|
||||||
|
if (tcp)
|
||||||
|
active_shader_states |= tcp->affected_states;
|
||||||
|
if (tep)
|
||||||
|
active_shader_states |= tep->affected_states;
|
||||||
|
if (gp)
|
||||||
|
active_shader_states |= gp->affected_states;
|
||||||
|
if (fp)
|
||||||
|
active_shader_states |= fp->affected_states;
|
||||||
|
if (cp)
|
||||||
|
active_shader_states |= cp->affected_states;
|
||||||
|
|
||||||
|
/* Mark non-shader-resource shader states as "always active". */
|
||||||
|
return active_shader_states | ~ST_ALL_SHADER_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the ctx->*Program._Current pointers to point to the
|
* Update the ctx->*Program._Current pointers to point to the
|
||||||
|
|
@ -364,8 +391,11 @@ update_program(struct gl_context *ctx)
|
||||||
|
|
||||||
/* Let the driver know what's happening: */
|
/* Let the driver know what's happening: */
|
||||||
if (fp_changed || vp_changed || gp_changed || tep_changed ||
|
if (fp_changed || vp_changed || gp_changed || tep_changed ||
|
||||||
tcp_changed || cp_changed)
|
tcp_changed || cp_changed) {
|
||||||
|
/* This will mask out unused shader resources. */
|
||||||
|
st->active_states = _mesa_get_active_states(ctx);
|
||||||
return _NEW_PROGRAM;
|
return _NEW_PROGRAM;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@
|
||||||
extern void
|
extern void
|
||||||
_mesa_update_allow_draw_out_of_order(struct gl_context *ctx);
|
_mesa_update_allow_draw_out_of_order(struct gl_context *ctx);
|
||||||
|
|
||||||
|
extern uint64_t
|
||||||
|
_mesa_get_active_states(struct gl_context *ctx);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_update_state(struct gl_context *ctx);
|
_mesa_update_state(struct gl_context *ctx);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,35 +71,6 @@
|
||||||
|
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
|
DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
|
||||||
|
|
||||||
static uint64_t
|
|
||||||
st_get_active_states(struct gl_context *ctx)
|
|
||||||
{
|
|
||||||
struct gl_program *vp = ctx->VertexProgram._Current;
|
|
||||||
struct gl_program *tcp = ctx->TessCtrlProgram._Current;
|
|
||||||
struct gl_program *tep = ctx->TessEvalProgram._Current;
|
|
||||||
struct gl_program *gp = ctx->GeometryProgram._Current;
|
|
||||||
struct gl_program *fp = ctx->FragmentProgram._Current;
|
|
||||||
struct gl_program *cp = ctx->ComputeProgram._Current;
|
|
||||||
uint64_t active_shader_states = 0;
|
|
||||||
|
|
||||||
if (vp)
|
|
||||||
active_shader_states |= vp->affected_states;
|
|
||||||
if (tcp)
|
|
||||||
active_shader_states |= tcp->affected_states;
|
|
||||||
if (tep)
|
|
||||||
active_shader_states |= tep->affected_states;
|
|
||||||
if (gp)
|
|
||||||
active_shader_states |= gp->affected_states;
|
|
||||||
if (fp)
|
|
||||||
active_shader_states |= fp->affected_states;
|
|
||||||
if (cp)
|
|
||||||
active_shader_states |= cp->affected_states;
|
|
||||||
|
|
||||||
/* Mark non-shader-resource shader states as "always active". */
|
|
||||||
return active_shader_states | ~ST_ALL_SHADER_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
st_invalidate_buffers(struct st_context *st)
|
st_invalidate_buffers(struct st_context *st)
|
||||||
{
|
{
|
||||||
|
|
@ -183,12 +154,6 @@ st_invalidate_state(struct gl_context *ctx)
|
||||||
st->dirty |= ST_NEW_VS_STATE | ST_NEW_VS_CONSTANTS;
|
st->dirty |= ST_NEW_VS_STATE | ST_NEW_VS_CONSTANTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Which shaders are dirty will be determined manually. */
|
|
||||||
if (new_state & _NEW_PROGRAM) {
|
|
||||||
/* This will mask out unused shader resources. */
|
|
||||||
st->active_states = st_get_active_states(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_state & _NEW_TEXTURE_OBJECT) {
|
if (new_state & _NEW_TEXTURE_OBJECT) {
|
||||||
st->dirty |= st->active_states &
|
st->dirty |= st->active_states &
|
||||||
(ST_NEW_SAMPLER_VIEWS |
|
(ST_NEW_SAMPLER_VIEWS |
|
||||||
|
|
@ -803,6 +768,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
||||||
ctx->Const.DriverSupportedPrimMask = screen->get_param(screen, PIPE_CAP_SUPPORTED_PRIM_MODES) |
|
ctx->Const.DriverSupportedPrimMask = screen->get_param(screen, PIPE_CAP_SUPPORTED_PRIM_MODES) |
|
||||||
/* patches is always supported */
|
/* patches is always supported */
|
||||||
BITFIELD_BIT(PIPE_PRIM_PATCHES);
|
BITFIELD_BIT(PIPE_PRIM_PATCHES);
|
||||||
|
st->active_states = _mesa_get_active_states(ctx);
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue