Module: wine Branch: master Commit: f29c24f2de70807d1f4c9c24935ba634e56be276 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f29c24f2de70807d1f4c9c2493...
Author: Stefan Dösinger stefan@codeweavers.com Date: Mon Sep 16 12:43:17 2013 +0200
wined3d: Pass the context to surface_internal_preload.
---
dlls/wined3d/arb_program_shader.c | 7 ++++--- dlls/wined3d/context.c | 6 +++--- dlls/wined3d/surface.c | 29 ++++++++++++++--------------- dlls/wined3d/wined3d_private.h | 3 ++- 4 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index c7194e4..ec4cb89 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7455,6 +7455,9 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter, RECT src_rect = *src_rect_in; RECT dst_rect = *dst_rect_in;
+ /* Activate the destination context, set it up for blitting */ + context = context_acquire(device, dst_surface); + /* Now load the surface */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && (src_surface->flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE)) == SFLAG_INDRAWABLE) @@ -7470,10 +7473,8 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter, src_rect.bottom = src_surface->resource.height - src_rect.bottom; } else - surface_internal_preload(src_surface, SRGB_RGB); + surface_internal_preload(src_surface, context, SRGB_RGB);
- /* Activate the destination context, set it up for blitting */ - context = context_acquire(device, dst_surface); context_apply_blit_state(context, device);
if (!surface_is_offscreen(dst_surface)) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 43befb8..b69a520 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -2123,7 +2123,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
if (context->render_offscreen) { - surface_internal_preload(rt, SRGB_RGB); + surface_internal_preload(rt, context, SRGB_RGB);
context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->draw_binding); if (rt->resource.format->id != WINED3DFMT_NULL) @@ -2662,8 +2662,8 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d { /* Read the back buffer of the old drawable into the destination texture. */ if (context->current_rt->texture_name_srgb) - surface_internal_preload(context->current_rt, SRGB_SRGB); - surface_internal_preload(context->current_rt, SRGB_RGB); + surface_internal_preload(context->current_rt, context, SRGB_SRGB); + surface_internal_preload(context->current_rt, context, SRGB_RGB); surface_invalidate_location(context->current_rt, SFLAG_INDRAWABLE); } } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 66587a1..f988af9 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2647,6 +2647,7 @@ DWORD CDECL wined3d_surface_get_priority(const struct wined3d_surface *surface)
void CDECL wined3d_surface_preload(struct wined3d_surface *surface) { + struct wined3d_context *context; TRACE("surface %p.\n", surface);
if (!surface->resource.device->d3d_initialized) @@ -2655,7 +2656,9 @@ void CDECL wined3d_surface_preload(struct wined3d_surface *surface) return; }
- surface_internal_preload(surface, SRGB_ANY); + context = context_acquire(surface->resource.device, NULL); + surface_internal_preload(surface, context, SRGB_ANY); + context_release(context); }
void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface) @@ -3687,16 +3690,12 @@ HRESULT CDECL wined3d_surface_flip(struct wined3d_surface *surface, struct wined return WINED3D_OK; }
-void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb) +/* Context activation is done by the caller */ +void surface_internal_preload(struct wined3d_surface *surface, + struct wined3d_context *context, enum WINED3DSRGB srgb) { - struct wined3d_device *device = surface->resource.device; - struct wined3d_context *context; - TRACE("iface %p, srgb %#x.\n", surface, srgb);
- /* TODO: Use already acquired context when possible. */ - context = context_acquire(device, NULL); - if (surface->container) { struct wined3d_texture *texture = surface->container; @@ -3718,7 +3717,6 @@ void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB context->gl_info->gl_ops.gl.p_glPrioritizeTextures(1, &surface->texture_name, &tmp); } } - context_release(context); }
/* Read the framebuffer back into the surface */ @@ -4393,7 +4391,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc context = context_acquire(device, src_surface); gl_info = context->gl_info; context_apply_blit_state(context, device); - surface_internal_preload(dst_surface, SRGB_RGB); + surface_internal_preload(dst_surface, context, SRGB_RGB);
/* Bind the target texture */ context_bind_texture(context, dst_target, dst_surface->texture_name); @@ -4501,14 +4499,14 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st context = context_acquire(device, src_surface); gl_info = context->gl_info; context_apply_blit_state(context, device); - surface_internal_preload(dst_surface, SRGB_RGB); + surface_internal_preload(dst_surface, context, SRGB_RGB);
src_offscreen = surface_is_offscreen(src_surface); noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO; if (!noBackBufferBackup && !src_surface->texture_name) { /* Get it a description */ - surface_internal_preload(src_surface, SRGB_RGB); + surface_internal_preload(src_surface, context, SRGB_RGB); }
/* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring. @@ -4791,14 +4789,15 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, src_rect = *src_rect_in; dst_rect = *dst_rect_in;
+ context = context_acquire(device, dst_surface); + gl_info = context->gl_info; + /* Make sure the surface is up-to-date. This should probably use * surface_load_location() and worry about the destination surface too, * unless we're overwriting it completely. */ - surface_internal_preload(src_surface, SRGB_RGB); + surface_internal_preload(src_surface, context, SRGB_RGB);
/* Activate the destination context, set it up for blitting */ - context = context_acquire(device, dst_surface); - gl_info = context->gl_info; context_apply_blit_state(context, device);
if (!surface_is_offscreen(dst_surface)) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 125556e..93f18f5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2252,7 +2252,8 @@ void surface_add_dirty_rect(struct wined3d_surface *surface, const struct wined3 HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const struct wined3d_color *color) DECLSPEC_HIDDEN; GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) DECLSPEC_HIDDEN; -void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN; +void surface_internal_preload(struct wined3d_surface *surface, + struct wined3d_context *context, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN; void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN; BOOL surface_is_offscreen(const struct wined3d_surface *surface) DECLSPEC_HIDDEN; HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN;