Squashed commit of the following:
[mesa.git] / src / mesa / state_tracker / st_context.h
index 18adb35e8721403b7217450823366ad73229cf09..f28d5aa3ed3737a95c796d7366b3d5391e3ea0e5 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;
@@ -55,6 +56,7 @@ struct bitmap_cache;
 #define ST_NEW_FRAGMENT_PROGRAM        0x2
 #define ST_NEW_VERTEX_PROGRAM          0x4
 #define ST_NEW_FRAMEBUFFER             0x8
+#define ST_NEW_EDGEFLAGS_DATA          0x10
 
 
 struct st_state_flags {
@@ -72,6 +74,8 @@ struct st_tracked_state {
 
 struct st_context
 {
+   struct st_context_iface iface;
+
    GLcontext *ctx;
 
    struct pipe_context *pipe;
@@ -91,9 +95,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_constant_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;
 
@@ -120,6 +124,7 @@ struct st_context
    struct st_state_flags dirty;
 
    GLboolean missing_textures;
+   GLboolean vertdata_edgeflags;
 
    /** Mapping from VERT_RESULT_x to post-transformed vertex slot */
    const GLuint *vertex_result_to_slot;
@@ -127,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 st_vp_varient *vp_varient;
+
    struct gl_texture_object *default_texture;
 
    struct {
@@ -136,7 +143,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;
 
@@ -147,7 +155,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;
@@ -155,20 +163,24 @@ struct st_context
    /** for glDraw/CopyPixels */
    struct {
       struct st_fragment_program *z_shader;
-      struct st_vertex_program *vert_shaders[2];
+      void *vert_shaders[2];   /**< ureg shaders */
    } drawpix;
 
    /** for glClear */
    struct {
       struct pipe_rasterizer_state raster;
       struct pipe_viewport_state viewport;
+      struct pipe_clip_state clip;
       void *vs;
       void *fs;
       float vertices[4][2][4];  /**< vertex pos + color */
-      struct pipe_buffer *vbuf;
+      struct pipe_resource *vbuf;
       unsigned vbuf_slot;
    } clear;
 
+   /** used for anything using util_draw_vertex_buffer */
+   struct pipe_vertex_element velems_util_draw[3];
+
    void *passthrough_fs;  /**< simple pass-through frag shader */
 
    struct gen_mipmap_state *gen_mipmap;
@@ -177,6 +189,7 @@ struct st_context
    struct cso_context *cso_context;
 
    int force_msaa;
+   void *winsys_drawable_handle;
 };
 
 
@@ -197,6 +210,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;
 };
 
 
@@ -235,7 +253,7 @@ 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))
+#define ST_CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))
 
 
 extern int