Commit 14f02404 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Pass a context to surface_load_fb_texture.

parent 31e0755e
...@@ -7859,7 +7859,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter, ...@@ -7859,7 +7859,7 @@ static void arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
* flip in the blitter, we don't actually need that flip anyway. So we * flip in the blitter, we don't actually need that flip anyway. So we
* use the surface's texture as scratch texture, and flip the source * use the surface's texture as scratch texture, and flip the source
* rectangle instead. */ * rectangle instead. */
surface_load_fb_texture(src_surface, FALSE); surface_load_fb_texture(src_surface, FALSE, context);
src_rect.top = src_surface->resource.height - src_rect.top; src_rect.top = src_surface->resource.height - src_rect.top;
src_rect.bottom = src_surface->resource.height - src_rect.bottom; src_rect.bottom = src_surface->resource.height - src_rect.bottom;
......
...@@ -2803,14 +2803,23 @@ error: ...@@ -2803,14 +2803,23 @@ error:
/* Read the framebuffer contents into a texture. Note that this function /* Read the framebuffer contents into a texture. Note that this function
* doesn't do any kind of flipping. Using this on an onscreen surface will * doesn't do any kind of flipping. Using this on an onscreen surface will
* result in a flipped D3D texture. */ * result in a flipped D3D texture.
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb) *
* Context activation is done by the caller. This function may temporarily
* switch to a different context and restore the original one before return. */
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *old_ctx)
{ {
struct wined3d_device *device = surface->resource.device; struct wined3d_device *device = surface->resource.device;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context = old_ctx;
struct wined3d_surface *restore_rt = NULL;
if (old_ctx->current_rt != surface)
{
restore_rt = old_ctx->current_rt;
context = context_acquire(device, surface);
}
context = context_acquire(device, surface);
gl_info = context->gl_info; gl_info = context->gl_info;
device_invalidate_state(device, STATE_FRAMEBUFFER); device_invalidate_state(device, STATE_FRAMEBUFFER);
...@@ -2829,7 +2838,8 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb) ...@@ -2829,7 +2838,8 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb)
0, 0, 0, 0, surface->resource.width, surface->resource.height); 0, 0, 0, 0, surface->resource.width, surface->resource.height);
checkGLcall("glCopyTexSubImage2D"); checkGLcall("glCopyTexSubImage2D");
context_release(context); if (restore_rt)
context_restore(context, restore_rt);
} }
void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL multisample) void surface_prepare_rb(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL multisample)
...@@ -3898,7 +3908,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface, ...@@ -3898,7 +3908,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
&& wined3d_resource_is_offscreen(&texture->resource) && wined3d_resource_is_offscreen(&texture->resource)
&& (surface->locations & WINED3D_LOCATION_DRAWABLE)) && (surface->locations & WINED3D_LOCATION_DRAWABLE))
{ {
surface_load_fb_texture(surface, srgb); surface_load_fb_texture(surface, srgb, context);
return WINED3D_OK; return WINED3D_OK;
} }
......
...@@ -2448,7 +2448,8 @@ void surface_invalidate_location(struct wined3d_surface *surface, DWORD location ...@@ -2448,7 +2448,8 @@ void surface_invalidate_location(struct wined3d_surface *surface, DWORD location
void surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN; void surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN;
void surface_load_ds_location(struct wined3d_surface *surface, void surface_load_ds_location(struct wined3d_surface *surface,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb) 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, DWORD location) DECLSPEC_HIDDEN; HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN;
void surface_prepare_rb(struct wined3d_surface *surface, void surface_prepare_rb(struct wined3d_surface *surface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment