mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
mesa/st: Convert st_cb_drawpixels to use st_context_invalidate_state
Replace CSO save/restore of atom-backed states with st_context_invalidate_state(). The conditional DSA/blend invalidation for stencil writes is preserved. Only stream outputs (no atom) still use CSO save/restore. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40592>
This commit is contained in:
parent
04f735c5a7
commit
4c2d41ddf3
1 changed files with 21 additions and 16 deletions
|
|
@ -731,7 +731,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
|||
ASSERTED GLsizei maxSize;
|
||||
bool normalized = sv[0]->texture->target == PIPE_TEXTURE_2D ||
|
||||
(sv[0]->texture->target == PIPE_TEXTURE_RECT && st->lower_rect_tex);
|
||||
unsigned cso_state_mask;
|
||||
unsigned invalidate_flags;
|
||||
|
||||
assert(sv[0]->texture->target == st->internal_target);
|
||||
|
||||
|
|
@ -743,18 +743,22 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
|||
assert(width <= maxSize);
|
||||
assert(height <= maxSize);
|
||||
|
||||
cso_state_mask = (CSO_BIT_RASTERIZER |
|
||||
CSO_BIT_VIEWPORT |
|
||||
CSO_BIT_FRAGMENT_SAMPLERS |
|
||||
CSO_BIT_STREAM_OUTPUTS |
|
||||
CSO_BIT_VERTEX_ELEMENTS |
|
||||
CSO_BIT_MESH_SHADER |
|
||||
CSO_BITS_VERTEX_PIPE_SHADERS);
|
||||
invalidate_flags = (ST_INVALIDATE_RASTERIZER |
|
||||
ST_INVALIDATE_VIEWPORT |
|
||||
ST_INVALIDATE_FS_SAMPLERS |
|
||||
ST_INVALIDATE_VERTEX_BUFFERS |
|
||||
ST_INVALIDATE_MESH_STATE |
|
||||
ST_INVALIDATE_VS_STATE |
|
||||
ST_INVALIDATE_FS_STATE |
|
||||
ST_INVALIDATE_GS_STATE |
|
||||
ST_INVALIDATE_TCS_STATE |
|
||||
ST_INVALIDATE_TES_STATE);
|
||||
if (write_stencil) {
|
||||
cso_state_mask |= (CSO_BIT_DEPTH_STENCIL_ALPHA |
|
||||
CSO_BIT_BLEND);
|
||||
invalidate_flags |= (ST_INVALIDATE_DSA |
|
||||
ST_INVALIDATE_BLEND);
|
||||
}
|
||||
cso_save_state(cso, cso_state_mask);
|
||||
/* Save only states that have no st_atom — they can't be re-derived. */
|
||||
cso_save_state(cso, CSO_BIT_STREAM_OUTPUTS);
|
||||
|
||||
/* rasterizer state: just scissor */
|
||||
{
|
||||
|
|
@ -923,15 +927,16 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
|||
}
|
||||
}
|
||||
|
||||
/* restore state */
|
||||
/* Unbind all because st/mesa won't do it if the current shader doesn't
|
||||
* use them.
|
||||
/* Unbind sampler views bound directly on the pipe.
|
||||
* Restore atomless states (stream outputs) via CSO.
|
||||
*/
|
||||
cso_restore_state(cso, CSO_UNBIND_FS_SAMPLERVIEWS);
|
||||
st->state.num_sampler_views[MESA_SHADER_FRAGMENT] = 0;
|
||||
|
||||
ctx->Array.NewVertexElements = true;
|
||||
ST_SET_STATE2(ctx->NewDriverState, ST_NEW_VERTEX_ARRAYS, ST_NEW_FS_SAMPLER_VIEWS);
|
||||
/* Invalidate all states this meta-op modified. The atoms will
|
||||
* re-derive them from GL state before the next draw.
|
||||
*/
|
||||
st_context_invalidate_state(st, invalidate_flags);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue