From 36e2eb72fa6debbdb8b5064a448e1fc0a4abfab1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 6 Mar 2016 22:08:45 +0100
Subject: Revert "wined3d: Use a single allocation for texture sub-resource
 objects."

This reverts commit e3e5dcd2cd548bed34cc193383da96c1898fee2c.
---
 dlls/wined3d/surface.c         |  57 +++++++++++++++++-
 dlls/wined3d/texture.c         | 130 +++++++++++------------------------------
 dlls/wined3d/volume.c          |  47 ++++++++++++++-
 dlls/wined3d/wined3d_private.h |  25 ++++----
 4 files changed, 142 insertions(+), 117 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 303bdc7..01095e9 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -40,7 +40,7 @@ static const DWORD surface_simple_locations =
         WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_USER_MEMORY
         | WINED3D_LOCATION_DIB | WINED3D_LOCATION_BUFFER;
 
-void wined3d_surface_cleanup(struct wined3d_surface *surface)
+static void surface_cleanup(struct wined3d_surface *surface)
 {
     struct wined3d_surface *overlay, *cur;
 
@@ -107,6 +107,15 @@ void wined3d_surface_cleanup(struct wined3d_surface *surface)
     resource_cleanup(&surface->resource);
 }
 
+void wined3d_surface_destroy(struct wined3d_surface *surface)
+{
+    TRACE("surface %p.\n", surface);
+
+    surface_cleanup(surface);
+    surface->resource.parent_ops->wined3d_object_destroyed(surface->resource.parent);
+    HeapFree(GetProcessHeap(), 0, surface);
+}
+
 void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
         unsigned int *width, unsigned int *height)
 {
@@ -5003,7 +5012,7 @@ cpu:
     return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter);
 }
 
-HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
+static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
         const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags)
 {
     struct wined3d_device *device = container->resource.device;
@@ -5081,7 +5090,7 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
     if (FAILED(hr = surface->surface_ops->surface_private_setup(surface)))
     {
         ERR("Private setup failed, hr %#x.\n", hr);
-        wined3d_surface_cleanup(surface);
+        surface_cleanup(surface);
         return hr;
     }
 
@@ -5102,6 +5111,48 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
     return hr;
 }
 
+HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
+        GLenum target, unsigned int level, unsigned int layer, DWORD flags, struct wined3d_surface **surface)
+{
+    struct wined3d_device_parent *device_parent = container->resource.device->device_parent;
+    const struct wined3d_parent_ops *parent_ops;
+    struct wined3d_surface *object;
+    void *parent;
+    HRESULT hr;
+
+    TRACE("container %p, width %u, height %u, format %s, usage %s (%#x), pool %s, "
+            "multisample_type %#x, multisample_quality %u, target %#x, level %u, layer %u, flags %#x, surface %p.\n",
+            container, desc->width, desc->height, debug_d3dformat(desc->format),
+            debug_d3dusage(desc->usage), desc->usage, debug_d3dpool(desc->pool),
+            desc->multisample_type, desc->multisample_quality, target, level, layer, flags, surface);
+
+    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+        return E_OUTOFMEMORY;
+
+    if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags)))
+    {
+        WARN("Failed to initialize surface, returning %#x.\n", hr);
+        HeapFree(GetProcessHeap(), 0, object);
+        return hr;
+    }
+
+    if (FAILED(hr = device_parent->ops->surface_created(device_parent,
+            container, layer * container->level_count + level, &parent, &parent_ops)))
+    {
+        WARN("Failed to create surface parent, hr %#x.\n", hr);
+        wined3d_surface_destroy(object);
+        return hr;
+    }
+
+    TRACE("Created surface %p, parent %p, parent_ops %p.\n", object, parent, parent_ops);
+
+    object->resource.parent = parent;
+    object->resource.parent_ops = parent_ops;
+    *surface = object;
+
+    return hr;
+}
+
 /* Context activation is done by the caller. */
 void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
 {
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index a664155..e96b029 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -108,9 +108,19 @@ static void wined3d_texture_unload_gl_texture(struct wined3d_texture *texture)
 
 static void wined3d_texture_cleanup(struct wined3d_texture *texture)
 {
+    UINT sub_count = texture->level_count * texture->layer_count;
+    UINT i;
+
     TRACE("texture %p.\n", texture);
 
-    texture->texture_ops->texture_cleanup_sub_resources(texture);
+    for (i = 0; i < sub_count; ++i)
+    {
+        struct wined3d_resource *sub_resource = texture->sub_resources[i].resource;
+
+        if (sub_resource)
+            texture->texture_ops->texture_sub_resource_cleanup(sub_resource);
+    }
+
     wined3d_texture_unload_gl_texture(texture);
     resource_cleanup(&texture->resource);
 }
@@ -794,6 +804,13 @@ static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub
     surface_invalidate_location(surface, ~surface->resource.map_binding);
 }
 
+static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource)
+{
+    struct wined3d_surface *surface = surface_from_resource(sub_resource);
+
+    wined3d_surface_destroy(surface);
+}
+
 static void texture2d_sub_resource_invalidate_location(struct wined3d_resource *sub_resource, DWORD location)
 {
     struct wined3d_surface *surface = surface_from_resource(sub_resource);
@@ -887,34 +904,15 @@ static void texture2d_prepare_texture(struct wined3d_texture *texture, struct wi
     }
 }
 
-static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
-{
-    unsigned int sub_count = texture->level_count * texture->layer_count;
-    struct wined3d_surface *surface;
-    unsigned int i;
-
-    for (i = 0; i < sub_count; ++i)
-    {
-        if ((surface = texture->sub_resources[i].u.surface))
-        {
-            TRACE("surface %p.\n", surface);
-
-            wined3d_surface_cleanup(surface);
-            surface->resource.parent_ops->wined3d_object_destroyed(surface->resource.parent);
-        }
-    }
-    HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.surface);
-}
-
 static const struct wined3d_texture_ops texture2d_ops =
 {
     texture2d_sub_resource_load,
     texture2d_sub_resource_add_dirty_region,
+    texture2d_sub_resource_cleanup,
     texture2d_sub_resource_invalidate_location,
     texture2d_sub_resource_validate_location,
     texture2d_sub_resource_upload_data,
     texture2d_prepare_texture,
-    texture2d_cleanup_sub_resources,
 };
 
 static ULONG texture_resource_incref(struct wined3d_resource *resource)
@@ -980,10 +978,8 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
         unsigned int layer_count, unsigned int level_count, DWORD flags, struct wined3d_device *device,
         void *parent, const struct wined3d_parent_ops *parent_ops)
 {
-    struct wined3d_device_parent *device_parent = device->device_parent;
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     struct wined3d_resource_desc surface_desc;
-    struct wined3d_surface *surfaces;
     UINT pow2_width, pow2_height;
     unsigned int i, j;
     HRESULT hr;
@@ -1092,12 +1088,6 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
     }
     TRACE("xf(%f) yf(%f)\n", texture->pow2_matrix[0], texture->pow2_matrix[5]);
 
-    if (!(surfaces = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*surfaces) * level_count * layer_count)))
-    {
-        wined3d_texture_cleanup(texture);
-        return E_OUTOFMEMORY;
-    }
-
     /* Generate all the surfaces. */
     surface_desc = *desc;
     surface_desc.resource_type = WINED3D_RTYPE_SURFACE;
@@ -1118,32 +1108,16 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
             unsigned int idx = j * texture->level_count + i;
             struct wined3d_surface *surface;
 
-            surface = &surfaces[idx];
-            if (FAILED(hr = wined3d_surface_init(surface, texture, &surface_desc, target, i, j, flags)))
-            {
-                WARN("Failed to initialize surface, returning %#x.\n", hr);
-                wined3d_texture_cleanup(texture);
-                if (!idx)
-                    HeapFree(GetProcessHeap(), 0, surfaces);
-                return hr;
-            }
-
-            if (FAILED(hr = device_parent->ops->surface_created(device_parent,
-                    texture, idx, &parent, &parent_ops)))
+            if (FAILED(hr = wined3d_surface_create(texture, &surface_desc,
+                    target, i, j, flags, &surface)))
             {
-                WARN("Failed to create surface parent, hr %#x.\n", hr);
-                wined3d_surface_cleanup(surface);
+                WARN("Failed to create surface, hr %#x.\n", hr);
                 wined3d_texture_cleanup(texture);
                 return hr;
             }
 
-            TRACE("parent %p, parent_ops %p.\n", parent, parent_ops);
-
-            surface->resource.parent = parent;
-            surface->resource.parent_ops = parent_ops;
             texture->sub_resources[idx].resource = &surface->resource;
-            texture->sub_resources[idx].u.surface = surface;
-            TRACE("Created surface level %u, layer %u @ %p.\n", i, j, surface);
+            TRACE("Created surface level %u @ %p.\n", i, surface);
         }
         /* Calculate the next mipmap level. */
         surface_desc.width = max(1, surface_desc.width >> 1);
@@ -1165,6 +1139,13 @@ static void texture3d_sub_resource_add_dirty_region(struct wined3d_resource *sub
     wined3d_texture_set_dirty(volume_from_resource(sub_resource)->container);
 }
 
+static void texture3d_sub_resource_cleanup(struct wined3d_resource *sub_resource)
+{
+    struct wined3d_volume *volume = volume_from_resource(sub_resource);
+
+    wined3d_volume_destroy(volume);
+}
+
 static void texture3d_sub_resource_invalidate_location(struct wined3d_resource *sub_resource, DWORD location)
 {
     struct wined3d_volume *volume = volume_from_resource(sub_resource);
@@ -1217,34 +1198,15 @@ static void texture3d_prepare_texture(struct wined3d_texture *texture, struct wi
     }
 }
 
-static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture)
-{
-    unsigned int sub_count = texture->level_count * texture->layer_count;
-    struct wined3d_volume *volume;
-    unsigned int i;
-
-    for (i = 0; i < sub_count; ++i)
-    {
-        if ((volume = texture->sub_resources[i].u.volume))
-        {
-            TRACE("volume %p.\n", volume);
-
-            wined3d_volume_cleanup(volume);
-            volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent);
-        }
-    }
-    HeapFree(GetProcessHeap(), 0, texture->sub_resources[0].u.volume);
-}
-
 static const struct wined3d_texture_ops texture3d_ops =
 {
     texture3d_sub_resource_load,
     texture3d_sub_resource_add_dirty_region,
+    texture3d_sub_resource_cleanup,
     texture3d_sub_resource_invalidate_location,
     texture3d_sub_resource_validate_location,
     texture3d_sub_resource_upload_data,
     texture3d_prepare_texture,
-    texture3d_cleanup_sub_resources,
 };
 
 BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
@@ -1309,10 +1271,8 @@ static const struct wined3d_resource_ops texture3d_resource_ops =
 static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc,
         UINT levels, struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops)
 {
-    struct wined3d_device_parent *device_parent = device->device_parent;
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     struct wined3d_resource_desc volume_desc;
-    struct wined3d_volume *volumes;
     unsigned int i;
     HRESULT hr;
 
@@ -1387,12 +1347,6 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
     texture->pow2_matrix[15] = 1.0f;
     texture->target = GL_TEXTURE_3D;
 
-    if (!(volumes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*volumes) * levels)))
-    {
-        wined3d_texture_cleanup(texture);
-        return E_OUTOFMEMORY;
-    }
-
     /* Generate all the surfaces. */
     volume_desc = *desc;
     volume_desc.resource_type = WINED3D_RTYPE_VOLUME;
