intel / DRI2: When available, use DRI2GetBuffersWithFormat
[mesa.git] / src / mesa / state_tracker / st_context.h
index 212687cf4ab56f7825062049bcad1a11ca39f9f7..f840579a4042f627d98168105cf8800e51b00ba6 100644 (file)
@@ -45,9 +45,15 @@ struct blit_state;
 struct bitmap_cache;
 
 
+#define FRONT_STATUS_UNDEFINED    0
+#define FRONT_STATUS_DIRTY        1
+#define FRONT_STATUS_COPY_OF_BACK 2
+
+
 #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 {
@@ -87,16 +93,17 @@ struct st_context
       struct pipe_constant_buffer constants[2];
       struct pipe_framebuffer_state framebuffer;
       struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
-      struct pipe_poly_stipple poly_stipple;
       struct pipe_scissor_state scissor;
       struct pipe_viewport_state viewport;
 
       GLuint num_samplers;
       GLuint num_textures;
+
+      GLuint poly_stipple[32];  /**< In OpenGL's bottom-to-top order */
    } state;
 
    struct {
-      struct st_tracked_state tracked_state[2];
+      struct st_tracked_state tracked_state[PIPE_SHADER_TYPES];
    } constants;
 
    /* XXX unused: */
@@ -104,23 +111,16 @@ struct st_context
       struct gl_fragment_program *fragment_program;
    } cb;
 
-   struct {
-      GLuint frontbuffer_dirty:1;
-   } flags;
+   GLuint frontbuffer_status;  /**< one of FRONT_STATUS_ */
 
    char vendor[100];
    char renderer[100];
 
-   /* State to be validated:
-    */
-   struct st_tracked_state **atoms;
-   GLuint nr_atoms;
-
    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;
@@ -128,6 +128,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 */
@@ -135,38 +137,47 @@ 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;
-      struct pipe_shader_state frag_shader;
       struct pipe_rasterizer_state raster;
       struct pipe_viewport_state viewport;
       void *vs;
       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;
 };
 
 
@@ -224,4 +235,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