summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_atom.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_atom.h')
-rw-r--r--src/mesa/state_tracker/st_atom.h210
1 files changed, 144 insertions, 66 deletions
diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h
index d5fb94141ca..871afc6ead5 100644
--- a/src/mesa/state_tracker/st_atom.h
+++ b/src/mesa/state_tracker/st_atom.h
@@ -36,82 +36,160 @@
#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