From: Henri Verbeet Subject: [PATCH 1/5] wined3d: Return a BOOL from surface_load_location(). Message-Id: <1487721203-18308-1-git-send-email-hverbeet@codeweavers.com> Date: Wed, 22 Feb 2017 00:53:19 +0100 Signed-off-by: Henri Verbeet --- dlls/wined3d/surface.c | 23 ++++++++--------------- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_private.h | 2 +- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b30585c..96819a6 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2747,11 +2747,10 @@ static void surface_load_renderbuffer(struct wined3d_surface *surface, struct wi } /* Context activation is done by the caller. Context may be NULL in ddraw-only mode. */ -HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) +BOOL surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) { unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface); struct wined3d_texture *texture = surface->container; - HRESULT hr; TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location)); @@ -2760,7 +2759,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co DWORD current = texture->sub_resources[sub_resource_idx].locations; FIXME("Unimplemented copy from %s to %s for depth/stencil buffers.\n", wined3d_debug_location(current), wined3d_debug_location(location)); - return WINED3DERR_INVALIDCALL; + return FALSE; } switch (location) @@ -2769,31 +2768,25 @@ HRESULT surface_load_location(struct wined3d_surface *surface, struct wined3d_co case WINED3D_LOCATION_SYSMEM: case WINED3D_LOCATION_BUFFER: surface_load_sysmem(surface, context, location); - break; + return TRUE; case WINED3D_LOCATION_DRAWABLE: - if (FAILED(hr = surface_load_drawable(surface, context))) - return hr; - break; + return SUCCEEDED(surface_load_drawable(surface, context)); case WINED3D_LOCATION_RB_RESOLVED: case WINED3D_LOCATION_RB_MULTISAMPLE: surface_load_renderbuffer(surface, context, location); - break; + return TRUE; case WINED3D_LOCATION_TEXTURE_RGB: case WINED3D_LOCATION_TEXTURE_SRGB: - if (FAILED(hr = surface_load_texture(surface, context, - location == WINED3D_LOCATION_TEXTURE_SRGB))) - return hr; - break; + return SUCCEEDED(surface_load_texture(surface, context, + location == WINED3D_LOCATION_TEXTURE_SRGB)); default: ERR("Don't know how to handle location %#x.\n", location); - break; + return FALSE; } - - return WINED3D_OK; } static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index d86e7ec..037682d 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1574,7 +1574,7 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int static BOOL texture2d_load_location(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_context *context, DWORD location) { - return SUCCEEDED(surface_load_location(texture->sub_resources[sub_resource_idx].u.surface, context, location)); + return surface_load_location(texture->sub_resources[sub_resource_idx].u.surface, context, location); } /* Context activation is done by the caller. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index fd03674..66c1002 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3024,7 +3024,7 @@ HRESULT wined3d_surface_create_dc(struct wined3d_surface *surface) DECLSPEC_HIDD void wined3d_surface_destroy_dc(struct wined3d_surface *surface) 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, +BOOL surface_load_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const struct wined3d_surface *rt) DECLSPEC_HIDDEN; -- 2.1.4