gallium: Unify reference counting.
[mesa.git] / src / mesa / state_tracker / st_context.h
index d89e54c43c14e599862be6f1270a64c980d827db..3547925ad7f320a7382d23d9df6e85613276ee05 100644 (file)
@@ -53,6 +53,7 @@ struct bitmap_cache;
 #define ST_NEW_MESA                    0x1 /* Mesa state has changed */
 #define ST_NEW_FRAGMENT_PROGRAM        0x2
 #define ST_NEW_VERTEX_PROGRAM          0x4
+#define ST_NEW_FRAMEBUFFER             0x8
 
 
 struct st_state_flags {
@@ -101,7 +102,7 @@ struct st_context
    } state;
 
    struct {
-      struct st_tracked_state tracked_state[2];
+      struct st_tracked_state tracked_state[PIPE_SHADER_TYPES];
    } constants;
 
    /* XXX unused: */
@@ -121,9 +122,9 @@ struct st_context
 
    struct st_state_flags dirty;
 
-   GLfloat polygon_offset_scale; /* ?? */
+   GLboolean missing_textures;
 
-   GLfloat bitmap_texcoord_bias;
+   GLfloat polygon_offset_scale; /* ?? */
 
    /** Mapping from VERT_RESULT_x to post-transformed vertex slot */
    const GLuint *vertex_result_to_slot;
@@ -131,6 +132,8 @@ struct st_context
    struct st_vertex_program *vp;    /**< Currently bound vertex program */
    struct st_fragment_program *fp;  /**< Currently bound fragment program */
 
+   struct gl_texture_object *default_texture;
+
    struct {
       struct gl_program_cache *cache;
       struct st_fragment_program *program;  /**< cur pixel transfer prog */
@@ -138,22 +141,29 @@ struct st_context
       GLuint user_prog_sn;  /**< user fragment program serial no. */
       struct st_fragment_program *combined_prog;
       GLuint combined_prog_sn;
+      struct pipe_texture *pixelmap_texture;
+      boolean pixelmap_enabled;  /**< use the pixelmap texture? */
    } pixel_xfer;
 
    /** for glBitmap */
    struct {
-      struct st_fragment_program *program;  /**< bitmap tex/kil program */
-      GLuint user_prog_sn;  /**< user fragment program serial no. */
-      struct st_fragment_program *combined_prog;
       struct pipe_rasterizer_state rasterizer;
       struct pipe_sampler_state sampler;
       struct pipe_shader_state vert_shader;
+      enum pipe_format tex_format;
       void *vs;
       float vertices[4][3][4];  /**< vertex pos + color + texcoord */
       struct pipe_buffer *vbuf;
+      unsigned vbuf_slot;       /* next free slot in vbuf */
       struct bitmap_cache *cache;
    } bitmap;
 
+   /** for glDraw/CopyPixels */
+   struct {
+      struct st_fragment_program *z_shader;
+      struct st_vertex_program *vert_shaders[2];
+   } drawpix;
+
    /** for glClear */
    struct {
       struct pipe_shader_state vert_shader;
@@ -164,12 +174,17 @@ struct st_context
       void *fs;
       float vertices[4][2][4];  /**< vertex pos + color */
       struct pipe_buffer *vbuf;
+      unsigned vbuf_slot;
    } clear;
 
+   void *passthrough_fs;  /**< simple pass-through frag shader */
+
    struct gen_mipmap_state *gen_mipmap;
    struct blit_state *blit;
 
    struct cso_context *cso_context;
+
+   int force_msaa;
 };
 
 
@@ -227,4 +242,12 @@ st_fb_orientation(const struct gl_framebuffer *fb)
 }
 
 
+/** clear-alloc a struct-sized object, with casting */
+#define ST_CALLOC_STRUCT(T)   (struct T *) _mesa_calloc(sizeof(struct T))
+
+
+extern int
+st_get_msaa(void);
+
+
 #endif