diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 8896db97093..4b7131155aa 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -37,13 +37,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); static void buffer_create_buffer_object(struct wined3d_buffer *This) { GLenum error, gl_usage; - IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; TRACE("Creating an OpenGL vertex buffer object for IWineD3DVertexBuffer %p Usage(%s)\n", This, debug_d3dusage(This->resource.usage)); - /* Make sure that a context is there. Needed in a multithreaded environment. Otherwise this call is a nop */ - ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ENTER_GL(); /* Make sure that the gl error is cleared. Do not use checkGLcall @@ -689,6 +686,8 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface) TRACE("iface %p\n", iface); + ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); + if (!This->buffer_object) { /* TODO: Make converting independent from VBOs */ @@ -724,7 +723,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface) if (This->conversion_count > VB_MAXDECLCHANGES) { FIXME("Too many declaration changes, stopping converting\n"); - ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); + ENTER_GL(); GL_EXTCALL(glDeleteBuffersARB(1, &This->buffer_object)); checkGLcall("glDeleteBuffersARB"); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index dcdf21aca88..c0fb6783cbb 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -756,6 +756,11 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, GLenum feedback_type; GLfloat *feedbuffer; + /* Simply activate the context for blitting. This disables all the things we don't want and + * takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the + * patch (as opposed to normal draws) will most likely need different changes anyway. */ + ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_BLIT); + /* First, locate the position data. This is provided in a vertex buffer in the stateblock. * Beware of vbos */ @@ -806,11 +811,6 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, patch->has_normals = TRUE; patch->has_texcoords = FALSE; - /* Simply activate the context for blitting. This disables all the things we don't want and - * takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the - * patch (as opposed to normal draws) will most likely need different changes anyway - */ - ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_BLIT); ENTER_GL(); glMatrixMode(GL_PROJECTION);