#include "state_tracker/st_manager.h"
#include "state_tracker/st_atom.h"
#include "state_tracker/st_context.h"
+#include "state_tracker/st_util.h"
#define BAD_MASK ~0u
if (ctx->NewState)
_mesa_update_state(ctx);
- if (ctx->NewDriverState & st->active_states &
- ST_PIPELINE_COMPUTE_STATE_MASK)
- st_validate_state(st, ST_PIPELINE_COMPUTE_STATE_MASK);
-
+ st_validate_state(st, ST_PIPELINE_COMPUTE_STATE_MASK);
}
static ALWAYS_INLINE void
#include "state_tracker/st_cb_eglimage.h"
#include "state_tracker/st_context.h"
#include "state_tracker/st_format.h"
+#include "state_tracker/st_util.h"
/**
* Notes:
#include "state_tracker/st_context.h"
#include "state_tracker/st_format.h"
-#include "state_tracker/st_context.h"
+#include "state_tracker/st_util.h"
/**
* Called via glSampleCoverageARB
#include "util/u_cpu_detect.h"
-typedef void (*update_func_t)(struct st_context *st);
-
/* The list state update functions. */
-static update_func_t update_functions[ST_NUM_ATOMS];
+st_update_func_t st_update_functions[ST_NUM_ATOMS];
static void
init_atoms_once(void)
{
-#define ST_STATE(FLAG, st_update) update_functions[FLAG##_INDEX] = st_update;
+#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)
- update_functions[ST_NEW_VERTEX_ARRAYS_INDEX] = st_update_array_with_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(update_functions) <= 64);
+ STATIC_ASSERT(ARRAY_SIZE(st_update_functions) <= 64);
static once_flag flag = ONCE_FLAG_INIT;
call_once(&flag, init_atoms_once);
{
/* no-op */
}
-
-/***********************************************************************
- * Update all derived state:
- */
-
-void st_validate_state(struct st_context *st, uint64_t pipeline_state_mask)
-{
- struct gl_context *ctx = st->ctx;
-
- /* Inactive states are shader states not used by shaders at the moment. */
- uint64_t dirty = ctx->NewDriverState & st->active_states & pipeline_state_mask;
- if (!dirty)
- return;
-
- ctx->NewDriverState &= ~dirty;
-
- uint32_t dirty_lo = dirty;
- uint32_t dirty_hi = dirty >> 32;
-
- /* Update states.
- *
- * Don't use u_bit_scan64, it may be slower on 32-bit.
- */
- while (dirty_lo)
- update_functions[u_bit_scan(&dirty_lo)](st);
- while (dirty_hi)
- update_functions[32 + u_bit_scan(&dirty_hi)](st);
-}
#define ST_ATOM_H
#include "util/glheader.h"
+#include "main/mtypes.h"
#ifdef __cplusplus
extern "C" {
void st_init_atoms( struct st_context *st );
void st_destroy_atoms( struct st_context *st );
-void st_validate_state(struct st_context *st, uint64_t pipeline_state_mask);
void
st_setup_arrays(struct st_context *st,
#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
* for bitmap drawing uses no constants and the FS constants are
* explicitly uploaded in the draw_bitmap_quad() function.
*/
- if (ctx->NewDriverState & st->active_states &
- ~ST_NEW_CONSTANTS & ST_PIPELINE_RENDER_STATE_MASK) {
- st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
- }
+ st_validate_state(st, ST_PIPELINE_META_STATE_MASK & ~ST_NEW_CONSTANTS);
struct pipe_sampler_view *view = NULL;
#include "st_draw.h"
#include "st_program.h"
#include "st_cb_rasterpos.h"
+#include "st_util.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
#include "vbo/vbo.h"
st_invalidate_readpix_cache(st);
/* Validate state. */
- if (ctx->NewDriverState & st->active_states & state_mask) {
- st_validate_state(st, state_mask);
- }
+ st_validate_state(st, state_mask);
/* Pin threads regularly to the same Zen CCX that the main thread is
* running on. The main thread can move between CCXs.
return false;
}
+static inline void
+st_validate_state(struct st_context *st, uint64_t pipeline_state_mask)
+{
+ struct gl_context *ctx = st->ctx;
+
+ /* Inactive states are shader states not used by shaders at the moment. */
+ uint64_t dirty = ctx->NewDriverState & st->active_states & pipeline_state_mask;
+
+ if (dirty) {
+ ctx->NewDriverState &= ~dirty;
+
+ uint32_t dirty_lo = dirty;
+ uint32_t dirty_hi = dirty >> 32;
+
+ /* Update states. Don't use u_bit_scan64 because 64-bit ffs (x86 BSF)
+ * is slower on x86_64 and emulated on i386.
+ */
+ while (dirty_lo)
+ st_update_functions[u_bit_scan(&dirty_lo)](st);
+ while (dirty_hi)
+ st_update_functions[32 + u_bit_scan(&dirty_hi)](st);
+ }
+}
+
#ifdef __cplusplus
}
#endif