@@ -1400,32 +1354,14 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
     {
         struct wined3d_volume *volume;
 
-        volume = &volumes[i];
-        if (FAILED(hr = wined3d_volume_init(volume, texture, &volume_desc, i)))
-        {
-            WARN("Failed to initialize volume, returning %#x.\n", hr);
-            wined3d_texture_cleanup(texture);
-            if (!i)
-                HeapFree(GetProcessHeap(), 0, volumes);
-            return hr;
-        }
-
-        if (FAILED(hr = device_parent->ops->volume_created(device_parent,
-                texture, i, &parent, &parent_ops)))
+        if (FAILED(hr = wined3d_volume_create(texture, &volume_desc, i, &volume)))
         {
-            WARN("Failed to create volume parent, hr %#x.\n", hr);
-            wined3d_volume_cleanup(volume);
+            ERR("Creating a volume for the volume texture failed, hr %#x.\n", hr);
             wined3d_texture_cleanup(texture);
             return hr;
         }
 
-        TRACE("parent %p, parent_ops %p.\n", parent, parent_ops);
-
-        volume->resource.parent = parent;
-        volume->resource.parent_ops = parent_ops;
         texture->sub_resources[i].resource = &volume->resource;
-        texture->sub_resources[i].u.volume = volume;
-        TRACE("Created volume level %u @ %p.\n", i, volume);
 
         /* Calculate the next mipmap level. */
         volume_desc.width = max(1, volume_desc.width >> 1);
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 4b726d7..6f5de73 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -382,7 +382,7 @@ static void wined3d_volume_free_pbo(struct wined3d_volume *volume)
     context_release(context);
 }
 
-void wined3d_volume_cleanup(struct wined3d_volume *volume)
+void wined3d_volume_destroy(struct wined3d_volume *volume)
 {
     TRACE("volume %p.\n", volume);
 
@@ -390,6 +390,8 @@ void wined3d_volume_cleanup(struct wined3d_volume *volume)
         wined3d_volume_free_pbo(volume);
 
     resource_cleanup(&volume->resource);
+    volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent);
+    HeapFree(GetProcessHeap(), 0, volume);
 }
 
 static void volume_unload(struct wined3d_resource *resource)
@@ -663,7 +665,7 @@ static const struct wined3d_resource_ops volume_resource_ops =
     volume_resource_sub_resource_unmap,
 };
 
-HRESULT wined3d_volume_init(struct wined3d_volume *volume, struct wined3d_texture *container,
+static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture *container,
         const struct wined3d_resource_desc *desc, UINT level)
 {
     struct wined3d_device *device = container->resource.device;
@@ -706,3 +708,44 @@ HRESULT wined3d_volume_init(struct wined3d_volume *volume, struct wined3d_textur
 
     return WINED3D_OK;
 }
+
+HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
+        unsigned int level, struct wined3d_volume **volume)
+{
+    struct wined3d_device_parent *device_parent = container->resource.device->device_parent;
+    const struct wined3d_parent_ops *parent_ops;
+    struct wined3d_volume *object;
+    void *parent;
+    HRESULT hr;
+
+    TRACE("container %p, width %u, height %u, depth %u, level %u, format %s, "
+            "usage %#x, pool %s, volume %p.\n",
+            container, desc->width, desc->height, desc->depth, level, debug_d3dformat(desc->format),
+            desc->usage, debug_d3dpool(desc->pool), volume);
+
+    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+        return E_OUTOFMEMORY;
+
+    if (FAILED(hr = volume_init(object, container, desc, level)))
+    {
+        WARN("Failed to initialize volume, returning %#x.\n", hr);
+        HeapFree(GetProcessHeap(), 0, object);
+        return hr;
+    }
+
+    if (FAILED(hr = device_parent->ops->volume_created(device_parent,
+            container, level, &parent, &parent_ops)))
+    {
+        WARN("Failed to create volume parent, hr %#x.\n", hr);
+        wined3d_volume_destroy(object);
+        return hr;
+    }
+
+    TRACE("Created volume %p, parent %p, parent_ops %p.\n", object, parent, parent_ops);
+
+    object->resource.parent = parent;
+    object->resource.parent_ops = parent_ops;
+    *volume = object;
+
+    return WINED3D_OK;
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1774039..d89bd24 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2326,13 +2326,13 @@ struct wined3d_texture_ops
             struct wined3d_context *context, BOOL srgb);
     void (*texture_sub_resource_add_dirty_region)(struct wined3d_resource *sub_resource,
             const struct wined3d_box *dirty_region);
