Mesa (main): st/mesa: add ST_PIPELINE_RENDER_NO_VARRAYS, for future display list support
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 15:45:22 UTC 2021
Module: Mesa
Branch: main
Commit: 74cb74045ff0c223be43f5a7961440fa49b871f1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=74cb74045ff0c223be43f5a7961440fa49b871f1
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Aug 11 23:27:13 2021 -0400
st/mesa: add ST_PIPELINE_RENDER_NO_VARRAYS, for future display list support
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
---
src/mesa/state_tracker/st_atom.c | 6 +++++-
src/mesa/state_tracker/st_atom.h | 6 ++++--
src/mesa/state_tracker/st_draw.c | 16 ++++++++--------
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 181134a2207..8ba57130565 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -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:
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index 79546a6e84d..a9806bacd82 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -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)
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 28eb69e52d7..83f429efab6 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -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);
More information about the mesa-commit
mailing list