wined3d: Avoid some common invalid context accesses.
Unfortunately there are plenty of other places left. Perhaps we should consider creating our own window when the context becomes invalid and making the context current on that instead.
This commit is contained in:
parent
135f364110
commit
7c930589bc
|
@ -4369,6 +4369,12 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
|
||||||
}
|
}
|
||||||
|
|
||||||
context = context_acquire(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
|
context = context_acquire(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
|
||||||
|
if (!context->valid)
|
||||||
|
{
|
||||||
|
context_release(context);
|
||||||
|
WARN("Invalid context, skipping clear.\n");
|
||||||
|
return WINED3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
target->get_drawable_size(context, &drawable_width, &drawable_height);
|
target->get_drawable_size(context, &drawable_width, &drawable_height);
|
||||||
|
|
||||||
|
@ -5842,6 +5848,13 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
||||||
else if (!surface_is_offscreen(dst_surface)) context = context_acquire(This, dst_surface, CTXUSAGE_RESOURCELOAD);
|
else if (!surface_is_offscreen(dst_surface)) context = context_acquire(This, dst_surface, CTXUSAGE_RESOURCELOAD);
|
||||||
else context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
|
else context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
|
||||||
|
|
||||||
|
if (!context->valid)
|
||||||
|
{
|
||||||
|
context_release(context);
|
||||||
|
WARN("Invalid context, skipping blit.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gl_info = context->gl_info;
|
gl_info = context->gl_info;
|
||||||
|
|
||||||
if (!surface_is_offscreen(src_surface))
|
if (!surface_is_offscreen(src_surface))
|
||||||
|
|
|
@ -596,6 +596,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
|
||||||
This->isInDraw = TRUE;
|
This->isInDraw = TRUE;
|
||||||
|
|
||||||
context = context_acquire(This, This->render_targets[0], CTXUSAGE_DRAWPRIM);
|
context = context_acquire(This, This->render_targets[0], CTXUSAGE_DRAWPRIM);
|
||||||
|
if (!context->valid)
|
||||||
|
{
|
||||||
|
context_release(context);
|
||||||
|
WARN("Invalid context, skipping draw.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (This->stencilBufferTarget) {
|
if (This->stencilBufferTarget) {
|
||||||
/* Note that this depends on the context_acquire() call above to set
|
/* Note that this depends on the context_acquire() call above to set
|
||||||
|
|
|
@ -223,6 +223,12 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
||||||
IWineD3DSwapChain_SetDestWindowOverride(iface, hDestWindowOverride);
|
IWineD3DSwapChain_SetDestWindowOverride(iface, hDestWindowOverride);
|
||||||
|
|
||||||
context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
|
context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
|
||||||
|
if (!context->valid)
|
||||||
|
{
|
||||||
|
context_release(context);
|
||||||
|
WARN("Invalid context, skipping present.\n");
|
||||||
|
return WINED3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* Render the cursor onto the back buffer, using our nifty directdraw blitting code :-) */
|
/* Render the cursor onto the back buffer, using our nifty directdraw blitting code :-) */
|
||||||
if (This->device->bCursorVisible && This->device->cursorTexture)
|
if (This->device->bCursorVisible && This->device->cursorTexture)
|
||||||
|
|
Loading…
Reference in New Issue