state_tracker/st_atom_depth.c \
state_tracker/st_atom_framebuffer.c \
state_tracker/st_atom.h \
+ state_tracker/st_atom_list.h \
state_tracker/st_atom_image.c \
state_tracker/st_atom_msaa.c \
state_tracker/st_atom_pixeltransfer.c \
#include "st_manager.h"
-/**
- * This is used to initialize st->render_atoms[].
- */
-static const struct st_tracked_state *render_atoms[] =
-{
- &st_update_depth_stencil_alpha,
- &st_update_clip,
-
- &st_update_fp,
- &st_update_gp,
- &st_update_tep,
- &st_update_tcp,
- &st_update_vp,
-
- &st_update_rasterizer,
- &st_update_polygon_stipple,
- &st_update_viewport,
- &st_update_scissor,
- &st_update_window_rectangles,
- &st_update_blend,
- &st_update_vertex_texture,
- &st_update_fragment_texture,
- &st_update_geometry_texture,
- &st_update_tessctrl_texture,
- &st_update_tesseval_texture,
- &st_update_sampler, /* depends on update_*_texture for swizzle */
- &st_bind_vs_images,
- &st_bind_tcs_images,
- &st_bind_tes_images,
- &st_bind_gs_images,
- &st_bind_fs_images,
- &st_update_framebuffer, /* depends on update_*_texture and bind_*_images */
- &st_update_msaa,
- &st_update_sample_shading,
- &st_update_vs_constants,
- &st_update_tcs_constants,
- &st_update_tes_constants,
- &st_update_gs_constants,
- &st_update_fs_constants,
- &st_bind_vs_ubos,
- &st_bind_tcs_ubos,
- &st_bind_tes_ubos,
- &st_bind_fs_ubos,
- &st_bind_gs_ubos,
- &st_bind_vs_atomics,
- &st_bind_tcs_atomics,
- &st_bind_tes_atomics,
- &st_bind_fs_atomics,
- &st_bind_gs_atomics,
- &st_bind_vs_ssbos,
- &st_bind_tcs_ssbos,
- &st_bind_tes_ssbos,
- &st_bind_fs_ssbos,
- &st_bind_gs_ssbos,
- &st_update_pixel_transfer,
- &st_update_tess,
-
- /* this must be done after the vertex program update */
- &st_update_array
-};
-
-
-/**
- * This is used to initialize st->compute_atoms[].
- */
-static const struct st_tracked_state *compute_atoms[] =
+/* The list state update functions. */
+static const struct st_tracked_state *atoms[] =
{
- &st_update_cp,
- &st_update_compute_texture,
- &st_update_sampler, /* depends on update_compute_texture for swizzle */
- &st_update_cs_constants,
- &st_bind_cs_ubos,
- &st_bind_cs_atomics,
- &st_bind_cs_ssbos,
- &st_bind_cs_images,
+#define ST_STATE(FLAG, st_update) &st_update,
+#include "st_atom_list.h"
+#undef ST_STATE
};
void st_init_atoms( struct st_context *st )
{
- /* no-op */
+ STATIC_ASSERT(ARRAY_SIZE(atoms) <= 64);
}
}
-
-static bool
-check_state(const struct st_state_flags *a, const struct st_state_flags *b)
-{
- return (a->mesa & b->mesa) || (a->st & b->st);
-}
-
/* Too complex to figure out, just check every time:
*/
static void check_program_state( struct st_context *st )
struct gl_context *ctx = st->ctx;
if (ctx->VertexProgram._Current != &st->vp->Base)
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ st->dirty |= ST_NEW_VERTEX_PROGRAM;
if (ctx->FragmentProgram._Current != &st->fp->Base)
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
if (ctx->GeometryProgram._Current != &st->gp->Base)
- st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
+ st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
}
static void check_attrib_edgeflag(struct st_context *st)
arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
if (vertdata_edgeflags != st->vertdata_edgeflags) {
st->vertdata_edgeflags = vertdata_edgeflags;
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ st->dirty |= ST_NEW_VERTEX_PROGRAM;
}
edgeflag_culls_prims = edgeflags_enabled && !vertdata_edgeflags &&
!st->ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0];
if (edgeflag_culls_prims != st->edgeflag_culls_prims) {
st->edgeflag_culls_prims = edgeflag_culls_prims;
- st->dirty.st |= ST_NEW_RASTERIZER;
+ st->dirty |= ST_NEW_RASTERIZER;
}
}
void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
{
- const struct st_tracked_state **atoms;
- struct st_state_flags *state;
- GLuint num_atoms;
- GLuint i;
+ uint64_t dirty, pipeline_mask;
+ uint32_t dirty_lo, dirty_hi;
+
+ /* Get Mesa driver state. */
+ st->dirty |= st->ctx->NewDriverState & ST_ALL_STATES_MASK;
+ st->ctx->NewDriverState = 0;
/* Get pipeline state. */
switch (pipeline) {
- case ST_PIPELINE_RENDER:
- atoms = render_atoms;
- num_atoms = ARRAY_SIZE(render_atoms);
- state = &st->dirty;
+ case ST_PIPELINE_RENDER:
+ check_attrib_edgeflag(st);
+ check_program_state(st);
+ st_manager_validate_framebuffers(st);
+
+ pipeline_mask = ST_PIPELINE_RENDER_STATE_MASK;
break;
case ST_PIPELINE_COMPUTE:
- atoms = compute_atoms;
- num_atoms = ARRAY_SIZE(compute_atoms);
- state = &st->dirty_cp;
+ pipeline_mask = ST_PIPELINE_COMPUTE_STATE_MASK;
break;
default:
unreachable("Invalid pipeline specified");
}
- /* Get Mesa driver state. */
- st->dirty.st |= st->ctx->NewDriverState;
- st->dirty_cp.st |= st->ctx->NewDriverState;
- st->ctx->NewDriverState = 0;
-
- if (pipeline == ST_PIPELINE_RENDER) {
- check_attrib_edgeflag(st);
-
- check_program_state(st);
-
- st_manager_validate_framebuffers(st);
- }
-
- if (state->st == 0 && state->mesa == 0)
+ dirty = st->dirty & pipeline_mask;
+ if (!dirty)
return;
- /*printf("%s %x/%x\n", __func__, state->mesa, state->st);*/
+ dirty_lo = dirty;
+ dirty_hi = dirty >> 32;
- for (i = 0; i < num_atoms; i++) {
- if (check_state(state, &atoms[i]->dirty))
- atoms[i]->update( st );
- }
+ /* Update states.
+ *
+ * Don't use u_bit_scan64, it may be slower on 32-bit.
+ */
+ while (dirty_lo)
+ atoms[u_bit_scan(&dirty_lo)]->update(st);
+ while (dirty_hi)
+ atoms[32 + u_bit_scan(&dirty_hi)]->update(st);
- memset(state, 0, sizeof(*state));
+ /* Clear the render or compute state bits. */
+ st->dirty &= ~pipeline_mask;
}
#include "main/glheader.h"
-#include "state_tracker/st_api.h"
-#include "state_tracker/st_context.h"
-
struct st_context;
-struct st_tracked_state;
+
+/**
+ * Enumeration of state tracker pipelines.
+ */
+enum st_pipeline {
+ ST_PIPELINE_RENDER,
+ ST_PIPELINE_COMPUTE,
+};
+
+struct st_tracked_state {
+ void (*update)( struct st_context *st );
+};
+
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 );
+GLuint st_compare_func_to_pipe(GLenum func);
+enum pipe_format
+st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
+ GLboolean normalized, GLboolean integer);
-void st_validate_state( struct st_context *st, enum st_pipeline pipeline );
+/* Define ST_NEW_xxx_INDEX */
+enum {
+#define ST_STATE(FLAG, st_update) FLAG##_INDEX,
+#include "st_atom_list.h"
+#undef ST_STATE
+};
-extern const struct st_tracked_state st_update_array;
-extern const struct st_tracked_state st_update_framebuffer;
-extern const struct st_tracked_state st_update_clip;
-extern const struct st_tracked_state st_update_depth_stencil_alpha;
-extern const struct st_tracked_state st_update_fp;
-extern const struct st_tracked_state st_update_gp;
-extern const struct st_tracked_state st_update_tep;
-extern const struct st_tracked_state st_update_tcp;
-extern const struct st_tracked_state st_update_vp;
-extern const struct st_tracked_state st_update_cp;
-extern const struct st_tracked_state st_update_rasterizer;
-extern const struct st_tracked_state st_update_polygon_stipple;
-extern const struct st_tracked_state st_update_viewport;
-extern const struct st_tracked_state st_update_scissor;
-extern const struct st_tracked_state st_update_window_rectangles;
-extern const struct st_tracked_state st_update_blend;
-extern const struct st_tracked_state st_update_msaa;
-extern const struct st_tracked_state st_update_sample_shading;
-extern const struct st_tracked_state st_update_sampler;
-extern const struct st_tracked_state st_update_fragment_texture;
-extern const struct st_tracked_state st_update_vertex_texture;
-extern const struct st_tracked_state st_update_geometry_texture;
-extern const struct st_tracked_state st_update_tessctrl_texture;
-extern const struct st_tracked_state st_update_tesseval_texture;
-extern const struct st_tracked_state st_update_compute_texture;
-extern const struct st_tracked_state st_update_fs_constants;
-extern const struct st_tracked_state st_update_gs_constants;
-extern const struct st_tracked_state st_update_tes_constants;
-extern const struct st_tracked_state st_update_tcs_constants;
-extern const struct st_tracked_state st_update_vs_constants;
-extern const struct st_tracked_state st_update_cs_constants;
-extern const struct st_tracked_state st_bind_fs_ubos;
-extern const struct st_tracked_state st_bind_vs_ubos;
-extern const struct st_tracked_state st_bind_gs_ubos;
-extern const struct st_tracked_state st_bind_tcs_ubos;
-extern const struct st_tracked_state st_bind_tes_ubos;
-extern const struct st_tracked_state st_bind_cs_ubos;
-extern const struct st_tracked_state st_bind_fs_atomics;
-extern const struct st_tracked_state st_bind_vs_atomics;
-extern const struct st_tracked_state st_bind_gs_atomics;
-extern const struct st_tracked_state st_bind_tcs_atomics;
-extern const struct st_tracked_state st_bind_tes_atomics;
-extern const struct st_tracked_state st_bind_cs_atomics;
-extern const struct st_tracked_state st_bind_fs_ssbos;
-extern const struct st_tracked_state st_bind_vs_ssbos;
-extern const struct st_tracked_state st_bind_gs_ssbos;
-extern const struct st_tracked_state st_bind_tcs_ssbos;
-extern const struct st_tracked_state st_bind_tes_ssbos;
-extern const struct st_tracked_state st_bind_cs_ssbos;
-extern const struct st_tracked_state st_bind_fs_images;
-extern const struct st_tracked_state st_bind_vs_images;
-extern const struct st_tracked_state st_bind_gs_images;
-extern const struct st_tracked_state st_bind_tcs_images;
-extern const struct st_tracked_state st_bind_tes_images;
-extern const struct st_tracked_state st_bind_cs_images;
-extern const struct st_tracked_state st_update_pixel_transfer;
-extern const struct st_tracked_state st_update_tess;
+/* Define ST_NEW_xxx */
+enum {
+#define ST_STATE(FLAG, st_update) FLAG = 1llu << FLAG##_INDEX,
+#include "st_atom_list.h"
+#undef ST_STATE
+};
+/* Add extern struct declarations. */
+#define ST_STATE(FLAG, st_update) extern const struct st_tracked_state st_update;
+#include "st_atom_list.h"
+#undef ST_STATE
-GLuint st_compare_func_to_pipe(GLenum func);
+/* Combined state flags. */
+#define ST_NEW_SAMPLERS (ST_NEW_RENDER_SAMPLERS | \
+ ST_NEW_CS_SAMPLERS)
-enum pipe_format
-st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
- GLboolean normalized, GLboolean integer);
+#define ST_NEW_FRAMEBUFFER (ST_NEW_FB_STATE | \
+ ST_NEW_SAMPLE_MASK | \
+ ST_NEW_SAMPLE_SHADING)
+
+#define ST_NEW_VERTEX_PROGRAM (ST_NEW_VS_STATE | \
+ ST_NEW_VS_SAMPLER_VIEWS | \
+ ST_NEW_VS_IMAGES | \
+ ST_NEW_VS_CONSTANTS | \
+ ST_NEW_VS_UBOS | \
+ ST_NEW_VS_ATOMICS | \
+ ST_NEW_VS_SSBOS | \
+ ST_NEW_VERTEX_ARRAYS | \
+ ST_NEW_CLIP_STATE | \
+ ST_NEW_RASTERIZER)
+
+#define ST_NEW_TESSCTRL_PROGRAM (ST_NEW_TCS_STATE | \
+ ST_NEW_TCS_SAMPLER_VIEWS | \
+ ST_NEW_TCS_IMAGES | \
+ ST_NEW_TCS_CONSTANTS | \
+ ST_NEW_TCS_UBOS | \
+ ST_NEW_TCS_ATOMICS | \
+ ST_NEW_TCS_SSBOS)
+
+#define ST_NEW_TESSEVAL_PROGRAM (ST_NEW_TES_STATE | \
+ ST_NEW_TES_SAMPLER_VIEWS | \
+ ST_NEW_TES_IMAGES | \
+ ST_NEW_TES_CONSTANTS | \
+ ST_NEW_TES_UBOS | \
+ ST_NEW_TES_ATOMICS | \
+ ST_NEW_TES_SSBOS | \
+ ST_NEW_RASTERIZER)
+
+#define ST_NEW_GEOMETRY_PROGRAM (ST_NEW_GS_STATE | \
+ ST_NEW_GS_SAMPLER_VIEWS | \
+ ST_NEW_GS_IMAGES | \
+ ST_NEW_GS_CONSTANTS | \
+ ST_NEW_GS_UBOS | \
+ ST_NEW_GS_ATOMICS | \
+ ST_NEW_GS_SSBOS | \
+ ST_NEW_RASTERIZER)
+
+#define ST_NEW_FRAGMENT_PROGRAM (ST_NEW_FS_STATE | \
+ ST_NEW_FS_SAMPLER_VIEWS | \
+ ST_NEW_FS_IMAGES | \
+ ST_NEW_FS_CONSTANTS | \
+ ST_NEW_FS_UBOS | \
+ ST_NEW_FS_ATOMICS | \
+ ST_NEW_FS_SSBOS | \
+ ST_NEW_SAMPLE_SHADING)
+
+#define ST_NEW_COMPUTE_PROGRAM (ST_NEW_CS_STATE | \
+ ST_NEW_CS_SAMPLER_VIEWS | \
+ ST_NEW_CS_IMAGES | \
+ ST_NEW_CS_CONSTANTS | \
+ ST_NEW_CS_UBOS | \
+ ST_NEW_CS_ATOMICS | \
+ ST_NEW_CS_SSBOS)
+
+#define ST_NEW_CONSTANTS (ST_NEW_VS_CONSTANTS | \
+ ST_NEW_TCS_CONSTANTS | \
+ ST_NEW_TES_CONSTANTS | \
+ ST_NEW_FS_CONSTANTS | \
+ ST_NEW_GS_CONSTANTS | \
+ ST_NEW_CS_CONSTANTS)
+
+#define ST_NEW_UNIFORM_BUFFER (ST_NEW_VS_UBOS | \
+ ST_NEW_TCS_UBOS | \
+ ST_NEW_TES_UBOS | \
+ ST_NEW_FS_UBOS | \
+ ST_NEW_GS_UBOS | \
+ ST_NEW_CS_UBOS)
+
+#define ST_NEW_SAMPLER_VIEWS (ST_NEW_VS_SAMPLER_VIEWS | \
+ ST_NEW_FS_SAMPLER_VIEWS | \
+ ST_NEW_GS_SAMPLER_VIEWS | \
+ ST_NEW_TCS_SAMPLER_VIEWS | \
+ ST_NEW_TES_SAMPLER_VIEWS | \
+ ST_NEW_CS_SAMPLER_VIEWS)
+
+#define ST_NEW_ATOMIC_BUFFER (ST_NEW_VS_ATOMICS | \
+ ST_NEW_TCS_ATOMICS | \
+ ST_NEW_TES_ATOMICS | \
+ ST_NEW_FS_ATOMICS | \
+ ST_NEW_GS_ATOMICS | \
+ ST_NEW_CS_ATOMICS)
+
+#define ST_NEW_STORAGE_BUFFER (ST_NEW_VS_SSBOS | \
+ ST_NEW_TCS_SSBOS | \
+ ST_NEW_TES_SSBOS | \
+ ST_NEW_FS_SSBOS | \
+ ST_NEW_GS_SSBOS | \
+ ST_NEW_CS_SSBOS)
+
+#define ST_NEW_IMAGE_UNITS (ST_NEW_VS_IMAGES | \
+ ST_NEW_TCS_IMAGES | \
+ ST_NEW_TES_IMAGES | \
+ ST_NEW_GS_IMAGES | \
+ ST_NEW_FS_IMAGES | \
+ ST_NEW_CS_IMAGES)
+
+/* All state flags within each group: */
+#define ST_PIPELINE_RENDER_STATE_MASK (ST_NEW_CS_STATE - 1)
+#define ST_PIPELINE_COMPUTE_STATE_MASK (ST_NEW_COMPUTE_PROGRAM | \
+ ST_NEW_CS_SAMPLERS)
+
+#define ST_ALL_STATES_MASK (ST_PIPELINE_RENDER_STATE_MASK | \
+ ST_PIPELINE_COMPUTE_STATE_MASK)
#endif
const struct st_tracked_state st_update_array = {
- { /* dirty */
- _NEW_CURRENT_ATTRIB, /* mesa */
- ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM, /* st */
- },
update_array /* update */
};
}
const struct st_tracked_state st_bind_vs_atomics = {
- {
- 0,
- ST_NEW_VERTEX_PROGRAM | ST_NEW_ATOMIC_BUFFER,
- },
bind_vs_atomics
};
}
const struct st_tracked_state st_bind_fs_atomics = {
- {
- 0,
- ST_NEW_FRAGMENT_PROGRAM | ST_NEW_ATOMIC_BUFFER,
- },
bind_fs_atomics
};
}
const struct st_tracked_state st_bind_gs_atomics = {
- {
- 0,
- ST_NEW_GEOMETRY_PROGRAM | ST_NEW_ATOMIC_BUFFER,
- },
bind_gs_atomics
};
}
const struct st_tracked_state st_bind_tcs_atomics = {
- {
- 0,
- ST_NEW_TESSCTRL_PROGRAM | ST_NEW_ATOMIC_BUFFER,
- },
bind_tcs_atomics
};
}
const struct st_tracked_state st_bind_tes_atomics = {
- {
- 0,
- ST_NEW_TESSEVAL_PROGRAM | ST_NEW_ATOMIC_BUFFER,
- },
bind_tes_atomics
};
}
const struct st_tracked_state st_bind_cs_atomics = {
- {
- 0,
- ST_NEW_COMPUTE_PROGRAM | ST_NEW_ATOMIC_BUFFER,
- },
bind_cs_atomics
};
const struct st_tracked_state st_update_blend = {
- { /* dirty */
- (_NEW_COLOR | _NEW_MULTISAMPLE), /* XXX _NEW_BLEND someday? */ /* mesa */
- 0, /* st */
- },
update_blend, /* update */
};
const struct st_tracked_state st_update_clip = {
- { /* dirty */
- _NEW_TRANSFORM | _NEW_PROJECTION, /* mesa */
- ST_NEW_VERTEX_PROGRAM, /* st */
- },
update_clip /* update */
};
const struct st_tracked_state st_update_vs_constants = {
- { /* dirty */
- _NEW_PROGRAM_CONSTANTS, /* mesa */
- ST_NEW_VERTEX_PROGRAM, /* st */
- },
update_vs_constants /* update */
};
const struct st_tracked_state st_update_fs_constants = {
- { /* dirty */
- _NEW_PROGRAM_CONSTANTS, /* mesa */
- ST_NEW_FRAGMENT_PROGRAM, /* st */
- },
update_fs_constants /* update */
};
}
const struct st_tracked_state st_update_gs_constants = {
- { /* dirty */
- _NEW_PROGRAM_CONSTANTS, /* mesa */
- ST_NEW_GEOMETRY_PROGRAM, /* st */
- },
update_gs_constants /* update */
};
}
const struct st_tracked_state st_update_tcs_constants = {
- { /* dirty */
- _NEW_PROGRAM_CONSTANTS, /* mesa */
- ST_NEW_TESSCTRL_PROGRAM, /* st */
- },
update_tcs_constants /* update */
};
}
const struct st_tracked_state st_update_tes_constants = {
- { /* dirty */
- _NEW_PROGRAM_CONSTANTS, /* mesa */
- ST_NEW_TESSEVAL_PROGRAM, /* st */
- },
update_tes_constants /* update */
};
}
const struct st_tracked_state st_update_cs_constants = {
- { /* dirty */
- _NEW_PROGRAM_CONSTANTS, /* mesa */
- ST_NEW_COMPUTE_PROGRAM, /* st */
- },
update_cs_constants /* update */
};
}
const struct st_tracked_state st_bind_vs_ubos = {
- {
- 0,
- ST_NEW_VERTEX_PROGRAM | ST_NEW_UNIFORM_BUFFER,
- },
bind_vs_ubos
};
}
const struct st_tracked_state st_bind_fs_ubos = {
- {
- 0,
- ST_NEW_FRAGMENT_PROGRAM | ST_NEW_UNIFORM_BUFFER,
- },
bind_fs_ubos
};
}
const struct st_tracked_state st_bind_gs_ubos = {
- {
- 0,
- ST_NEW_GEOMETRY_PROGRAM | ST_NEW_UNIFORM_BUFFER,
- },
bind_gs_ubos
};
}
const struct st_tracked_state st_bind_tcs_ubos = {
- {
- 0,
- ST_NEW_TESSCTRL_PROGRAM | ST_NEW_UNIFORM_BUFFER,
- },
bind_tcs_ubos
};
}
const struct st_tracked_state st_bind_tes_ubos = {
- {
- 0,
- ST_NEW_TESSEVAL_PROGRAM | ST_NEW_UNIFORM_BUFFER,
- },
bind_tes_ubos
};
}
const struct st_tracked_state st_bind_cs_ubos = {
- {
- 0,
- ST_NEW_COMPUTE_PROGRAM | ST_NEW_UNIFORM_BUFFER,
- },
bind_cs_ubos
};
const struct st_tracked_state st_update_depth_stencil_alpha = {
- { /* dirty */
- (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR|_NEW_BUFFERS),/* mesa */
- 0, /* st */
- },
update_depth_stencil_alpha /* update */
};
const struct st_tracked_state st_update_framebuffer = {
- { /* dirty */
- _NEW_BUFFERS, /* mesa */
- ST_NEW_FRAMEBUFFER, /* st */
- },
update_framebuffer_state /* update */
};
}
const struct st_tracked_state st_bind_vs_images = {
- {
- _NEW_TEXTURE,
- ST_NEW_VERTEX_PROGRAM | ST_NEW_IMAGE_UNITS,
- },
bind_vs_images
};
}
const struct st_tracked_state st_bind_fs_images = {
- {
- _NEW_TEXTURE,
- ST_NEW_FRAGMENT_PROGRAM | ST_NEW_IMAGE_UNITS,
- },
bind_fs_images
};
}
const struct st_tracked_state st_bind_gs_images = {
- {
- _NEW_TEXTURE,
- ST_NEW_GEOMETRY_PROGRAM | ST_NEW_IMAGE_UNITS,
- },
bind_gs_images
};
}
const struct st_tracked_state st_bind_tcs_images = {
- {
- _NEW_TEXTURE,
- ST_NEW_TESSCTRL_PROGRAM | ST_NEW_IMAGE_UNITS,
- },
bind_tcs_images
};
}
const struct st_tracked_state st_bind_tes_images = {
- {
- _NEW_TEXTURE,
- ST_NEW_TESSEVAL_PROGRAM | ST_NEW_IMAGE_UNITS,
- },
bind_tes_images
};
}
const struct st_tracked_state st_bind_cs_images = {
- {
- _NEW_TEXTURE,
- ST_NEW_COMPUTE_PROGRAM | ST_NEW_IMAGE_UNITS,
- },
bind_cs_images
};
--- /dev/null
+/* Render (non-compute) states must be first. */
+ST_STATE(ST_NEW_DSA, st_update_depth_stencil_alpha)
+ST_STATE(ST_NEW_CLIP_STATE, st_update_clip)
+
+ST_STATE(ST_NEW_FS_STATE, st_update_fp)
+ST_STATE(ST_NEW_GS_STATE, st_update_gp)
+ST_STATE(ST_NEW_TES_STATE, st_update_tep)
+ST_STATE(ST_NEW_TCS_STATE, st_update_tcp)
+ST_STATE(ST_NEW_VS_STATE, st_update_vp)
+
+ST_STATE(ST_NEW_RASTERIZER, st_update_rasterizer)
+ST_STATE(ST_NEW_POLY_STIPPLE, st_update_polygon_stipple)
+ST_STATE(ST_NEW_VIEWPORT, st_update_viewport)
+ST_STATE(ST_NEW_SCISSOR, st_update_scissor)
+ST_STATE(ST_NEW_WINDOW_RECTANGLES, st_update_window_rectangles)
+ST_STATE(ST_NEW_BLEND, st_update_blend)
+
+ST_STATE(ST_NEW_VS_SAMPLER_VIEWS, st_update_vertex_texture)
+ST_STATE(ST_NEW_FS_SAMPLER_VIEWS, st_update_fragment_texture)
+ST_STATE(ST_NEW_GS_SAMPLER_VIEWS, st_update_geometry_texture)
+ST_STATE(ST_NEW_TCS_SAMPLER_VIEWS, st_update_tessctrl_texture)
+ST_STATE(ST_NEW_TES_SAMPLER_VIEWS, st_update_tesseval_texture)
+
+/* Non-compute samplers. */
+ST_STATE(ST_NEW_RENDER_SAMPLERS, st_update_sampler) /* depends on update_*_texture for swizzle */
+
+ST_STATE(ST_NEW_VS_IMAGES, st_bind_vs_images)
+ST_STATE(ST_NEW_TCS_IMAGES, st_bind_tcs_images)
+ST_STATE(ST_NEW_TES_IMAGES, st_bind_tes_images)
+ST_STATE(ST_NEW_GS_IMAGES, st_bind_gs_images)
+ST_STATE(ST_NEW_FS_IMAGES, st_bind_fs_images)
+
+ST_STATE(ST_NEW_FB_STATE, st_update_framebuffer) /* depends on update_*_texture and bind_*_images */
+ST_STATE(ST_NEW_SAMPLE_MASK, st_update_msaa)
+ST_STATE(ST_NEW_SAMPLE_SHADING, st_update_sample_shading)
+
+ST_STATE(ST_NEW_VS_CONSTANTS, st_update_vs_constants)
+ST_STATE(ST_NEW_TCS_CONSTANTS, st_update_tcs_constants)
+ST_STATE(ST_NEW_TES_CONSTANTS, st_update_tes_constants)
+ST_STATE(ST_NEW_GS_CONSTANTS, st_update_gs_constants)
+ST_STATE(ST_NEW_FS_CONSTANTS, st_update_fs_constants)
+
+ST_STATE(ST_NEW_VS_UBOS, st_bind_vs_ubos)
+ST_STATE(ST_NEW_TCS_UBOS, st_bind_tcs_ubos)
+ST_STATE(ST_NEW_TES_UBOS, st_bind_tes_ubos)
+ST_STATE(ST_NEW_FS_UBOS, st_bind_fs_ubos)
+ST_STATE(ST_NEW_GS_UBOS, st_bind_gs_ubos)
+
+ST_STATE(ST_NEW_VS_ATOMICS, st_bind_vs_atomics)
+ST_STATE(ST_NEW_TCS_ATOMICS, st_bind_tcs_atomics)
+ST_STATE(ST_NEW_TES_ATOMICS, st_bind_tes_atomics)
+ST_STATE(ST_NEW_FS_ATOMICS, st_bind_fs_atomics)
+ST_STATE(ST_NEW_GS_ATOMICS, st_bind_gs_atomics)
+
+ST_STATE(ST_NEW_VS_SSBOS, st_bind_vs_ssbos)
+ST_STATE(ST_NEW_TCS_SSBOS, st_bind_tcs_ssbos)
+ST_STATE(ST_NEW_TES_SSBOS, st_bind_tes_ssbos)
+ST_STATE(ST_NEW_FS_SSBOS, st_bind_fs_ssbos)
+ST_STATE(ST_NEW_GS_SSBOS, st_bind_gs_ssbos)
+
+ST_STATE(ST_NEW_PIXEL_TRANSFER, st_update_pixel_transfer)
+ST_STATE(ST_NEW_TESS_STATE, st_update_tess)
+
+/* this must be done after the vertex program update */
+ST_STATE(ST_NEW_VERTEX_ARRAYS, st_update_array)
+
+/* Compute states must be last. */
+ST_STATE(ST_NEW_CS_STATE, st_update_cp)
+ST_STATE(ST_NEW_CS_SAMPLER_VIEWS, st_update_compute_texture)
+ST_STATE(ST_NEW_CS_SAMPLERS, st_update_sampler) /* depends on update_compute_texture for swizzle */
+ST_STATE(ST_NEW_CS_CONSTANTS, st_update_cs_constants)
+ST_STATE(ST_NEW_CS_UBOS, st_bind_cs_ubos)
+ST_STATE(ST_NEW_CS_ATOMICS, st_bind_cs_atomics)
+ST_STATE(ST_NEW_CS_SSBOS, st_bind_cs_ssbos)
+ST_STATE(ST_NEW_CS_IMAGES, st_bind_cs_images)
}
const struct st_tracked_state st_update_msaa = {
- { /* dirty */
- (_NEW_MULTISAMPLE | _NEW_BUFFERS), /* mesa */
- ST_NEW_FRAMEBUFFER, /* st */
- },
update_sample_mask /* update */
};
const struct st_tracked_state st_update_sample_shading = {
- { /* dirty */
- (_NEW_MULTISAMPLE | _NEW_PROGRAM | _NEW_BUFFERS), /* mesa */
- ST_NEW_FRAGMENT_PROGRAM | ST_NEW_FRAMEBUFFER, /* st */
- },
update_sample_shading /* update */
};
const struct st_tracked_state st_update_pixel_transfer = {
- { /* dirty */
- _NEW_PIXEL, /* mesa */
- 0, /* st */
- },
update_pixel_transfer /* update */
};
}
const struct st_tracked_state st_update_rasterizer = {
- {
- (_NEW_BUFFERS |
- _NEW_LIGHT |
- _NEW_LINE |
- _NEW_MULTISAMPLE |
- _NEW_POINT |
- _NEW_POLYGON |
- _NEW_PROGRAM |
- _NEW_SCISSOR |
- _NEW_FRAG_CLAMP |
- _NEW_TRANSFORM), /* mesa state dependencies*/
- (ST_NEW_VERTEX_PROGRAM |
- ST_NEW_TESSEVAL_PROGRAM |
- ST_NEW_GEOMETRY_PROGRAM |
- ST_NEW_RASTERIZER), /* state tracker dependencies */
- },
update_raster_state /* update function */
};
const struct st_tracked_state st_update_sampler = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- 0, /* st */
- },
update_samplers /* update */
};
}
const struct st_tracked_state st_update_scissor = {
- { /* dirty */
- (_NEW_SCISSOR | _NEW_BUFFERS), /* mesa */
- 0, /* st */
- },
update_scissor /* update */
};
const struct st_tracked_state st_update_window_rectangles = {
- { /* dirty */
- (_NEW_SCISSOR | _NEW_BUFFERS), /* mesa */
- 0, /* st */
- },
update_window_rectangles /* update */
};
const struct st_tracked_state st_update_fp = {
- { /* dirty */
- _NEW_BUFFERS | _NEW_MULTISAMPLE | _NEW_FOG, /* mesa */
- ST_NEW_FRAGMENT_PROGRAM /* st */
- },
update_fp /* update */
};
const struct st_tracked_state st_update_vp = {
- { /* dirty */
- 0, /* mesa */
- ST_NEW_VERTEX_PROGRAM /* st */
- },
update_vp /* update */
};
}
const struct st_tracked_state st_update_gp = {
- { /* dirty */
- 0, /* mesa */
- ST_NEW_GEOMETRY_PROGRAM /* st */
- },
update_gp /* update */
};
}
const struct st_tracked_state st_update_tcp = {
- { /* dirty */
- 0, /* mesa */
- ST_NEW_TESSCTRL_PROGRAM /* st */
- },
update_tcp /* update */
};
}
const struct st_tracked_state st_update_tep = {
- { /* dirty */
- 0, /* mesa */
- ST_NEW_TESSEVAL_PROGRAM /* st */
- },
update_tep /* update */
};
}
const struct st_tracked_state st_update_cp = {
- { /* dirty */
- 0, /* mesa */
- ST_NEW_COMPUTE_PROGRAM /* st */
- },
update_cp /* update */
};
/** Update the stipple when the pattern or window height changes */
const struct st_tracked_state st_update_polygon_stipple = {
- { /* dirty */
- (_NEW_POLYGONSTIPPLE |
- _NEW_BUFFERS), /* mesa */
- 0, /* st */
- },
update_stipple /* update */
};
}
const struct st_tracked_state st_bind_vs_ssbos = {
- {
- 0,
- ST_NEW_VERTEX_PROGRAM | ST_NEW_STORAGE_BUFFER,
- },
bind_vs_ssbos
};
}
const struct st_tracked_state st_bind_fs_ssbos = {
- {
- 0,
- ST_NEW_FRAGMENT_PROGRAM | ST_NEW_STORAGE_BUFFER,
- },
bind_fs_ssbos
};
}
const struct st_tracked_state st_bind_gs_ssbos = {
- {
- 0,
- ST_NEW_GEOMETRY_PROGRAM | ST_NEW_STORAGE_BUFFER,
- },
bind_gs_ssbos
};
}
const struct st_tracked_state st_bind_tcs_ssbos = {
- {
- 0,
- ST_NEW_TESSCTRL_PROGRAM | ST_NEW_STORAGE_BUFFER,
- },
bind_tcs_ssbos
};
}
const struct st_tracked_state st_bind_tes_ssbos = {
- {
- 0,
- ST_NEW_TESSEVAL_PROGRAM | ST_NEW_STORAGE_BUFFER,
- },
bind_tes_ssbos
};
}
const struct st_tracked_state st_bind_cs_ssbos = {
- {
- 0,
- ST_NEW_COMPUTE_PROGRAM | ST_NEW_STORAGE_BUFFER,
- },
bind_cs_ssbos
};
const struct st_tracked_state st_update_tess = {
- { /* dirty */
- 0, /* mesa */
- ST_NEW_TESS_STATE, /* st */
- },
update_tess /* update */
};
const struct st_tracked_state st_update_fragment_texture = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- ST_NEW_FRAGMENT_PROGRAM | ST_NEW_SAMPLER_VIEWS, /* st */
- },
update_fragment_textures /* update */
};
const struct st_tracked_state st_update_vertex_texture = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- ST_NEW_VERTEX_PROGRAM | ST_NEW_SAMPLER_VIEWS, /* st */
- },
update_vertex_textures /* update */
};
const struct st_tracked_state st_update_geometry_texture = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- ST_NEW_GEOMETRY_PROGRAM | ST_NEW_SAMPLER_VIEWS, /* st */
- },
update_geometry_textures /* update */
};
const struct st_tracked_state st_update_tessctrl_texture = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- ST_NEW_TESSCTRL_PROGRAM | ST_NEW_SAMPLER_VIEWS, /* st */
- },
update_tessctrl_textures /* update */
};
const struct st_tracked_state st_update_tesseval_texture = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- ST_NEW_TESSEVAL_PROGRAM | ST_NEW_SAMPLER_VIEWS, /* st */
- },
update_tesseval_textures /* update */
};
const struct st_tracked_state st_update_compute_texture = {
- { /* dirty */
- _NEW_TEXTURE, /* mesa */
- ST_NEW_COMPUTE_PROGRAM | ST_NEW_SAMPLER_VIEWS, /* st */
- },
update_compute_textures /* update */
};
const struct st_tracked_state st_update_viewport = {
- { /* dirty */
- _NEW_BUFFERS | _NEW_VIEWPORT, /* mesa */
- 0, /* st */
- },
update_viewport /* update */
};
restore_render_state(ctx);
/* We uploaded modified constants, need to invalidate them. */
- st->dirty.mesa |= _NEW_PROGRAM_CONSTANTS;
+ st->dirty |= ST_NEW_FS_CONSTANTS;
}
init_bitmap_state(st);
}
- /* We only need to validate state of the st dirty flags are set or
- * any non-_NEW_PROGRAM_CONSTANTS mesa flags are set. The VS we use
+ /* We only need to validate any non-ST_NEW_CONSTANTS state. The VS we use
* for bitmap drawing uses no constants and the FS constants are
* explicitly uploaded in the draw_bitmap_quad() function.
*/
- if ((st->dirty.mesa & ~_NEW_PROGRAM_CONSTANTS) || st->dirty.st) {
+ if ((st->dirty | ctx->NewDriverState) & ~ST_NEW_CONSTANTS &
+ ST_PIPELINE_RENDER_STATE_MASK) {
st_validate_state(st, ST_PIPELINE_RENDER);
}
pipe_sampler_view_reference(&sv, NULL);
/* We uploaded modified constants, need to invalidate them. */
- st->dirty.mesa |= _NEW_PROGRAM_CONSTANTS;
+ st->dirty |= ST_NEW_FS_CONSTANTS;
}
* might be using it.
*/
/* TODO: Add arrays to usage history */
- st->dirty.st |= ST_NEW_VERTEX_ARRAYS;
+ st->dirty |= ST_NEW_VERTEX_ARRAYS;
if (st_obj->Base.UsageHistory & USAGE_UNIFORM_BUFFER)
- st->dirty.st |= ST_NEW_UNIFORM_BUFFER;
+ st->dirty |= ST_NEW_UNIFORM_BUFFER;
if (st_obj->Base.UsageHistory & USAGE_SHADER_STORAGE_BUFFER)
- st->dirty.st |= ST_NEW_STORAGE_BUFFER;
+ st->dirty |= ST_NEW_STORAGE_BUFFER;
if (st_obj->Base.UsageHistory & USAGE_TEXTURE_BUFFER)
- st->dirty.st |= ST_NEW_SAMPLER_VIEWS | ST_NEW_IMAGE_UNITS;
+ st->dirty |= ST_NEW_SAMPLER_VIEWS | ST_NEW_IMAGE_UNITS;
if (st_obj->Base.UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER)
- st->dirty.st |= ST_NEW_ATOMIC_BUFFER;
+ st->dirty |= ST_NEW_ATOMIC_BUFFER;
return GL_TRUE;
}
if (ctx->NewState)
_mesa_update_state(ctx);
- if (st->dirty_cp.st || st->dirty_cp.mesa || ctx->NewDriverState)
+ if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_COMPUTE_STATE_MASK)
st_validate_state(st, ST_PIPELINE_COMPUTE);
for (unsigned i = 0; i < 3; i++) {
/* Plug in new vbo draw function */
vbo_set_draw_func(ctx, st_feedback_draw_vbo);
/* need to generate/use a vertex program that emits pos/color/tex */
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ st->dirty |= ST_NEW_VERTEX_PROGRAM;
}
}
switch (target) {
case GL_VERTEX_PROGRAM_ARB:
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ st->dirty |= ST_NEW_VERTEX_PROGRAM;
break;
case GL_FRAGMENT_PROGRAM_ARB:
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
break;
case GL_GEOMETRY_PROGRAM_NV:
- st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
+ st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
break;
case GL_TESS_CONTROL_PROGRAM_NV:
- st->dirty.st |= ST_NEW_TESSCTRL_PROGRAM;
+ st->dirty |= ST_NEW_TESSCTRL_PROGRAM;
break;
case GL_TESS_EVALUATION_PROGRAM_NV:
- st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM;
+ st->dirty |= ST_NEW_TESSEVAL_PROGRAM;
break;
case GL_COMPUTE_PROGRAM_NV:
- st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM;
+ st->dirty |= ST_NEW_COMPUTE_PROGRAM;
break;
}
}
{
struct st_context *st = st_context(ctx);
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
- st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
- st->dirty.st |= ST_NEW_TESSCTRL_PROGRAM;
- st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM;
- st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM;
+ st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
+ st->dirty |= ST_NEW_VERTEX_PROGRAM;
+ st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
+ st->dirty |= ST_NEW_TESSCTRL_PROGRAM;
+ st->dirty |= ST_NEW_TESSEVAL_PROGRAM;
+ st->dirty |= ST_NEW_COMPUTE_PROGRAM;
}
return false;
if (st->fp == stfp)
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
}
else if (target == GL_GEOMETRY_PROGRAM_NV) {
struct st_geometry_program *stgp = (struct st_geometry_program *) prog;
return false;
if (st->gp == stgp)
- st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
+ st->dirty |= ST_NEW_GEOMETRY_PROGRAM;
}
else if (target == GL_VERTEX_PROGRAM_ARB) {
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
return false;
if (st->vp == stvp)
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ st->dirty |= ST_NEW_VERTEX_PROGRAM;
}
else if (target == GL_TESS_CONTROL_PROGRAM_NV) {
struct st_tessctrl_program *sttcp =
return false;
if (st->tcp == sttcp)
- st->dirty.st |= ST_NEW_TESSCTRL_PROGRAM;
+ st->dirty |= ST_NEW_TESSCTRL_PROGRAM;
}
else if (target == GL_TESS_EVALUATION_PROGRAM_NV) {
struct st_tesseval_program *sttep =
return false;
if (st->tep == sttep)
- st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM;
+ st->dirty |= ST_NEW_TESSEVAL_PROGRAM;
}
else if (target == GL_COMPUTE_PROGRAM_NV) {
struct st_compute_program *stcp =
return false;
if (st->cp == stcp)
- st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM;
+ st->dirty |= ST_NEW_COMPUTE_PROGRAM;
}
else if (target == GL_FRAGMENT_SHADER_ATI) {
assert(prog);
return false;
if (st->fp == stfp)
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ st->dirty |= ST_NEW_FRAGMENT_PROGRAM;
}
if (ST_DEBUG & DEBUG_PRECOMPILE ||
*/
pipe_resource_reference(&stObj->pt, NULL);
st_texture_release_all_sampler_views(st, stObj);
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
+ st->dirty |= ST_NEW_FRAMEBUFFER;
}
}
{
struct st_context *st = st_context(ctx);
- /* Replace _NEW_FRAG_CLAMP with ST_NEW_FRAGMENT_PROGRAM for the fallback. */
- if (st->clamp_frag_color_in_shader && (new_state & _NEW_FRAG_CLAMP)) {
- new_state &= ~_NEW_FRAG_CLAMP;
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ if (new_state & _NEW_BUFFERS) {
+ st->dirty |= ST_NEW_DSA |
+ ST_NEW_FB_STATE |
+ ST_NEW_SAMPLE_MASK |
+ ST_NEW_SAMPLE_SHADING |
+ ST_NEW_FS_STATE |
+ ST_NEW_POLY_STIPPLE |
+ ST_NEW_VIEWPORT |
+ ST_NEW_RASTERIZER |
+ ST_NEW_SCISSOR |
+ ST_NEW_WINDOW_RECTANGLES;
+ } else {
+ /* These set a subset of flags set by _NEW_BUFFERS, so we only have to
+ * check them when _NEW_BUFFERS isn't set.
+ */
+ if (new_state & (_NEW_DEPTH |
+ _NEW_STENCIL))
+ st->dirty |= ST_NEW_DSA;
+
+ if (new_state & _NEW_PROGRAM)
+ st->dirty |= ST_NEW_SAMPLE_SHADING |
+ ST_NEW_RASTERIZER;
+
+ if (new_state & _NEW_SCISSOR)
+ st->dirty |= ST_NEW_RASTERIZER |
+ ST_NEW_SCISSOR |
+ ST_NEW_WINDOW_RECTANGLES;
+
+ if (new_state & _NEW_FOG)
+ st->dirty |= ST_NEW_FS_STATE;
+
+ if (new_state & _NEW_POLYGONSTIPPLE)
+ st->dirty |= ST_NEW_POLY_STIPPLE;
+
+ if (new_state & _NEW_VIEWPORT)
+ st->dirty |= ST_NEW_VIEWPORT;
+
+ if (new_state & _NEW_FRAG_CLAMP) {
+ if (st->clamp_frag_color_in_shader)
+ st->dirty |= ST_NEW_FS_STATE;
+ else
+ st->dirty |= ST_NEW_RASTERIZER;
+ }
}
- /* Update the vertex shader if ctx->Light._ClampVertexColor was changed. */
- if (st->clamp_vert_color_in_shader && (new_state & _NEW_LIGHT)) {
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ if (new_state & _NEW_MULTISAMPLE) {
+ st->dirty |= ST_NEW_BLEND |
+ ST_NEW_SAMPLE_MASK |
+ ST_NEW_SAMPLE_SHADING |
+ ST_NEW_RASTERIZER |
+ ST_NEW_FS_STATE;
+ } else {
+ /* These set a subset of flags set by _NEW_MULTISAMPLE, so we only
+ * have to check them when _NEW_MULTISAMPLE isn't set.
+ */
+ if (new_state & (_NEW_LIGHT |
+ _NEW_LINE |
+ _NEW_POINT |
+ _NEW_POLYGON |
+ _NEW_TRANSFORM))
+ st->dirty |= ST_NEW_RASTERIZER;
}
- /* Invalidate render and compute pipelines. */
- st->dirty.mesa |= new_state;
- st->dirty_cp.mesa |= new_state;
+ if (new_state & (_NEW_PROJECTION |
+ _NEW_TRANSFORM))
+ st->dirty |= ST_NEW_CLIP_STATE;
+
+ if (new_state & _NEW_COLOR)
+ st->dirty |= ST_NEW_BLEND |
+ ST_NEW_DSA;
+
+ if (new_state & _NEW_PIXEL)
+ st->dirty |= ST_NEW_PIXEL_TRANSFER;
+
+ if (new_state & _NEW_TEXTURE)
+ st->dirty |= ST_NEW_SAMPLER_VIEWS |
+ ST_NEW_SAMPLERS |
+ ST_NEW_IMAGE_UNITS;
+
+ if (new_state & _NEW_CURRENT_ATTRIB)
+ st->dirty |= ST_NEW_VERTEX_ARRAYS;
+
+ if (new_state & _NEW_PROGRAM_CONSTANTS)
+ st->dirty |= ST_NEW_CONSTANTS;
+
+ /* Update the vertex shader if ctx->Light._ClampVertexColor was changed. */
+ if (st->clamp_vert_color_in_shader && (new_state & _NEW_LIGHT))
+ st->dirty |= ST_NEW_VS_STATE;
/* This is the only core Mesa module we depend upon.
* No longer use swrast, swsetup, tnl.
/* state tracker needs the VBO module */
_vbo_CreateContext(ctx);
- /* Initialize render and compute pipelines flags */
- st->dirty.mesa = ~0;
- st->dirty.st = ~0;
- st->dirty_cp.mesa = ~0;
- st->dirty_cp.st = ~0;
+ st->dirty = ST_ALL_STATES_MASK;
/* Create upload manager for vertex data for glBitmap, glDrawPixels,
* glClear, etc.
#include "pipe/p_state.h"
#include "state_tracker/st_api.h"
#include "main/fbobject.h"
+#include "state_tracker/st_atom.h"
#ifdef __cplusplus
struct u_upload_mgr;
-/* gap */
-#define ST_NEW_FRAGMENT_PROGRAM (1 << 1)
-#define ST_NEW_VERTEX_PROGRAM (1 << 2)
-#define ST_NEW_FRAMEBUFFER (1 << 3)
-#define ST_NEW_TESS_STATE (1 << 4)
-#define ST_NEW_GEOMETRY_PROGRAM (1 << 5)
-#define ST_NEW_VERTEX_ARRAYS (1 << 6)
-#define ST_NEW_RASTERIZER (1 << 7)
-#define ST_NEW_UNIFORM_BUFFER (1 << 8)
-#define ST_NEW_TESSCTRL_PROGRAM (1 << 9)
-#define ST_NEW_TESSEVAL_PROGRAM (1 << 10)
-#define ST_NEW_SAMPLER_VIEWS (1 << 11)
-#define ST_NEW_ATOMIC_BUFFER (1 << 12)
-#define ST_NEW_STORAGE_BUFFER (1 << 13)
-#define ST_NEW_COMPUTE_PROGRAM (1 << 14)
-#define ST_NEW_IMAGE_UNITS (1 << 15)
-
-
-struct st_state_flags {
- GLbitfield mesa; /**< Mask of _NEW_x flags */
- uint32_t st; /**< Mask of ST_NEW_x flags */
-};
-
-struct st_tracked_state {
- struct st_state_flags dirty;
- void (*update)( struct st_context *st );
-};
-
-
-/**
- * Enumeration of state tracker pipelines.
- */
-enum st_pipeline {
- ST_PIPELINE_RENDER,
- ST_PIPELINE_COMPUTE,
-};
-
-
/** For drawing quads for glClear, glDraw/CopyPixels, glBitmap, etc. */
struct st_util_vertex
{
char vendor[100];
char renderer[100];
- struct st_state_flags dirty;
- struct st_state_flags dirty_cp;
+ uint64_t dirty; /**< dirty states */
GLboolean vertdata_edgeflags;
GLboolean edgeflag_culls_prims;
st_invalidate_readpix_cache(st);
/* Validate state. */
- if (st->dirty.st || st->dirty.mesa || ctx->NewDriverState) {
+ if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_RENDER_STATE_MASK) {
st_validate_state(st, ST_PIPELINE_RENDER);
}
assert(stride);
/* Validate state. */
- if (st->dirty.st || st->dirty.mesa || ctx->NewDriverState) {
+ if ((st->dirty | ctx->NewDriverState) & ST_PIPELINE_RENDER_STATE_MASK) {
st_validate_state(st, ST_PIPELINE_RENDER);
}
struct st_framebuffer *stread)
{
if (stdraw && stdraw->stamp != st->draw_stamp) {
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
+ st->dirty |= ST_NEW_FRAMEBUFFER;
_mesa_resize_framebuffer(st->ctx, &stdraw->Base,
stdraw->Base.Width,
stdraw->Base.Height);
if (stread && stread->stamp != st->read_stamp) {
if (stread != stdraw) {
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
+ st->dirty |= ST_NEW_FRAMEBUFFER;
_mesa_resize_framebuffer(st->ctx, &stread->Base,
stread->Base.Width,
stread->Base.Height);