wined3d: Make context_acquire() unconditional in a bunch of places.

This commit is contained in:
Matteo Bruni 2011-07-27 23:14:34 +02:00 committed by Alexandre Julliard
parent da7f9ed16b
commit be8ea9c36e
2 changed files with 23 additions and 28 deletions

View File

@ -3861,11 +3861,12 @@ void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB
}
else
{
struct wined3d_context *context = NULL;
struct wined3d_context *context;
TRACE("(%p) : About to load surface\n", surface);
if (!device->isInDraw) context = context_acquire(device, NULL);
/* TODO: Use already acquired context when possible. */
context = context_acquire(device, NULL);
if (surface->resource.format->id == WINED3DFMT_P8_UINT
|| surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
@ -3892,7 +3893,7 @@ void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB
LEAVE_GL();
}
if (context) context_release(context);
context_release(context);
}
}
@ -5888,15 +5889,14 @@ static void surface_load_sysmem(struct wined3d_surface *surface,
if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))
{
struct wined3d_device *device = surface->resource.device;
struct wined3d_context *context = NULL;
struct wined3d_context *context;
if (!device->isInDraw)
/* TODO: Use already acquired context when possible. */
context = context_acquire(device, NULL);
surface_bind_and_dirtify(surface, gl_info, !(surface->flags & SFLAG_INTEXTURE));
surface_download_data(surface, gl_info);
if (context)
context_release(context);
return;
@ -5943,16 +5943,15 @@ static HRESULT surface_load_drawable(struct wined3d_surface *surface,
* called. */
if ((convert != NO_CONVERSION) && (surface->flags & SFLAG_PBO))
{
struct wined3d_context *context = NULL;
struct wined3d_context *context;
TRACE("Removing the pbo attached to surface %p.\n", surface);
if (!device->isInDraw)
/* TODO: Use already acquired context when possible. */
context = context_acquire(device, NULL);
surface_remove_pbo(surface, gl_info);
if (context)
context_release(context);
}
@ -6003,7 +6002,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
const DWORD attach_flags = WINED3DFMT_FLAG_FBO_ATTACHABLE | WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
RECT src_rect = {0, 0, surface->resource.width, surface->resource.height};
struct wined3d_device *device = surface->resource.device;
struct wined3d_context *context = NULL;
struct wined3d_context *context;
UINT width, src_pitch, dst_pitch;
struct wined3d_bo_address data;
struct wined3d_format format;
@ -6067,7 +6066,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
surface_load_location(surface, SFLAG_INSYSMEM, rect);
}
if (!device->isInDraw)
/* TODO: Use already acquired context when possible. */
context = context_acquire(device, NULL);
surface_prepare_texture(surface, gl_info, srgb);
@ -6104,7 +6103,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
if (!(mem = HeapAlloc(GetProcessHeap(), 0, dst_pitch * height)))
{
ERR("Out of memory (%u).\n", dst_pitch * height);
if (context)
context_release(context);
return E_OUTOFMEMORY;
}
@ -6122,7 +6120,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
if (!(mem = HeapAlloc(GetProcessHeap(), 0, dst_pitch * height)))
{
ERR("Out of memory (%u).\n", dst_pitch * height);
if (context)
context_release(context);
return E_OUTOFMEMORY;
}
@ -6138,7 +6135,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
data.addr = mem;
surface_upload_data(surface, gl_info, &format, &src_rect, width, &dst_point, srgb, &data);
if (context)
context_release(context);
/* Don't delete PBO memory. */

View File

@ -1068,15 +1068,15 @@ static HRESULT texture3d_bind(struct wined3d_texture *texture,
static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB srgb)
{
struct wined3d_device *device = texture->resource.device;
struct wined3d_context *context = NULL;
struct wined3d_context *context;
BOOL srgb_was_toggled = FALSE;
unsigned int i;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
if (!device->isInDraw)
/* TODO: Use already acquired context when possible. */
context = context_acquire(device, NULL);
else if (texture->bind_count > 0)
if (texture->bind_count > 0)
{
BOOL texture_srgb = texture->flags & WINED3D_TEXTURE_IS_SRGB;
BOOL sampler_srgb = texture_srgb_mode(texture, srgb);
@ -1115,7 +1115,6 @@ static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB
TRACE("Texture %p not dirty, nothing to do.\n", texture);
}
if (context)
context_release(context);
/* No longer dirty */