Henri Verbeet : wined3d: Get rid of context_bind_fbo() calls outside context.c.

Alexandre Julliard julliard at winehq.org
Mon Aug 1 13:22:09 CDT 2011


Module: wine
Branch: master
Commit: 33fafc6166c72624f159824145d1a8d5274ddf9d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=33fafc6166c72624f159824145d1a8d5274ddf9d

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Sun Jul 31 17:33:44 2011 +0200

wined3d: Get rid of context_bind_fbo() calls outside context.c.

---

 dlls/wined3d/context.c         |    2 +-
 dlls/wined3d/surface.c         |   37 ++++++++++++++-----------------------
 dlls/wined3d/swapchain.c       |    4 ++--
 dlls/wined3d/wined3d_private.h |    1 -
 4 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index b0bc5f6..620a89b 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -33,7 +33,7 @@ static DWORD wined3d_context_tls_idx;
 /* FBO helper functions */
 
 /* GL locking is done by the caller */
-void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo)
+static void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
     GLuint f;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 9422a0b..7c5b6d9 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5010,6 +5010,7 @@ static void surface_blt_fbo(struct wined3d_device *device, const WINED3DTEXTUREF
     struct wined3d_context *context;
     RECT src_rect, dst_rect;
     GLenum gl_filter;
+    GLenum buffer;
 
     TRACE("device %p, filter %s,\n", device, debug_d3dtexturefiltertype(filter));
     TRACE("src_surface %p, src_location %s, src_rect %s,\n",
@@ -5062,48 +5063,38 @@ static void surface_blt_fbo(struct wined3d_device *device, const WINED3DTEXTUREF
 
     if (src_location == SFLAG_INDRAWABLE)
     {
-        GLenum buffer = surface_get_gl_buffer(src_surface);
-
         TRACE("Source surface %p is onscreen.\n", src_surface);
-
+        buffer = surface_get_gl_buffer(src_surface);
         surface_translate_drawable_coords(src_surface, context->win_handle, &src_rect);
-
-        ENTER_GL();
-        context_bind_fbo(context, GL_READ_FRAMEBUFFER, NULL);
-        glReadBuffer(buffer);
-        checkGLcall("glReadBuffer()");
     }
     else
     {
         TRACE("Source surface %p is offscreen.\n", src_surface);
-        ENTER_GL();
-        context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, src_surface, NULL, src_location);
-        glReadBuffer(GL_COLOR_ATTACHMENT0);
-        checkGLcall("glReadBuffer()");
+        buffer = GL_COLOR_ATTACHMENT0;
     }
+
+    ENTER_GL();
+    context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, src_surface, NULL, src_location);
+    glReadBuffer(buffer);
+    checkGLcall("glReadBuffer()");
     context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
     LEAVE_GL();
 
     if (dst_location == SFLAG_INDRAWABLE)
     {
-        GLenum buffer = surface_get_gl_buffer(dst_surface);
-
         TRACE("Destination surface %p is onscreen.\n", dst_surface);
-
+        buffer = surface_get_gl_buffer(dst_surface);
         surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect);
-
-        ENTER_GL();
-        context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);
-        context_set_draw_buffer(context, buffer);
     }
     else
     {
         TRACE("Destination surface %p is offscreen.\n", dst_surface);
-
-        ENTER_GL();
-        context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location);
-        context_set_draw_buffer(context, GL_COLOR_ATTACHMENT0);
+        buffer = GL_COLOR_ATTACHMENT0;
     }
+
+    ENTER_GL();
+    context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location);
+    context_set_draw_buffer(context, buffer);
     context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER);
     context_invalidate_state(context, STATE_FRAMEBUFFER);
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index a7e61fb..5ad6966 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -306,7 +306,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
         glReadBuffer(GL_COLOR_ATTACHMENT0);
         context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
 
-        context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL);
+        context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
         context_set_draw_buffer(context, GL_BACK);
         context_invalidate_state(context, STATE_FRAMEBUFFER);
 
@@ -350,7 +350,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain,
             gl_filter = GL_NEAREST;
 
         ENTER_GL();
-        context_bind_fbo(context2, GL_FRAMEBUFFER, NULL);
+        context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, swapchain->front_buffer, NULL, SFLAG_INDRAWABLE);
 
         /* Set up the texture. The surface is not in a wined3d_texture
          * container, so there are no D3D texture settings to dirtify. */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index fbf8641..17e8b41 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1233,7 +1233,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
 BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN;
 void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target,
         struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN;
-void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN;
 void context_check_fbo_status(const struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN;
 struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, struct wined3d_surface *target,
         const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list