gallium: Use enum pipe_shader_type in set_sampler_views()
[mesa.git] / src / mesa / state_tracker / st_context.h
index b3cf285984ff057d425ffa01edc4d9caec0dbb6a..2b783e0028193aa500cf92957b41503b05bde51a 100644 (file)
@@ -32,6 +32,7 @@
 #include "pipe/p_state.h"
 #include "state_tracker/st_api.h"
 #include "main/fbobject.h"
+#include "state_tracker/st_atom.h"
 
 
 #ifdef __cplusplus
@@ -50,44 +51,6 @@ struct st_perf_monitor_group;
 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
 {
@@ -175,8 +138,16 @@ struct st_context
    char vendor[100];
    char renderer[100];
 
-   struct st_state_flags dirty;
-   struct st_state_flags dirty_cp;
+   uint64_t dirty; /**< dirty states */
+
+   /** This masks out unused shader resources. Only valid in draw calls. */
+   uint64_t active_states;
+
+   /* If true, further analysis of states is required to know if something
+    * has changed. Used mainly for shaders.
+    */
+   bool gfx_shaders_may_be_dirty;
+   bool compute_shader_may_be_dirty;
 
    GLboolean vertdata_edgeflags;
    GLboolean edgeflag_culls_prims;
@@ -346,7 +317,7 @@ st_fb_orientation(const struct gl_framebuffer *fb)
 }
 
 
-static inline unsigned
+static inline enum pipe_shader_type
 st_shader_stage_to_ptarget(gl_shader_stage stage)
 {
    switch (stage) {
@@ -368,6 +339,13 @@ st_shader_stage_to_ptarget(gl_shader_stage stage)
    return PIPE_SHADER_VERTEX;
 }
 
+static inline bool
+st_user_clip_planes_enabled(struct gl_context *ctx)
+{
+   return (ctx->API == API_OPENGL_COMPAT ||
+           ctx->API == API_OPENGLES) && /* only ES 1.x */
+          ctx->Transform.ClipPlanesEnabled;
+}
 
 /** clear-alloc a struct-sized object, with casting */
 #define ST_CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))
@@ -382,6 +360,9 @@ st_create_context(gl_api api, struct pipe_context *pipe,
 extern void
 st_destroy_context(struct st_context *st);
 
+uint64_t
+st_get_active_states(struct gl_context *ctx);
+
 
 #ifdef __cplusplus
 }