[PATCH 4/6] wined3d: Store the "user_memory" pointer in the texture instead of the surface.

Henri Verbeet hverbeet at codeweavers.com
Mon Feb 8 11:32:04 CST 2016


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/surface.c         | 10 +++++-----
 dlls/wined3d/texture.c         |  4 +++-
 dlls/wined3d/wined3d_private.h |  5 +++--
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 11db96e..267d2f0 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -488,7 +488,7 @@ static void surface_get_memory(const struct wined3d_surface *surface, struct win
     }
     if (location & WINED3D_LOCATION_USER_MEMORY)
     {
-        data->addr = surface->user_memory;
+        data->addr = surface->container->user_memory;
         data->buffer_object = 0;
         return;
     }
@@ -567,7 +567,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface)
             break;
 
         case WINED3D_LOCATION_USER_MEMORY:
-            if (!surface->user_memory)
+            if (!surface->container->user_memory)
                 ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but surface->user_memory is NULL.\n");
             break;
 
@@ -1910,7 +1910,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
 }
 
 HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch)
+        const struct wined3d_gl_info *gl_info, unsigned int pitch)
 {
     struct wined3d_resource *texture_resource = &surface->container->resource;
     unsigned int width, height;
@@ -1954,7 +1954,7 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
     else
         surface->flags &= ~SFLAG_NONPOW2;
 
-    if ((surface->user_memory = mem))
+    if (surface->container->user_memory)
     {
         surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
         valid_location = WINED3D_LOCATION_USER_MEMORY;
@@ -2414,7 +2414,7 @@ HRESULT wined3d_surface_map(struct wined3d_surface *surface, struct wined3d_map_
             break;
 
         case WINED3D_LOCATION_USER_MEMORY:
-            base_memory = surface->user_memory;
+            base_memory = surface->container->user_memory;
             break;
 
         case WINED3D_LOCATION_DIB:
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 0c48c91..4ded4ca 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -644,7 +644,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
     texture->resource.width = width;
     texture->resource.height = height;
 
-    return wined3d_surface_update_desc(surface, gl_info, mem, pitch);
+    texture->user_memory = mem;
+
+    return wined3d_surface_update_desc(surface, gl_info, pitch);
 }
 
 void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ea47bbf..ced1555 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2364,6 +2364,8 @@ struct wined3d_texture
     DWORD flags;
     GLenum target;
 
+    void *user_memory;
+
     /* May only be accessed from the command stream worker thread. */
     struct wined3d_texture_async
     {
@@ -2486,7 +2488,6 @@ struct wined3d_surface
     struct wined3d_resource resource;
     const struct wined3d_surface_ops *surface_ops;
     struct wined3d_texture *container;
-    void *user_memory;
     DWORD locations;
 
     DWORD flags;
@@ -2569,7 +2570,7 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target,
 void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN;
 HRESULT wined3d_surface_unmap(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch) DECLSPEC_HIDDEN;
+        const struct wined3d_gl_info *gl_info, unsigned int pitch) DECLSPEC_HIDDEN;
 HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
         struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
 void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
-- 
2.1.4




More information about the wine-patches mailing list