From fde2bdfb77c46121de1617f90fbb20662d208edd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 21 Feb 2016 23:34:22 +0100
Subject: Revert "wined3d: Introduce wined3d_texture_get_pitch()."

This partially reverts commit 65c04ce0409d870bc42ef466027120388abdb83c.
---
 dlls/wined3d/surface.c         | 11 ++++++++++-
 dlls/wined3d/texture.c         |  9 ++-------
 dlls/wined3d/wined3d_private.h |  1 -
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 62a1a3c..dad5c22 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1909,7 +1909,16 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struc
     surface->resource.format = texture_resource->format;
     surface->resource.multisample_type = texture_resource->multisample_type;
     surface->resource.multisample_quality = texture_resource->multisample_quality;
-    surface->resource.size = surface->container->slice_pitch;
+    if (surface->container->row_pitch)
+    {
+        surface->resource.size = height * surface->container->row_pitch;
+    }
+    else
+    {
+        /* User memory surfaces don't have the regular surface alignment. */
+        wined3d_format_calculate_pitch(texture_resource->format, 1, width, height,
+                &surface->container->row_pitch, &surface->resource.size);
+    }
 
     /* The format might be changed to a format that needs conversion.
      * If the surface didn't use PBOs previously but could now, don't
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index b4f679c..487b2ef 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -502,7 +502,7 @@ void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture,
     if (texture->row_pitch)
     {
         *row_pitch = texture->row_pitch;
-        *slice_pitch = texture->slice_pitch;
+        *slice_pitch = *row_pitch * height;
         return;
     }
 
@@ -656,12 +656,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
     texture->resource.height = height;
 
     texture->user_memory = mem;
-    if ((texture->row_pitch = pitch))
-        texture->slice_pitch = height * pitch;
-    else
-        /* User memory surfaces don't have the regular surface alignment. */
-        wined3d_format_calculate_pitch(format, 1, width, height,
-                &texture->row_pitch, &texture->slice_pitch);
+    texture->row_pitch = pitch;
 
     texture->flags &= ~WINED3D_TEXTURE_COND_NP2_EMULATED;
     if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0ef64c1..3433ae1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2367,7 +2367,6 @@ struct wined3d_texture
 
     void *user_memory;
     unsigned int row_pitch;
-    unsigned int slice_pitch;
 
     /* May only be accessed from the command stream worker thread. */
     struct wined3d_texture_async
-- 
2.7.1

