[PATCH 1/5] wined3d: Remove SFLAG_USERPTR.

Stefan Dösinger stefan at codeweavers.com
Thu Jan 9 06:43:20 CST 2014


---
 dlls/wined3d/surface.c         | 14 +++++---------
 dlls/wined3d/wined3d_private.h | 22 ++++++++++------------
 2 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 91b35fd..28a3e16 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -604,7 +604,8 @@ static void surface_prepare_system_memory(struct wined3d_surface *surface)
 
 static void surface_evict_sysmem(struct wined3d_surface *surface)
 {
-    if (surface->resource.map_count || (surface->flags & SFLAG_DONOTFREE))
+    if (surface->resource.map_count || (surface->flags & SFLAG_DONOTFREE)
+            || surface->user_memory)
         return;
 
     wined3d_resource_free_sysmem(&surface->resource);
@@ -2775,7 +2776,7 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
         create_dib = TRUE;
     }
 
-    surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_USERPTR);
+    surface->flags &= ~SFLAG_LOCATIONS;
     surface->resource.allocatedMemory = NULL;
     wined3d_resource_free_sysmem(&surface->resource);
 
@@ -2801,13 +2802,8 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
     else
         surface->flags &= ~SFLAG_NONPOW2;
 
-    if (mem)
-    {
-        surface->user_memory = mem;
-        surface->flags |= SFLAG_USERPTR;
-    }
+    surface->user_memory = mem;
     surface->pitch = pitch;
-
     surface->resource.format = format;
     surface->resource.multisample_type = multisample_type;
     surface->resource.multisample_quality = multisample_quality;
@@ -3280,7 +3276,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
             return WINED3DERR_INVALIDCALL;
 
         /* Use the DIB section from now on if we are not using a PBO or user memory. */
-        if (!(surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM | SFLAG_USERPTR)))
+        if (!(surface->flags & (SFLAG_PBO | SFLAG_PIN_SYSMEM) || surface->user_memory))
         {
             wined3d_resource_free_sysmem(&surface->resource);
             surface->resource.allocatedMemory = surface->dib.bitmap_data;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0735116..dfdae51 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2294,17 +2294,16 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
 #define SFLAG_GLCKEY            0x00000100 /* The GL texture was created with a color key. */
 #define SFLAG_CLIENT            0x00000200 /* GL_APPLE_client_storage is used with this surface. */
 #define SFLAG_DIBSECTION        0x00000400 /* Has a DIB section attached for GetDC. */
-#define SFLAG_USERPTR           0x00000800 /* The application allocated the memory for this surface. */
-#define SFLAG_ALLOCATED         0x00001000 /* A GL texture is allocated for this surface. */
-#define SFLAG_SRGBALLOCATED     0x00002000 /* A sRGB GL texture is allocated for this surface. */
-#define SFLAG_PBO               0x00004000 /* The surface has a PBO. */
-#define SFLAG_INSYSMEM          0x00008000 /* The system memory copy is current. */
-#define SFLAG_INTEXTURE         0x00010000 /* The GL texture is current. */
-#define SFLAG_INSRGBTEX         0x00020000 /* The GL sRGB texture is current. */
-#define SFLAG_INDRAWABLE        0x00040000 /* The GL drawable is current. */
-#define SFLAG_INRB_MULTISAMPLE  0x00080000 /* The multisample renderbuffer is current. */
-#define SFLAG_INRB_RESOLVED     0x00100000 /* The resolved renderbuffer is current. */
-#define SFLAG_DISCARDED         0x00200000 /* Surface was discarded, allocating new location is enough. */
+#define SFLAG_ALLOCATED         0x00000800 /* A GL texture is allocated for this surface. */
+#define SFLAG_SRGBALLOCATED     0x00001000 /* A sRGB GL texture is allocated for this surface. */
+#define SFLAG_PBO               0x00002000 /* The surface has a PBO. */
+#define SFLAG_INSYSMEM          0x00004000 /* The system memory copy is current. */
+#define SFLAG_INTEXTURE         0x00008000 /* The GL texture is current. */
+#define SFLAG_INSRGBTEX         0x00010000 /* The GL sRGB texture is current. */
+#define SFLAG_INDRAWABLE        0x00020000 /* The GL drawable is current. */
+#define SFLAG_INRB_MULTISAMPLE  0x00040000 /* The multisample renderbuffer is current. */
+#define SFLAG_INRB_RESOLVED     0x00080000 /* The resolved renderbuffer is current. */
+#define SFLAG_DISCARDED         0x00100000 /* Surface was discarded, allocating new location is enough. */
 
 /* In some conditions the surface memory must not be freed:
  * SFLAG_CONVERTED: Converting the data back would take too long
@@ -2317,7 +2316,6 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
                              SFLAG_DYNLOCK          | \
                              SFLAG_CLIENT           | \
                              SFLAG_DIBSECTION       | \
-                             SFLAG_USERPTR          | \
                              SFLAG_PBO              | \
                              SFLAG_PIN_SYSMEM)
 
-- 
1.8.3.2




More information about the wine-patches mailing list