Commit 6b34b8e6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Simply pass an IWineD3DSurfaceImpl pointer to context_acquire().

parent 1c403e44
......@@ -6909,7 +6909,7 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
surface_internal_preload((IWineD3DSurface *)src_surface, SRGB_RGB);
/* Activate the destination context, set it up for blitting */
context = context_acquire(device, (IWineD3DSurface *)dst_surface, CTXUSAGE_BLIT);
context = context_acquire(device, dst_surface, CTXUSAGE_BLIT);
/* The coordinates of the ddraw front buffer are always fullscreen ('screen coordinates',
* while OpenGL coordinates are window relative.
......
......@@ -2179,15 +2179,16 @@ static void context_setup_target(IWineD3DDeviceImpl *device,
* usage: Prepares the context for blitting, drawing or other actions
*
*****************************************************************************/
struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, IWineD3DSurface *target, enum ContextUsage usage)
struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device,
IWineD3DSurfaceImpl *target, enum ContextUsage usage)
{
struct wined3d_context *current_context = context_get_current();
struct wined3d_context *context;
TRACE("device %p, target %p, usage %#x.\n", device, target, usage);
context = FindContext(device, (IWineD3DSurfaceImpl *)target);
context_setup_target(device, context, (IWineD3DSurfaceImpl *)target);
context = FindContext(device, target);
context_setup_target(device, context, target);
context_enter(context);
if (!context->valid) return context;
......
......@@ -1658,7 +1658,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
/* Setup all the devices defaults */
IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *)This->stateBlock);
context = context_acquire(This, swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This, (IWineD3DSurfaceImpl *)swapchain->frontBuffer, CTXUSAGE_RESOURCELOAD);
create_dummy_textures(This);
......@@ -4394,7 +4394,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
IWineD3DSurface_LoadLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, NULL);
}
context = context_acquire(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
context = context_acquire(This, target, CTXUSAGE_CLEAR);
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
{
if (!surface_is_offscreen(target))
......@@ -5462,7 +5462,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
{
TRACE("Surface %p is onscreen\n", surface);
context = context_acquire(This, surface, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This, (IWineD3DSurfaceImpl *)surface, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
context_set_draw_buffer(context, surface_get_gl_buffer((IWineD3DSurfaceImpl *)surface));
......@@ -5756,8 +5756,8 @@ void stretch_rect_fbo(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surfa
IWineD3DSurface_LoadLocation((IWineD3DSurface *)src_surface, SFLAG_INDRAWABLE, NULL);
IWineD3DSurface_LoadLocation((IWineD3DSurface *)dst_surface, SFLAG_INDRAWABLE, NULL);
if (!surface_is_offscreen(src_surface)) context = context_acquire(device, (IWineD3DSurface *)src_surface, CTXUSAGE_RESOURCELOAD);
else if (!surface_is_offscreen(dst_surface)) context = context_acquire(device, (IWineD3DSurface *)dst_surface, CTXUSAGE_RESOURCELOAD);
if (!surface_is_offscreen(src_surface)) context = context_acquire(device, src_surface, CTXUSAGE_RESOURCELOAD);
else if (!surface_is_offscreen(dst_surface)) context = context_acquire(device, dst_surface, CTXUSAGE_RESOURCELOAD);
else context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
if (!context->valid)
......
......@@ -594,7 +594,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
/* Signals other modules that a drawing is in progress and the stateblock finalized */
This->isInDraw = TRUE;
context = context_acquire(This, (IWineD3DSurface *)This->render_targets[0], CTXUSAGE_DRAWPRIM);
context = context_acquire(This, This->render_targets[0], CTXUSAGE_DRAWPRIM);
if (!context->valid)
{
context_release(context);
......
......@@ -59,7 +59,7 @@ enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_qu
return WINED3D_EVENT_QUERY_WRONG_THREAD;
}
context = context_acquire(device, (IWineD3DSurface *)query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
gl_info = context->gl_info;
ENTER_GL();
......@@ -136,7 +136,7 @@ enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_
return WINED3D_EVENT_QUERY_WRONG_THREAD;
}
context = context_acquire(device, (IWineD3DSurface *)query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
if (gl_info->supported[ARB_SYNC])
......@@ -195,7 +195,7 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, IWineD3DDevice
}
else
{
context = context_acquire(device, (IWineD3DSurface *)query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
}
}
else
......@@ -348,7 +348,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface,
return S_OK;
}
context = context_acquire(This->device, (IWineD3DSurface *)query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
......@@ -490,8 +490,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
}
else
{
context = context_acquire(This->device, (IWineD3DSurface *)query->context->current_rt,
CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
......@@ -526,8 +525,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
}
else
{
context = context_acquire(This->device, (IWineD3DSurface *)query->context->current_rt,
CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
......
......@@ -1272,7 +1272,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v
* should help here. Furthermore unlockrect will need the context set up for blitting. The context manager will find
* context->last_was_blit set on the unlock.
*/
context = context_acquire(device, (IWineD3DSurface *)This, CTXUSAGE_BLIT);
context = context_acquire(device, This, CTXUSAGE_BLIT);
gl_info = context->gl_info;
ENTER_GL();
......@@ -1500,7 +1500,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
* locking during offscreen rendering). RESOURCELOAD is ok because glCopyTexSubImage2D isn't affected by any
* states in the stateblock, and no driver was found yet that had bugs in that regard.
*/
context = context_acquire(device, (IWineD3DSurface *) This, CTXUSAGE_RESOURCELOAD);
context = context_acquire(device, This, CTXUSAGE_RESOURCELOAD);
gl_info = context->gl_info;
surface_bind_and_dirtify(This, srgb);
......@@ -1767,7 +1767,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
struct wined3d_context *context;
/* Activate the correct context for the render target */
context = context_acquire(device, (IWineD3DSurface *)This, CTXUSAGE_BLIT);
context = context_acquire(device, This, CTXUSAGE_BLIT);
gl_info = context->gl_info;
ENTER_GL();
......@@ -2983,7 +2983,7 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
upsidedown = TRUE;
}
context = context_acquire(device, SrcSurface, CTXUSAGE_BLIT);
context = context_acquire(device, Src, CTXUSAGE_BLIT);
surface_internal_preload((IWineD3DSurface *) This, SRGB_RGB);
ENTER_GL();
......@@ -3089,7 +3089,7 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
TRACE("Using hwstretch blit\n");
/* Activate the Proper context for reading from the source surface, set it up for blitting */
context = context_acquire(device, SrcSurface, CTXUSAGE_BLIT);
context = context_acquire(device, Src, CTXUSAGE_BLIT);
surface_internal_preload((IWineD3DSurface *) This, SRGB_RGB);
src_offscreen = surface_is_offscreen(Src);
......@@ -3623,7 +3623,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
surface_internal_preload((IWineD3DSurface *) Src, SRGB_RGB);
/* Activate the destination context, set it up for blitting */
context = context_acquire(device, (IWineD3DSurface *)This, CTXUSAGE_BLIT);
context = context_acquire(device, This, CTXUSAGE_BLIT);
/* The coordinates of the ddraw front buffer are always fullscreen ('screen coordinates',
* while OpenGL coordinates are window relative.
......@@ -4262,7 +4262,7 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
surface_get_rect(This, rect_in, &src_rect);
context = context_acquire(device, (IWineD3DSurface*)This, CTXUSAGE_BLIT);
context = context_acquire(device, This, CTXUSAGE_BLIT);
if (context->render_offscreen)
{
dst_rect.left = src_rect.left;
......
......@@ -142,7 +142,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *
float tex_right = src_rect->right;
float tex_bottom = src_rect->bottom;
context2 = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_BLIT);
context2 = context_acquire(This->device, (IWineD3DSurfaceImpl *)This->backBuffer[0], CTXUSAGE_BLIT);
if(backbuffer->Flags & SFLAG_NORMCOORD)
{
......@@ -220,7 +220,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
IWineD3DSwapChain_SetDestWindowOverride(iface, hDestWindowOverride);
context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, (IWineD3DSurfaceImpl *)This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
if (!context->valid)
{
context_release(context);
......
......@@ -1205,7 +1205,7 @@ typedef enum ContextUsage {
} ContextUsage;
struct wined3d_context *context_acquire(IWineD3DDeviceImpl *This,
IWineD3DSurface *target, enum ContextUsage usage) DECLSPEC_HIDDEN;
IWineD3DSurfaceImpl *target, enum ContextUsage usage) DECLSPEC_HIDDEN;
void context_alloc_event_query(struct wined3d_context *context,
struct wined3d_event_query *query) DECLSPEC_HIDDEN;
void context_alloc_occlusion_query(struct wined3d_context *context,
......
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