Henri Verbeet : wined3d: Store custom pitches in the texture instead of the surface.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 9 10:46:48 CST 2016


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Feb  8 18:32:05 2016 +0100

wined3d: Store custom pitches in the texture instead of the surface.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/surface.c         | 14 ++++++--------
 dlls/wined3d/texture.c         |  3 ++-
 dlls/wined3d/wined3d_private.h |  4 ++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 267d2f0..d5ba3ac 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1897,8 +1897,8 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
 
     TRACE("surface %p.\n", surface);
 
-    if (surface->pitch)
-        return surface->pitch;
+    if (surface->container->row_pitch)
+        return surface->container->row_pitch;
 
     alignment = surface->resource.device->surface_alignment;
     pitch = wined3d_format_calculate_pitch(surface->resource.format, surface->resource.width);
@@ -1909,8 +1909,7 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
     return pitch;
 }
 
-HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
-        const struct wined3d_gl_info *gl_info, unsigned int pitch)
+HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info)
 {
     struct wined3d_resource *texture_resource = &surface->container->resource;
     unsigned int width, height;
@@ -1959,20 +1958,19 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
         surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY;
         valid_location = WINED3D_LOCATION_USER_MEMORY;
     }
-    surface->pitch = pitch;
     surface->resource.format = texture_resource->format;
     surface->resource.multisample_type = texture_resource->multisample_type;
     surface->resource.multisample_quality = texture_resource->multisample_quality;
-    if (surface->pitch)
+    if (surface->container->row_pitch)
     {
-        surface->resource.size = height * surface->pitch;
+        surface->resource.size = height * surface->container->row_pitch;
     }
     else
     {
         /* User memory surfaces don't have the regular surface alignment. */
         surface->resource.size = wined3d_format_calculate_size(texture_resource->format,
                 1, width, height, 1);
-        surface->pitch = wined3d_format_calculate_pitch(texture_resource->format, width);
+        surface->container->row_pitch = wined3d_format_calculate_pitch(texture_resource->format, width);
     }
 
     /* The format might be changed to a format that needs conversion.
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 4ded4ca..0a084de 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -645,8 +645,9 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
     texture->resource.height = height;
 
     texture->user_memory = mem;
+    texture->row_pitch = pitch;
 
-    return wined3d_surface_update_desc(surface, gl_info, pitch);
+    return wined3d_surface_update_desc(surface, gl_info);
 }
 
 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 ced1555..142cb93 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2365,6 +2365,7 @@ struct wined3d_texture
     GLenum target;
 
     void *user_memory;
+    unsigned int row_pitch;
 
     /* May only be accessed from the command stream worker thread. */
     struct wined3d_texture_async
@@ -2492,7 +2493,6 @@ struct wined3d_surface
 
     DWORD flags;
 
-    UINT pitch;
     UINT pow2Width;
     UINT pow2Height;
 
@@ -2570,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, unsigned int pitch) DECLSPEC_HIDDEN;
+        const struct wined3d_gl_info *gl_info) 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;




More information about the wine-cvs mailing list