Henri Verbeet : wined3d: Move texture2d_load_drawable() to texture.c.

Alexandre Julliard julliard at winehq.org
Mon Jun 24 16:06:20 CDT 2019


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Sat Jun 22 03:49:20 2019 +0430

wined3d: Move texture2d_load_drawable() to texture.c.

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

---

 dlls/wined3d/surface.c         | 48 -----------------------------------------
 dlls/wined3d/texture.c         | 49 +++++++++++++++++++++++++++++++++++++++++-
 dlls/wined3d/wined3d_private.h |  2 --
 3 files changed, 48 insertions(+), 51 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 6d3590b..fc8be38 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1423,54 +1423,6 @@ static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture,
 }
 
 /* Context activation is done by the caller. */
-BOOL texture2d_load_drawable(struct wined3d_texture *texture,
-        unsigned int sub_resource_idx, struct wined3d_context *context)
-{
-    struct wined3d_texture *restore_texture;
-    struct wined3d_device *device;
-    unsigned int restore_idx;
-    unsigned int level;
-    RECT r;
-
-    if (texture->resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
-    {
-        DWORD current = texture->sub_resources[sub_resource_idx].locations;
-        FIXME("Unimplemented copy from %s for depth/stencil buffers.\n",
-                wined3d_debug_location(current));
-        return FALSE;
-    }
-
-    if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
-            && wined3d_resource_is_offscreen(&texture->resource))
-    {
-        ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n");
-        return FALSE;
-    }
-
-    device = texture->resource.device;
-    restore_texture = context->current_rt.texture;
-    restore_idx = context->current_rt.sub_resource_idx;
-    if (restore_texture != texture || restore_idx != sub_resource_idx)
-        context = context_acquire(device, texture, sub_resource_idx);
-    else
-        restore_texture = NULL;
-
-    level = sub_resource_idx % texture->level_count;
-    SetRect(&r, 0, 0, wined3d_texture_get_level_width(texture, level),
-            wined3d_texture_get_level_height(texture, level));
-    wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
-    device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context,
-            texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r,
-            texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r,
-            NULL, WINED3D_TEXF_POINT);
-
-    if (restore_texture)
-        context_restore(context, restore_texture, restore_idx);
-
-    return TRUE;
-}
-
-/* Context activation is done by the caller. */
 BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, DWORD dst_location)
 {
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index ae3e179..4ae869b 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2481,6 +2481,53 @@ static BOOL wined3d_texture_gl_load_sysmem(struct wined3d_texture_gl *texture_gl
     return FALSE;
 }
 
+static BOOL wined3d_texture_load_drawable(struct wined3d_texture *texture,
+        unsigned int sub_resource_idx, struct wined3d_context *context)
+{
+    struct wined3d_texture *restore_texture;
+    struct wined3d_device *device;
+    unsigned int restore_idx;
+    unsigned int level;
+    RECT r;
+
+    if (texture->resource.bind_flags & WINED3D_BIND_DEPTH_STENCIL)
+    {
+        DWORD current = texture->sub_resources[sub_resource_idx].locations;
+        FIXME("Unimplemented copy from %s for depth/stencil buffers.\n",
+                wined3d_debug_location(current));
+        return FALSE;
+    }
+
+    if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
+            && wined3d_resource_is_offscreen(&texture->resource))
+    {
+        ERR("Trying to load offscreen texture into WINED3D_LOCATION_DRAWABLE.\n");
+        return FALSE;
+    }
+
+    device = texture->resource.device;
+    restore_texture = context->current_rt.texture;
+    restore_idx = context->current_rt.sub_resource_idx;
+    if (restore_texture != texture || restore_idx != sub_resource_idx)
+        context = context_acquire(device, texture, sub_resource_idx);
+    else
+        restore_texture = NULL;
+
+    level = sub_resource_idx % texture->level_count;
+    SetRect(&r, 0, 0, wined3d_texture_get_level_width(texture, level),
+            wined3d_texture_get_level_height(texture, level));
+    wined3d_texture_load_location(texture, sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
+    device->blitter->ops->blitter_blit(device->blitter, WINED3D_BLIT_OP_COLOR_BLIT, context,
+            texture, sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB, &r,
+            texture, sub_resource_idx, WINED3D_LOCATION_DRAWABLE, &r,
+            NULL, WINED3D_TEXF_POINT);
+
+    if (restore_texture)
+        context_restore(context, restore_texture, restore_idx);
+
+    return TRUE;
+}
+
 static BOOL wined3d_texture_gl_load_texture(struct wined3d_texture_gl *texture_gl,
         unsigned int sub_resource_idx, struct wined3d_context_gl *context_gl, BOOL srgb)
 {
@@ -2651,7 +2698,7 @@ static BOOL wined3d_texture_gl_load_location(struct wined3d_texture *texture,
             return wined3d_texture_gl_load_sysmem(texture_gl, sub_resource_idx, context_gl, location);
 
         case WINED3D_LOCATION_DRAWABLE:
-            return texture2d_load_drawable(texture, sub_resource_idx, context);
+            return wined3d_texture_load_drawable(texture, sub_resource_idx, context);
 
         case WINED3D_LOCATION_RB_RESOLVED:
         case WINED3D_LOCATION_RB_MULTISAMPLE:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8e23653..f796d12 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3549,8 +3549,6 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co
         const RECT *dst_rect) DECLSPEC_HIDDEN;
 void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
         const RECT *rect, struct wined3d_blt_info *info) DECLSPEC_HIDDEN;
-BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx,
-        struct wined3d_context *context) DECLSPEC_HIDDEN;
 void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
         BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN;
 BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,




More information about the wine-cvs mailing list