/* add the buffer */
st_manager_add_color_renderbuffer(ctx, fb, fb->_ColorReadBufferIndex);
_mesa_update_state(ctx);
- st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FRAMEBUFFER);
+ st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FB_STATE_MASK);
}
}
}
if (ctx->NewDriverState & st->active_states &
ST_PIPELINE_COMPUTE_STATE_MASK)
- st_validate_state(st, ST_PIPELINE_COMPUTE);
+ st_validate_state(st, ST_PIPELINE_COMPUTE_STATE_MASK);
}
return;
}
- st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FRAMEBUFFER);
+ st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FB_STATE_MASK);
ctx->pipe->evaluate_depth_buffer(ctx->pipe);
}
{
struct st_context *st = st_context(ctx);
- st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER);
+ st_validate_state(st, ST_PIPELINE_UPDATE_FB_STATE_MASK);
if (ctx->pipe->get_sample_position)
ctx->pipe->get_sample_position(ctx->pipe,
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = ctx->pipe->screen;
- st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER);
+ st_validate_state(st, ST_PIPELINE_UPDATE_FB_STATE_MASK);
*outBits = 4;
*outWidth = 1;
* Update all derived state:
*/
-void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
+void st_validate_state(struct st_context *st, uint64_t pipeline_state_mask)
{
struct gl_context *ctx = st->ctx;
- uint64_t pipeline_mask;
-
- /* Get pipeline state. */
- switch (pipeline) {
- case ST_PIPELINE_RENDER:
- case ST_PIPELINE_RENDER_NO_VARRAYS:
- 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:
- pipeline_mask = ST_PIPELINE_CLEAR_STATE_MASK;
- break;
-
- case ST_PIPELINE_META:
- pipeline_mask = ST_PIPELINE_META_STATE_MASK;
- break;
-
- case ST_PIPELINE_UPDATE_FRAMEBUFFER:
- pipeline_mask = ST_PIPELINE_UPDATE_FB_STATE_MASK;
- break;
-
- case ST_PIPELINE_COMPUTE: {
- /*
- * We add the ST_NEW_FB_STATE bit here as well, because glBindFramebuffer
- * acts as a barrier that breaks feedback loops between the framebuffer
- * and textures bound to the framebuffer, even when those textures are
- * accessed by compute shaders; so we must inform the driver of new
- * framebuffer state.
- */
- pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK | ST_NEW_FB_STATE;
- break;
- }
-
- default:
- unreachable("Invalid pipeline specified");
- }
/* Inactive states are shader states not used by shaders at the moment. */
- uint64_t dirty = ctx->NewDriverState & st->active_states & pipeline_mask;
+ uint64_t dirty = ctx->NewDriverState & st->active_states & pipeline_state_mask;
if (!dirty)
return;
struct pipe_vertex_element;
struct cso_velems_state;
-/**
- * Enumeration of state tracker pipelines.
- */
-enum st_pipeline {
- ST_PIPELINE_RENDER,
- ST_PIPELINE_RENDER_NO_VARRAYS,
- ST_PIPELINE_CLEAR,
- ST_PIPELINE_META,
- ST_PIPELINE_UPDATE_FRAMEBUFFER,
- ST_PIPELINE_COMPUTE,
-};
void st_init_atoms( struct st_context *st );
void st_destroy_atoms( struct st_context *st );
-void st_validate_state( struct st_context *st, enum st_pipeline pipeline );
+void st_validate_state(struct st_context *st, uint64_t pipeline_state_mask);
void
st_setup_arrays(struct st_context *st,
#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)
/* For ReadPixels, ReadBuffer, GetSamplePosition: */
#define ST_PIPELINE_UPDATE_FB_STATE_MASK (ST_NEW_FB_STATE)
+/* We add the ST_NEW_FB_STATE bit here as well, because glBindFramebuffer
+ * acts as a barrier that breaks feedback loops between the framebuffer
+ * and textures bound to the framebuffer, even when those textures are
+ * accessed by compute shaders; so we must inform the driver of new
+ * framebuffer state.
+ */
+#define ST_PIPELINE_COMPUTE_STATE_MASK ((0xffull << ST_NEW_CS_STATE_INDEX) | \
+ ST_NEW_FB_STATE)
+
#define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \
ST_PIPELINE_COMPUTE_STATE_MASK)
*/
if (ctx->NewDriverState & st->active_states &
~ST_NEW_CONSTANTS & ST_PIPELINE_RENDER_STATE_MASK) {
- st_validate_state(st, ST_PIPELINE_META);
+ st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
}
struct pipe_sampler_view *view = NULL;
st_invalidate_readpix_cache(st);
/* This makes sure the pipe has the latest scissor, etc values */
- st_validate_state(st, ST_PIPELINE_CLEAR);
+ st_validate_state(st, ST_PIPELINE_CLEAR_STATE_MASK);
if (mask & BUFFER_BITS_COLOR) {
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
- st_validate_state(st, ST_PIPELINE_META);
+ st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
clippedUnpack = *unpack;
unpack = &clippedUnpack;
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
- st_validate_state(st, ST_PIPELINE_META);
+ st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
if (blit_copy_pixels(ctx, srcx, srcy, width, height, dstx, dsty, type))
return;
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
- st_validate_state(st, ST_PIPELINE_META);
+ st_validate_state(st, ST_PIPELINE_META_STATE_MASK);
/* determine if we need vertex color */
if (ctx->FragmentProgram._Current->info.inputs_read & VARYING_BIT_COL0)
draw_set_rasterize_stage(st->draw, st->rastpos_stage);
/* make sure everything's up to date */
- st_validate_state(st, ST_PIPELINE_RENDER);
+ st_validate_state(st, ST_PIPELINE_RENDER_STATE_MASK);
/* This will get set only if rastpos_point(), above, gets called */
ctx->PopAttribState |= GL_CURRENT_BIT;
/* Validate state (to be sure we have up-to-date framebuffer surfaces)
* and flush the bitmap cache prior to reading. */
- st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER);
+ st_validate_state(st, ST_PIPELINE_UPDATE_FB_STATE_MASK);
st_flush_bitmap_cache(st);
if (!st->prefer_blit_based_texture_transfer) {
static_assert(GL_PATCHES == PIPE_PRIM_PATCHES, "enum mismatch");
static inline void
-prepare_draw(struct st_context *st, struct gl_context *ctx, uint64_t state_mask,
- enum st_pipeline pipeline)
+prepare_draw(struct st_context *st, struct gl_context *ctx, uint64_t state_mask)
{
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
/* Validate state. */
if (ctx->NewDriverState & st->active_states & state_mask) {
- st_validate_state(st, pipeline);
+ st_validate_state(st, state_mask);
}
/* Pin threads regularly to the same Zen CCX that the main thread is
{
struct st_context *st = st_context(ctx);
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK);
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
return;
{
struct st_context *st = st_context(ctx);
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK);
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
return;
return;
assert(stride);
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK);
memset(&indirect, 0, sizeof(indirect));
util_draw_init_info(&info);
struct pipe_draw_indirect_info indirect;
struct pipe_draw_start_count_bias draw = {0};
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK);
memset(&indirect, 0, sizeof(indirect));
util_draw_init_info(&info);
{
struct st_context *st = st_context(ctx);
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS,
- ST_PIPELINE_RENDER_NO_VARRAYS);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK_NO_VARRAYS);
struct pipe_context *pipe = st->pipe;
uint32_t velem_mask = ctx->VertexProgram._Current->info.inputs_read;
{
struct st_context *st = st_context(ctx);
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK);
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
return;
{
struct st_context *st = st_context(ctx);
- prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK, ST_PIPELINE_RENDER);
+ prepare_draw(st, ctx, ST_PIPELINE_RENDER_STATE_MASK);
if (!prepare_indexed_draw(st, ctx, info, draws, num_draws))
return;
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
- st_validate_state(st, ST_PIPELINE_RENDER);
+ st_validate_state(st, ST_PIPELINE_RENDER_STATE_MASK);
if (info->index_size && info->has_user_indices && !info->index_bounds_valid) {
vbo_get_minmax_indices_gallium(ctx, info, draws, num_draws);