gallium: pass the current context to the flush_front state tracker function
authorMarek Olšák <maraeo@gmail.com>
Mon, 3 Dec 2012 15:24:59 +0000 (16:24 +0100)
committerMarek Olšák <maraeo@gmail.com>
Fri, 7 Dec 2012 13:19:29 +0000 (14:19 +0100)
I will later use the context to resolve an MSAA front buffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/common/dri_drawable.c
src/gallium/state_trackers/dri/common/dri_drawable.h
src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/state_trackers/dri/sw/drisw.c
src/gallium/state_trackers/egl/common/egl_g3d_st.c
src/gallium/state_trackers/glx/xlib/xm_st.c
src/gallium/state_trackers/vega/vg_manager.c
src/gallium/state_trackers/wgl/stw_st.c
src/mesa/state_tracker/st_manager.c

index 91c5529a1f5ed371c9603b57922858a0358f9943..419f825696cc7ab84620204a7d6318a7f3d01d05 100644 (file)
@@ -269,6 +269,8 @@ struct st_context_attribs
    struct st_config_options options;
 };
 
+struct st_context_iface;
+
 /**
  * Represent a windowing system drawable.
  *
@@ -313,7 +315,8 @@ struct st_framebuffer_iface
     *
     * @att is one of the front buffer attachments.
     */
-   boolean (*flush_front)(struct st_framebuffer_iface *stfbi,
+   boolean (*flush_front)(struct st_context_iface *stctx,
+                          struct st_framebuffer_iface *stfbi,
                           enum st_attachment_type statt);
 
    /**
index 7e87f87ed67e242e00714fb7c307f5c5b4379f63..dca6def284c8c83ac9d50a8fb4d6ce6a36cc2662 100644 (file)
@@ -100,14 +100,16 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
 }
 
 static boolean
-dri_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
+dri_st_framebuffer_flush_front(struct st_context_iface *stctx,
+                               struct st_framebuffer_iface *stfbi,
                                enum st_attachment_type statt)
 {
+   struct dri_context *ctx = (struct dri_context *)stctx->st_manager_private;
    struct dri_drawable *drawable =
       (struct dri_drawable *) stfbi->st_manager_private;
 
    /* XXX remove this and just set the correct one on the framebuffer */
-   drawable->flush_frontbuffer(drawable, statt);
+   drawable->flush_frontbuffer(ctx, drawable, statt);
 
    return TRUE;
 }
index 6336c81a7155a524eb1bbea22a1beec07f88ab14..6a769910fe6574a0d9574ba164cd486f73ed0ede 100644 (file)
@@ -75,7 +75,8 @@ struct dri_drawable
 
    void (*update_drawable_info)(struct dri_drawable *drawable);
 
-   void (*flush_frontbuffer)(struct dri_drawable *drawable,
+   void (*flush_frontbuffer)(struct dri_context *ctx,
+                             struct dri_drawable *drawable,
                              enum st_attachment_type statt);
 
    void (*update_tex_buffer)(struct dri_drawable *drawable,
index eb5536ee279c1413a7621a9d3dae9183511b4cb0..5ebe18480d891b15cd9e3b6682b84ff56b079bc3 100644 (file)
@@ -373,7 +373,8 @@ dri2_allocate_textures(struct dri_drawable *drawable,
 }
 
 static void
-dri2_flush_frontbuffer(struct dri_drawable *drawable,
+dri2_flush_frontbuffer(struct dri_context *ctx,
+                       struct dri_drawable *drawable,
                        enum st_attachment_type statt)
 {
    __DRIdrawable *dri_drawable = drawable->dPriv;
index 533f908bce2f6a94d76137fdad958bd1683cf628..7a5f79716c08eb0fac53e375900a18375554abb7 100644 (file)
@@ -158,10 +158,10 @@ drisw_swap_buffers(__DRIdrawable *dPriv)
 }
 
 static void
-drisw_flush_frontbuffer(struct dri_drawable *drawable,
+drisw_flush_frontbuffer(struct dri_context *ctx,
+                        struct dri_drawable *drawable,
                         enum st_attachment_type statt)
 {
-   struct dri_context *ctx = dri_get_current(drawable->sPriv);
    struct pipe_resource *ptex;
 
    if (!ctx)
index 50ed669ba303a65e690b3b1d07c7a108a33e9fa8..657845cf951b75507f724d05549c0508397baf83 100644 (file)
@@ -113,7 +113,8 @@ egl_g3d_destroy_st_manager(struct st_manager *smapi)
 }
 
 static boolean
-egl_g3d_st_framebuffer_flush_front_pbuffer(struct st_framebuffer_iface *stfbi,
+egl_g3d_st_framebuffer_flush_front_pbuffer(struct st_context_iface *stctx,
+                                           struct st_framebuffer_iface *stfbi,
                                            enum st_attachment_type statt)
 {
    return TRUE;
@@ -187,7 +188,8 @@ egl_g3d_st_framebuffer_validate_pbuffer(struct st_framebuffer_iface *stfbi,
 }
 
 static boolean
-egl_g3d_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
+egl_g3d_st_framebuffer_flush_front(struct st_context_iface *stctx,
+                                   struct st_framebuffer_iface *stfbi,
                                    enum st_attachment_type statt)
 {
    _EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private;
index 7b54df5998c2bbae14815454cf674265d50ad753..a681e82fe0131b3068e8bc066a360c64dc534ca9 100644 (file)
@@ -253,7 +253,8 @@ xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
  * Called via st_framebuffer_iface::flush_front()
  */
 static boolean
-xmesa_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
+xmesa_st_framebuffer_flush_front(struct st_context_iface *stctx,
+                                 struct st_framebuffer_iface *stfbi,
                                  enum st_attachment_type statt)
 {
    struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
index 660a7af884f8a30ae2efcb6b28cca2655fdc0f98..e9c4a832a58d41601ac915d383d7696fe0f0ae1b 100644 (file)
@@ -91,7 +91,7 @@ vg_manager_flush_frontbuffer(struct vg_context *ctx)
    switch (stfb->strb_att) {
    case ST_ATTACHMENT_FRONT_LEFT:
    case ST_ATTACHMENT_FRONT_RIGHT:
-      stfb->iface->flush_front(stfb->iface, stfb->strb_att);
+      stfb->iface->flush_front(&ctx->iface, stfb->iface, stfb->strb_att);
       break;
    default:
       break;
index 7151508b73eb210656097b856e1e0be83b17c319..dcf958769e86bafa3b32780fffdbe8e41c397e2f 100644 (file)
@@ -171,7 +171,8 @@ stw_st_framebuffer_present_locked(HDC hdc,
 }
 
 static boolean
-stw_st_framebuffer_flush_front(struct st_framebuffer_iface *stfb,
+stw_st_framebuffer_flush_front(struct st_context_iface *stctx,
+                               struct st_framebuffer_iface *stfb,
                                enum st_attachment_type statt)
 {
    struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
index 0b9add95e6967b0f3fe3d1bf4db0a7431f4cae0c..da58186147990b937be0132d2ebe923d4a2ffc0a 100644 (file)
@@ -789,7 +789,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
 
    /* never a dummy fb */
    assert(&stfb->Base != _mesa_get_incomplete_framebuffer());
-   stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
+   stfb->iface->flush_front(&st->iface, stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
 }
 
 /**