+    void (*texture_sub_resource_cleanup)(struct wined3d_resource *sub_resource);
     void (*texture_sub_resource_invalidate_location)(struct wined3d_resource *sub_resource, DWORD location);
     void (*texture_sub_resource_validate_location)(struct wined3d_resource *sub_resource, DWORD location);
     void (*texture_sub_resource_upload_data)(struct wined3d_resource *sub_resource,
             const struct wined3d_context *context, const struct wined3d_sub_resource_data *data);
     void (*texture_prepare_texture)(struct wined3d_texture *texture,
             struct wined3d_context *context, BOOL srgb);
-    void (*texture_cleanup_sub_resources)(struct wined3d_texture *texture);
 };
 
 #define WINED3D_TEXTURE_COND_NP2            0x00000001
@@ -2386,11 +2386,6 @@ struct wined3d_texture
     struct
     {
         struct wined3d_resource *resource;
-        union
-        {
-            struct wined3d_surface *surface;
-            struct wined3d_volume *volume;
-        } u;
     } sub_resources[1];
 };
 
@@ -2454,12 +2449,12 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
 }
 
 BOOL volume_prepare_system_memory(struct wined3d_volume *volume) DECLSPEC_HIDDEN;
-void wined3d_volume_cleanup(struct wined3d_volume *volume) DECLSPEC_HIDDEN;
-HRESULT wined3d_volume_init(struct wined3d_volume *volume, struct wined3d_texture *container,
-        const struct wined3d_resource_desc *desc, UINT level) DECLSPEC_HIDDEN;
-void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN;
+HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
+        unsigned int level, struct wined3d_volume **volume) DECLSPEC_HIDDEN;
+void wined3d_volume_destroy(struct wined3d_volume *volume) DECLSPEC_HIDDEN;
 void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *context,
         BOOL srgb_mode) DECLSPEC_HIDDEN;
+void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN;
 HRESULT wined3d_volume_map(struct wined3d_volume *volume,
         struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags) DECLSPEC_HIDDEN;
 void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN;
@@ -2568,16 +2563,13 @@ static inline GLuint surface_get_texture_name(const struct wined3d_surface *surf
 HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect,
         struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
         const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
-void wined3d_surface_cleanup(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
+void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 HRESULT surface_color_fill(struct wined3d_surface *s,
         const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN;
 HRESULT surface_create_dib_section(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
         unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
-HRESULT wined3d_surface_init(struct wined3d_surface *surface,
-        struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
-        GLenum target, unsigned int level, unsigned int layer, DWORD flags) DECLSPEC_HIDDEN;
 void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
 void surface_load(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
 void surface_load_ds_location(struct wined3d_surface *surface,
@@ -2593,7 +2585,6 @@ void wined3d_surface_prepare(struct wined3d_surface *surface, struct wined3d_con
         DWORD location) DECLSPEC_HIDDEN;
 void surface_set_compatible_renderbuffer(struct wined3d_surface *surface,
         const struct wined3d_surface *rt) DECLSPEC_HIDDEN;
-void surface_set_dirty(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level) DECLSPEC_HIDDEN;
 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;
@@ -2602,6 +2593,10 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
 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;
+HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
+        GLenum target, unsigned int level, unsigned int layer, DWORD flags,
+        struct wined3d_surface **surface) DECLSPEC_HIDDEN;
+void wined3d_surface_destroy(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 void surface_prepare_map_memory(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
 void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
         const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point,
-- 
2.7.1

