=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Pass a context to surface_load_texture.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Oct 16 09:03:45 CDT 2015
Module: wine
Branch: master
Commit: 31e0755ea664e02f05a1e500a19fb5f584c1c1cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=31e0755ea664e02f05a1e500a19fb5f584c1c1cc
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Thu Oct 15 22:41:10 2015 +0200
wined3d: Pass a context to surface_load_texture.
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/surface.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index eb88b59..1b78712 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3881,13 +3881,13 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
}
static HRESULT surface_load_texture(struct wined3d_surface *surface,
- const struct wined3d_gl_info *gl_info, BOOL srgb)
+ struct wined3d_context *context, BOOL srgb)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
RECT src_rect = {0, 0, surface->resource.width, surface->resource.height};
struct wined3d_device *device = surface->resource.device;
const struct wined3d_color_key_conversion *conversion;
struct wined3d_texture *texture = surface->container;
- struct wined3d_context *context;
UINT width, src_pitch, dst_pitch;
struct wined3d_bo_address data;
struct wined3d_format format;
@@ -3909,8 +3909,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format,
NULL, surface->resource.usage, surface->resource.pool, surface->resource.format))
{
- context = context_acquire(device, NULL);
-
if (srgb)
surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, WINED3D_LOCATION_TEXTURE_RGB,
&src_rect, surface, WINED3D_LOCATION_TEXTURE_SRGB, &src_rect);
@@ -3918,8 +3916,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, WINED3D_LOCATION_TEXTURE_SRGB,
&src_rect, surface, WINED3D_LOCATION_TEXTURE_RGB, &src_rect);
- context_release(context);
-
return WINED3D_OK;
}
@@ -3934,10 +3930,8 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
DWORD dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
RECT rect = {0, 0, surface->resource.width, surface->resource.height};
- context = context_acquire(device, NULL);
surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, src_location,
&rect, surface, dst_location, &rect);
- context_release(context);
return WINED3D_OK;
}
@@ -3975,9 +3969,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface_load_location(surface, WINED3D_LOCATION_SYSMEM);
}
- /* TODO: Use already acquired context when possible. */
- context = context_acquire(device, NULL);
-
wined3d_texture_prepare_texture(texture, context, srgb);
wined3d_texture_bind_and_dirtify(texture, context, srgb);
@@ -4051,8 +4042,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
wined3d_surface_upload_data(surface, gl_info, &format, &src_rect,
src_pitch, &dst_point, srgb, wined3d_const_bo_address(&data));
- context_release(context);
-
HeapFree(GetProcessHeap(), 0, mem);
return WINED3D_OK;
@@ -4074,7 +4063,6 @@ static void surface_multisample_resolve(struct wined3d_surface *surface, struct
HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
{
struct wined3d_device *device = surface->resource.device;
- const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
HRESULT hr;
struct wined3d_context *context = NULL;
@@ -4154,7 +4142,10 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
case WINED3D_LOCATION_TEXTURE_RGB:
case WINED3D_LOCATION_TEXTURE_SRGB:
- if (FAILED(hr = surface_load_texture(surface, gl_info, location == WINED3D_LOCATION_TEXTURE_SRGB)))
+ context = context_acquire(device, NULL);
+ hr = surface_load_texture(surface, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
+ context_release(context);
+ if (FAILED(hr))
return hr;
break;
More information about the wine-cvs
mailing list