drisw: Move pointer dereferences to after NULL checks.
[mesa.git] / src / mesa / state_tracker / st_context.h
index e2d34fb3d1015adb39ae02e228ec0ef387257c92..dfee490b54a8f82ed13b7322d886f40e2b2dc63e 100644 (file)
@@ -31,6 +31,7 @@
 #include "main/mtypes.h"
 #include "shader/prog_cache.h"
 #include "pipe/p_state.h"
+#include "state_tracker/st_api.h"
 
 
 struct st_context;
@@ -45,12 +46,6 @@ struct blit_state;
 struct bitmap_cache;
 
 
-/** XXX we'd like to get rid of these */
-#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
@@ -73,6 +68,8 @@ struct st_tracked_state {
 
 struct st_context
 {
+   struct st_context_iface iface;
+
    GLcontext *ctx;
 
    struct pipe_context *pipe;
@@ -92,9 +89,9 @@ struct st_context
       struct pipe_sampler_state             samplers[PIPE_MAX_SAMPLERS];
       struct pipe_sampler_state             *sampler_list[PIPE_MAX_SAMPLERS];
       struct pipe_clip_state clip;
-      struct pipe_buffer *constants[2];
+      struct pipe_resource *constants[2];
       struct pipe_framebuffer_state framebuffer;
-      struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
+      struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
       struct pipe_scissor_state scissor;
       struct pipe_viewport_state viewport;
 
@@ -113,8 +110,6 @@ struct st_context
       struct gl_fragment_program *fragment_program;
    } cb;
 
-   GLuint frontbuffer_status;  /**< one of FRONT_STATUS_ (XXX to be removed) */
-
    char vendor[100];
    char renderer[100];
 
@@ -140,7 +135,8 @@ 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;
+      struct pipe_resource *pixelmap_texture;
+      struct pipe_sampler_view *pixelmap_sampler_view;
       boolean pixelmap_enabled;  /**< use the pixelmap texture? */
    } pixel_xfer;
 
@@ -151,7 +147,7 @@ struct st_context
       enum pipe_format tex_format;
       void *vs;
       float vertices[4][3][4];  /**< vertex pos + color + texcoord */
-      struct pipe_buffer *vbuf;
+      struct pipe_resource *vbuf;
       unsigned vbuf_slot;       /* next free slot in vbuf */
       struct bitmap_cache *cache;
    } bitmap;
@@ -170,7 +166,7 @@ struct st_context
       void *vs;
       void *fs;
       float vertices[4][2][4];  /**< vertex pos + color */
-      struct pipe_buffer *vbuf;
+      struct pipe_resource *vbuf;
       unsigned vbuf_slot;
    } clear;
 
@@ -206,6 +202,11 @@ struct st_framebuffer
    GLframebuffer Base;
    void *Private;
    GLuint InitWidth, InitHeight;
+
+   struct st_framebuffer_iface *iface;
+   enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
+   unsigned num_statts;
+   int32_t revalidate;
 };
 
 
@@ -250,5 +251,12 @@ st_fb_orientation(const struct gl_framebuffer *fb)
 extern int
 st_get_msaa(void);
 
+extern struct st_context *
+st_create_context(struct pipe_context *pipe, const __GLcontextModes *visual,
+                  struct st_context *share);
+
+extern void
+st_destroy_context(struct st_context *st);
+
 
 #endif