st/mesa: add ST_PIPELINE_RENDER_NO_VARRAYS, for future display list support

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
This commit is contained in:
Marek Olšák 2021-08-11 23:27:13 -04:00 committed by Marge Bot
parent 7a2458f4bd
commit 74cb74045f
3 changed files with 17 additions and 11 deletions

View File

@ -186,6 +186,7 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
/* Get pipeline state. */
switch (pipeline) {
case ST_PIPELINE_RENDER:
case ST_PIPELINE_RENDER_NO_VARRAYS:
if (st->ctx->API == API_OPENGL_COMPAT)
check_attrib_edgeflag(st);
@ -196,7 +197,10 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
st_manager_validate_framebuffers(st);
pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK;
if (pipeline == ST_PIPELINE_RENDER)
pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK;
else
pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS;
break;
case ST_PIPELINE_CLEAR:

View File

@ -48,6 +48,7 @@ struct cso_velems_state;
*/
enum st_pipeline {
ST_PIPELINE_RENDER,
ST_PIPELINE_RENDER_NO_VARRAYS,
ST_PIPELINE_CLEAR,
ST_PIPELINE_META,
ST_PIPELINE_UPDATE_FRAMEBUFFER,
@ -160,12 +161,13 @@ enum {
/* All state flags within each group: */
#define ST_PIPELINE_RENDER_STATE_MASK (ST_NEW_CS_STATE - 1)
#define ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS \
(ST_PIPELINE_RENDER_STATE_MASK & ~ST_NEW_VERTEX_ARRAYS)
#define ST_PIPELINE_COMPUTE_STATE_MASK (0xffull << ST_NEW_CS_STATE_INDEX)
#define ST_PIPELINE_CLEAR_STATE_MASK (ST_NEW_FB_STATE | \
ST_NEW_SCISSOR | \
ST_NEW_WINDOW_RECTANGLES)
#define ST_PIPELINE_META_STATE_MASK (ST_PIPELINE_RENDER_STATE_MASK & \
~ST_NEW_VERTEX_ARRAYS)
#define ST_PIPELINE_META_STATE_MASK ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS
/* For ReadPixels, ReadBuffer, GetSamplePosition: */
#define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE)

View File

@ -87,7 +87,8 @@ translate_prim(const struct gl_context *ctx, unsigned prim)
}
static inline void
prepare_draw(struct st_context *st, struct gl_context *ctx)
prepare_draw(struct st_context *st, struct gl_context *ctx, uint64_t state_mask,
enum st_pipeline pipeline)
{
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
@ -98,10 +99,9 @@ prepare_draw(struct st_context *st, struct gl_context *ctx)
st_invalidate_readpix_cache(st);
/* Validate state. */
if ((st->dirty | ctx->NewDriverState) & st->active_states &
ST_PIPELINE_RENDER_STATE_MASK ||
if ((st->dirty | ctx->NewDriverState) & st->active_states & state_mask ||
st->gfx_shaders_may_be_dirty) {
st_validate_state(st, ST_PIPELINE_RENDER);
st_validate_state(st, pipeline);
}
/* Pin threads regularly to the same Zen CCX that the main thread is
@ -179,7 +179,7 @@ st_draw_gallium(struct gl_context *ctx,
{
struct st_context *st = st_context(ctx);
prepare_draw(st, ctx);
prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
return;
@ -196,7 +196,7 @@ st_draw_gallium_multimode(struct gl_context *ctx,
{
struct st_context *st = st_context(ctx);
prepare_draw(st, ctx);
prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
return;
@ -238,7 +238,7 @@ st_indirect_draw_vbo(struct gl_context *ctx,
struct pipe_draw_start_count_bias draw = {0};
assert(stride);
prepare_draw(st, ctx);
prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
memset(&indirect, 0, sizeof(indirect));
util_draw_init_info(&info);
@ -293,7 +293,7 @@ st_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
struct pipe_draw_indirect_info indirect;
struct pipe_draw_start_count_bias draw = {0};
prepare_draw(st, ctx);
prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
memset(&indirect, 0, sizeof(indirect));
util_draw_init_info(&info);