Henri Verbeet : wined3d: Introduce a separate function for loading the SFLAG_INSYSMEM surface location .
Alexandre Julliard
julliard at winehq.org
Tue Jul 5 12:59:03 CDT 2011
Module: wine
Branch: master
Commit: aacd8f8b93eae40c57413df19afe88a4c038898f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aacd8f8b93eae40c57413df19afe88a4c038898f
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Jul 4 21:39:36 2011 +0200
wined3d: Introduce a separate function for loading the SFLAG_INSYSMEM surface location.
---
dlls/wined3d/surface.c | 51 +++++++++++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5fb667d..af97694 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -5878,6 +5878,34 @@ static DWORD resource_access_from_location(DWORD location)
}
}
+static void surface_load_sysmem(struct wined3d_surface *surface,
+ const struct wined3d_gl_info *gl_info, const RECT *rect)
+{
+ surface_prepare_system_memory(surface);
+
+ /* Download the surface to system memory. */
+ if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))
+ {
+ struct wined3d_device *device = surface->resource.device;
+ struct wined3d_context *context = NULL;
+
+ if (!device->isInDraw)
+ context = context_acquire(device, NULL);
+
+ surface_bind_and_dirtify(surface, gl_info, !(surface->flags & SFLAG_INTEXTURE));
+ surface_download_data(surface, gl_info);
+
+ if (context)
+ context_release(context);
+
+ return;
+ }
+
+ /* Note: It might be faster to download into a texture first. */
+ read_from_framebuffer(surface, rect, surface->resource.allocatedMemory,
+ wined3d_surface_get_pitch(surface));
+}
+
HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const RECT *rect)
{
struct wined3d_device *device = surface->resource.device;
@@ -5950,28 +5978,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const
}
if (flag == SFLAG_INSYSMEM)
- {
- surface_prepare_system_memory(surface);
-
- /* Download the surface to system memory */
- if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))
- {
- struct wined3d_context *context = NULL;
-
- if (!device->isInDraw) context = context_acquire(device, NULL);
-
- surface_bind_and_dirtify(surface, gl_info, !(surface->flags & SFLAG_INTEXTURE));
- surface_download_data(surface, gl_info);
-
- if (context) context_release(context);
- }
- else
- {
- /* Note: It might be faster to download into a texture first. */
- read_from_framebuffer(surface, rect, surface->resource.allocatedMemory,
- wined3d_surface_get_pitch(surface));
- }
- }
+ surface_load_sysmem(surface, gl_info, rect);
else if (flag == SFLAG_INDRAWABLE)
{
if (wined3d_settings.rendertargetlock_mode == RTL_READTEX)
More information about the wine-cvs
mailing list