summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2022-11-21 08:03:23 -0500
committerMarge Bot <emma+marge@anholt.net>2022-12-12 19:15:34 +0000
commitee308fb9ae5a0c8dbd6f6c9e53b09ff871ab3bdb (patch)
treef2676f446f7613c90dfe35b1326ecc36e0ce6cfc /src/mesa/state_tracker/st_context.c
parentae2b9112174985af2de213c928afc4b7fde630c1 (diff)
st/mesa: move st_atom.c contents into st_context.c
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19953>
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r--src/mesa/state_tracker/st_context.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index eda6649eddf..cd2154eff11 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -71,6 +71,22 @@
DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
+/* The list of state update functions. */
+st_update_func_t st_update_functions[ST_NUM_ATOMS];
+
+static void
+init_atoms_once(void)
+{
+ STATIC_ASSERT(ARRAY_SIZE(st_update_functions) <= 64);
+
+#define ST_STATE(FLAG, st_update) st_update_functions[FLAG##_INDEX] = st_update;
+#include "st_atom_list.h"
+#undef ST_STATE
+
+ if (util_get_cpu_caps()->has_popcnt)
+ st_update_functions[ST_NEW_VERTEX_ARRAYS_INDEX] = st_update_array_with_popcnt;
+}
+
void
st_invalidate_buffers(struct st_context *st)
{
@@ -331,7 +347,6 @@ st_context_free_zombie_objects(struct st_context *st)
static void
st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
{
- st_destroy_atoms(st);
st_destroy_draw(st);
st_destroy_clear(st);
st_destroy_bitmap(st);
@@ -475,7 +490,9 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
st->cso_context = cso_create_context(pipe, cso_flags);
ctx->cso_context = st->cso_context;
- st_init_atoms(st);
+ static once_flag flag = ONCE_FLAG_INIT;
+ call_once(&flag, init_atoms_once);
+
st_init_clear(st);
{
enum pipe_texture_transfer_mode val = screen->get_param(screen, PIPE_CAP_TEXTURE_TRANSFER_MODES);