Module: wine Branch: master Commit: 964f4b0157d0d0a5530c214b859c56728d9f588c URL: http://source.winehq.org/git/wine.git/?a=commit;h=964f4b0157d0d0a5530c214b85...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Thu Jun 25 10:24:55 2009 +0200
wined3d: Make sure we have an active GL context in buffer_PreLoad().
---
dlls/wined3d/buffer.c | 7 +++---- dlls/wined3d/drawprim.c | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 8896db9..4b71311 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 dcdf21a..c0fb678 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);