diff options
-rw-r--r-- | src/mesa/meson.build | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom.c | 69 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom.h | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 21 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 4 |
5 files changed, 23 insertions, 80 deletions
diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 86f30ab44f6..c664e9847e2 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -283,7 +283,6 @@ files_libmesa = files( 'program/symbol_table.h', 'state_tracker/st_atifs_to_nir.c', 'state_tracker/st_atifs_to_nir.h', - 'state_tracker/st_atom.c', 'state_tracker/st_atom_array.cpp', 'state_tracker/st_atom_atomicbuf.c', 'state_tracker/st_atom_blend.c', diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c deleted file mode 100644 index 3e33c2bfe96..00000000000 --- a/src/mesa/state_tracker/st_atom.c +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include <stdio.h> -#include "main/arrayobj.h" -#include "util/glheader.h" -#include "main/context.h" - -#include "pipe/p_defines.h" -#include "st_context.h" -#include "st_atom.h" -#include "st_program.h" -#include "st_manager.h" -#include "st_util.h" - -#include "util/u_cpu_detect.h" - - -/* The list state update functions. */ -st_update_func_t st_update_functions[ST_NUM_ATOMS]; - -static void -init_atoms_once(void) -{ -#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_init_atoms( struct st_context *st ) -{ - STATIC_ASSERT(ARRAY_SIZE(st_update_functions) <= 64); - - static once_flag flag = ONCE_FLAG_INIT; - call_once(&flag, init_atoms_once); -} - -void st_destroy_atoms( struct st_context *st ) -{ - /* no-op */ -} diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 11bfcb0bc67..3afee88bfb7 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -48,10 +48,6 @@ struct pipe_vertex_buffer; struct pipe_vertex_element; struct cso_velems_state; - -void st_init_atoms( struct st_context *st ); -void st_destroy_atoms( struct st_context *st ); - void st_setup_arrays(struct st_context *st, const struct gl_vertex_program *vp, @@ -183,10 +179,6 @@ enum { #define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \ ST_PIPELINE_COMPUTE_STATE_MASK) -typedef void (*st_update_func_t)(struct st_context *st); - -extern st_update_func_t st_update_functions[ST_NUM_ATOMS]; - #ifdef __cplusplus } #endif 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); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index da27faaa907..c3996a25da6 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -508,6 +508,10 @@ st_api_destroy_drawable(struct pipe_frontend_drawable *drawable); void st_screen_destroy(struct pipe_frontend_screen *fscreen); +typedef void (*st_update_func_t)(struct st_context *st); + +extern st_update_func_t st_update_functions[ST_NUM_ATOMS]; + #ifdef __cplusplus } #endif |