Henri Verbeet : wined3d: Merge surface_load_location() into texture2d_load_location().
Alexandre Julliard
julliard at winehq.org
Tue Mar 6 16:48:50 CST 2018
Module: wine
Branch: master
Commit: c1f5b9ac67b5dbed71d4a32a8d3d833d39a0dc1a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c1f5b9ac67b5dbed71d4a32a8d3d833d39a0dc1a
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Mar 6 10:26:27 2018 +0330
wined3d: Merge surface_load_location() into texture2d_load_location().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/surface.c | 40 +++++-----------------------------------
dlls/wined3d/texture.c | 31 ++++++++++++++++++++++++++++++-
dlls/wined3d/wined3d_private.h | 10 ++++++++--
3 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5a2bf52..23d7ae7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2060,7 +2060,7 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
}
/* Context activation is done by the caller. */
-static BOOL surface_load_sysmem(struct wined3d_surface *surface,
+BOOL surface_load_sysmem(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD dst_location)
{
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
@@ -2108,7 +2108,7 @@ static BOOL surface_load_sysmem(struct wined3d_surface *surface,
}
/* Context activation is done by the caller. */
-static BOOL surface_load_drawable(struct wined3d_surface *surface,
+BOOL surface_load_drawable(struct wined3d_surface *surface,
struct wined3d_context *context)
{
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
@@ -2155,7 +2155,7 @@ static BOOL surface_load_drawable(struct wined3d_surface *surface,
return TRUE;
}
-static BOOL surface_load_texture(struct wined3d_surface *surface,
+BOOL surface_load_texture(struct wined3d_surface *surface,
struct wined3d_context *context, BOOL srgb)
{
unsigned int width, height, level, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch;
@@ -2326,8 +2326,8 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
}
/* Context activation is done by the caller. */
-static BOOL surface_load_renderbuffer(struct wined3d_surface *surface, struct wined3d_context *context,
- DWORD dst_location)
+BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
+ struct wined3d_context *context, DWORD dst_location)
{
struct wined3d_texture *texture = surface->container;
unsigned int level = surface_get_sub_resource_idx(surface) % texture->level_count;
@@ -2359,36 +2359,6 @@ static BOOL surface_load_renderbuffer(struct wined3d_surface *surface, struct wi
return TRUE;
}
-/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
-BOOL surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location)
-{
- TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
-
- switch (location)
- {
- case WINED3D_LOCATION_USER_MEMORY:
- case WINED3D_LOCATION_SYSMEM:
- case WINED3D_LOCATION_BUFFER:
- return surface_load_sysmem(surface, context, location);
-
- case WINED3D_LOCATION_DRAWABLE:
- return surface_load_drawable(surface, context);
-
- case WINED3D_LOCATION_RB_RESOLVED:
- case WINED3D_LOCATION_RB_MULTISAMPLE:
- return surface_load_renderbuffer(surface, context, location);
-
- case WINED3D_LOCATION_TEXTURE_RGB:
- case WINED3D_LOCATION_TEXTURE_SRGB:
- return surface_load_texture(surface, context,
- location == WINED3D_LOCATION_TEXTURE_SRGB);
-
- default:
- ERR("Don't know how to handle location %#x.\n", location);
- return FALSE;
- }
-}
-
/* Context activation is done by the caller. */
static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context)
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 8c03331..72aee66 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1788,10 +1788,39 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int
texture->resource.format, &src_rect, row_pitch, &dst_point, FALSE, data);
}
+/* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */
static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD location)
{
- return surface_load_location(texture->sub_resources[sub_resource_idx].u.surface, context, location);
+ struct wined3d_surface *surface;
+
+ TRACE("texture %p, sub_resource_idx %u, context %p, location %s.\n",
+ texture, sub_resource_idx, context, wined3d_debug_location(location));
+
+ surface = texture->sub_resources[sub_resource_idx].u.surface;
+ switch (location)
+ {
+ case WINED3D_LOCATION_USER_MEMORY:
+ case WINED3D_LOCATION_SYSMEM:
+ case WINED3D_LOCATION_BUFFER:
+ return surface_load_sysmem(surface, context, location);
+
+ case WINED3D_LOCATION_DRAWABLE:
+ return surface_load_drawable(surface, context);
+
+ case WINED3D_LOCATION_RB_RESOLVED:
+ case WINED3D_LOCATION_RB_MULTISAMPLE:
+ return surface_load_renderbuffer(surface, context, location);
+
+ case WINED3D_LOCATION_TEXTURE_RGB:
+ case WINED3D_LOCATION_TEXTURE_SRGB:
+ return surface_load_texture(surface, context,
+ location == WINED3D_LOCATION_TEXTURE_SRGB);
+
+ default:
+ ERR("Don't know how to handle location %#x.\n", location);
+ return FALSE;
+ }
}
/* Context activation is done by the caller. */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d7895b5..6d2ff8e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3337,10 +3337,16 @@ static inline struct wined3d_texture_sub_resource *surface_get_sub_resource(stru
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;
+BOOL surface_load_drawable(struct wined3d_surface *surface,
+ struct wined3d_context *context) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb,
struct wined3d_context *context) DECLSPEC_HIDDEN;
-BOOL surface_load_location(struct wined3d_surface *surface,
- struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
+BOOL surface_load_renderbuffer(struct wined3d_surface *surface,
+ struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
+BOOL surface_load_sysmem(struct wined3d_surface *surface,
+ struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
+BOOL surface_load_texture(struct wined3d_surface *surface,
+ struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect,
unsigned int src_pitch, const POINT *dst_point, BOOL srgb,
More information about the wine-cvs
mailing list