Henri Verbeet : wined3d: Introduce a separate function to determine if a surface needs a PBO.

Alexandre Julliard julliard at winehq.org
Thu Dec 1 14:05:31 CST 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Dec  1 07:31:40 2011 +0100

wined3d: Introduce a separate function to determine if a surface needs a PBO.

---

 dlls/wined3d/surface.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index b74e8d5..373b443 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -520,6 +520,20 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
     return WINED3D_OK;
 }
 
+static BOOL surface_need_pbo(const struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
+{
+    if (surface->resource.pool == WINED3DPOOL_SYSTEMMEM)
+        return FALSE;
+    if (!(surface->flags & SFLAG_DYNLOCK))
+        return FALSE;
+    if (surface->flags & (SFLAG_CONVERTED | SFLAG_NONPOW2 | SFLAG_PIN_SYSMEM))
+        return FALSE;
+    if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT])
+        return FALSE;
+
+    return TRUE;
+}
+
 static void surface_prepare_system_memory(struct wined3d_surface *surface)
 {
     struct wined3d_device *device = surface->resource.device;
@@ -527,12 +541,7 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
 
     TRACE("surface %p.\n", surface);
 
-    /* Create a PBO for dynamically locked surfaces but don't do it for
-     * converted or NPOT surfaces. Also don't create a PBO for systemmem
-     * surfaces. */
-    if (gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] && (surface->flags & SFLAG_DYNLOCK)
-            && !(surface->flags & (SFLAG_PBO | SFLAG_CONVERTED | SFLAG_NONPOW2 | SFLAG_PIN_SYSMEM))
-            && (surface->resource.pool != WINED3DPOOL_SYSTEMMEM))
+    if (!(surface->flags & SFLAG_PBO) && surface_need_pbo(surface, gl_info))
     {
         struct wined3d_context *context;
         GLenum error;




More information about the wine-cvs mailing list