Commit 964f4b01 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Make sure we have an active GL context in buffer_PreLoad().

parent 11fd358c
......@@ -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");
......
......@@ -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);
......
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