=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Get rid of wined3d_texture_ops.texture_sub_resource_load().

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 7 11:42:52 CDT 2016


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Wed Apr  6 19:12:07 2016 +0200

wined3d: Get rid of wined3d_texture_ops.texture_sub_resource_load().

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

---

 dlls/wined3d/surface.c         | 21 ---------------------
 dlls/wined3d/texture.c         | 18 +++---------------
 dlls/wined3d/volume.c          |  8 --------
 dlls/wined3d/wined3d_private.h |  5 -----
 4 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 8d898bc..9c015cc 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1422,27 +1422,6 @@ void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const
     checkGLcall("set_compatible_renderbuffer");
 }
 
-/* Context activation is done by the caller. */
-void surface_load(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb)
-{
-    DWORD location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
-
-    TRACE("surface %p, srgb %#x.\n", surface, srgb);
-
-    if (surface->container->resource.pool == WINED3D_POOL_SCRATCH)
-        ERR("Not supported on scratch surfaces.\n");
-
-    if (surface_get_sub_resource(surface)->locations & location)
-    {
-        TRACE("surface is already in texture\n");
-        return;
-    }
-    TRACE("Reloading because surface is dirty.\n");
-
-    surface_load_location(surface, context, location);
-    surface_evict_sysmem(surface);
-}
-
 /* See also float_16_to_32() in wined3d_private.h */
 static inline unsigned short float_32_to_16(const float *in)
 {
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 3476b32..b31b0e1 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -663,7 +663,9 @@ void wined3d_texture_load(struct wined3d_texture *texture,
     /* Reload the surfaces if the texture is marked dirty. */
     for (i = 0; i < sub_count; ++i)
     {
-        texture->texture_ops->texture_sub_resource_load(texture->sub_resources[i].resource, context, srgb);
+        if (!texture->texture_ops->texture_load_location(texture, i, context,
+                srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB))
+            ERR("Failed to load location (srgb %#x).\n", srgb);
     }
     texture->flags |= flag;
 }
@@ -1087,12 +1089,6 @@ static HRESULT wined3d_texture_upload_data(struct wined3d_texture *texture,
     return WINED3D_OK;
 }
 
-static void texture2d_sub_resource_load(struct wined3d_resource *sub_resource,
-        struct wined3d_context *context, BOOL srgb)
-{
-    surface_load(surface_from_resource(sub_resource), context, srgb);
-}
-
 static void texture2d_sub_resource_upload_data(struct wined3d_resource *sub_resource,
         const struct wined3d_context *context, const struct wined3d_sub_resource_data *data)
 {
@@ -1203,7 +1199,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
 
 static const struct wined3d_texture_ops texture2d_ops =
 {
-    texture2d_sub_resource_load,
     texture2d_sub_resource_upload_data,
     texture2d_load_location,
     texture2d_prepare_location,
@@ -1689,12 +1684,6 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
     return WINED3D_OK;
 }
 
-static void texture3d_sub_resource_load(struct wined3d_resource *sub_resource,
-        struct wined3d_context *context, BOOL srgb)
-{
-    wined3d_volume_load(volume_from_resource(sub_resource), context, srgb);
-}
-
 static void texture3d_sub_resource_upload_data(struct wined3d_resource *sub_resource,
         const struct wined3d_context *context, const struct wined3d_sub_resource_data *data)
 {
@@ -1766,7 +1755,6 @@ static void texture3d_cleanup_sub_resources(struct wined3d_texture *texture)
 
 static const struct wined3d_texture_ops texture3d_ops =
 {
-    texture3d_sub_resource_load,
     texture3d_sub_resource_upload_data,
     texture3d_load_location,
     texture3d_prepare_location,
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 60bc2d7..02b5db6 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -355,14 +355,6 @@ done:
     return TRUE;
 }
 
-/* Context activation is done by the caller. */
-void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode)
-{
-    wined3d_texture_prepare_texture(volume->container, context, srgb_mode);
-    wined3d_volume_load_location(volume, context,
-            srgb_mode ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB);
-}
-
 void wined3d_volume_cleanup(struct wined3d_volume *volume)
 {
     TRACE("volume %p.\n", volume);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ca1065f..cb6d967 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2416,8 +2416,6 @@ struct gl_texture
 
 struct wined3d_texture_ops
 {
-    void (*texture_sub_resource_load)(struct wined3d_resource *sub_resource,
-            struct wined3d_context *context, BOOL srgb);
     void (*texture_sub_resource_upload_data)(struct wined3d_resource *sub_resource,
             const struct wined3d_context *context, const struct wined3d_sub_resource_data *data);
     BOOL (*texture_load_location)(struct wined3d_texture *texture, unsigned int sub_resource_idx,
@@ -2580,8 +2578,6 @@ static inline struct wined3d_volume *volume_from_resource(struct wined3d_resourc
 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_load(struct wined3d_volume *volume, struct wined3d_context *context,
-        BOOL srgb_mode) DECLSPEC_HIDDEN;
 BOOL wined3d_volume_load_location(struct wined3d_volume *volume,
         struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
 BOOL wined3d_volume_prepare_location(struct wined3d_volume *volume,
@@ -2698,7 +2694,6 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru
 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_load(struct wined3d_surface *surface, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
 void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
         struct wined3d_context *context) DECLSPEC_HIDDEN;
 HRESULT surface_load_location(struct wined3d_surface *surface,




More information about the wine-cvs mailing list