Commit dda91ac0 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Call frag_pipe->enable_extension under the GL lock.

parent dbd058a8
......@@ -5504,10 +5504,9 @@ struct arbfp_ffp_desc
unsigned int num_textures_used;
};
/* Context activation is done by the caller. */
/* Context activation and GL locking are done by the caller. */
static void arbfp_enable(BOOL enable)
{
ENTER_GL();
if(enable) {
glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
......@@ -5515,7 +5514,6 @@ static void arbfp_enable(BOOL enable)
glDisable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
}
LEAVE_GL();
}
static HRESULT arbfp_alloc(struct wined3d_device *device)
......
......@@ -1054,10 +1054,9 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
};
/* Context activation is done by the caller. */
/* Context activation and GL locking are done by the caller. */
static void atifs_enable(BOOL enable)
{
ENTER_GL();
if(enable) {
glEnable(GL_FRAGMENT_SHADER_ATI);
checkGLcall("glEnable(GL_FRAGMENT_SHADER_ATI)");
......@@ -1065,7 +1064,6 @@ static void atifs_enable(BOOL enable)
glDisable(GL_FRAGMENT_SHADER_ATI);
checkGLcall("glDisable(GL_FRAGMENT_SHADER_ATI)");
}
LEAVE_GL();
}
static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
......
......@@ -1649,11 +1649,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
{
GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT));
}
device->frag_pipe->enable_extension(TRUE);
LEAVE_GL();
device->frag_pipe->enable_extension(TRUE);
TRACE("Created context %p.\n", ret);
return ret;
......@@ -1913,14 +1912,13 @@ static void SetupForBlit(struct wined3d_device *device, struct wined3d_context *
Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPING), StateTable);
set_blit_dimension(width, height);
device->frag_pipe->enable_extension(FALSE);
LEAVE_GL();
context->blit_w = width; context->blit_h = height;
Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable);
Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable);
device->frag_pipe->enable_extension(FALSE);
}
/* Do not call while under the GL lock. */
......@@ -2208,6 +2206,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
LEAVE_GL();
}
ENTER_GL();
if (context->last_was_blit)
{
device->frag_pipe->enable_extension(TRUE);
......@@ -2216,7 +2215,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_d
/* Blending and clearing should be orthogonal, but tests on the nvidia
* driver show that disabling blending when clearing improves the clearing
* performance incredibly. */
ENTER_GL();
glDisable(GL_BLEND);
glEnable(GL_SCISSOR_TEST);
checkGLcall("glEnable GL_SCISSOR_TEST");
......@@ -2286,12 +2284,12 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
LEAVE_GL();
}
ENTER_GL();
if (context->last_was_blit)
{
device->frag_pipe->enable_extension(TRUE);
}
ENTER_GL();
for (i = 0; i < context->numDirtyEntries; ++i)
{
DWORD rep = context->dirtyArray[i];
......@@ -2381,8 +2379,16 @@ struct wined3d_context *context_acquire(struct wined3d_device *device, struct wi
if (context != current_context)
{
if (!context_set_current(context)) ERR("Failed to activate the new context.\n");
else device->frag_pipe->enable_extension(!context->last_was_blit);
if (!context_set_current(context))
{
ERR("Failed to activate the new context.\n");
}
else
{
ENTER_GL();
device->frag_pipe->enable_extension(!context->last_was_blit);
LEAVE_GL();
}
if (context->vshader_const_dirty)
{
......
......@@ -623,10 +623,9 @@ static void nvrc_texfactor(DWORD state, struct wined3d_stateblock *stateblock, s
/* Context activation is done by the caller. */
static void nvrc_enable(BOOL enable) {}
/* Context activation is done by the caller. */
/* Context activation and GL locking are done by the caller. */
static void nvts_enable(BOOL enable)
{
ENTER_GL();
if(enable) {
glEnable(GL_TEXTURE_SHADER_NV);
checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
......@@ -634,7 +633,6 @@ static void nvts_enable(BOOL enable)
glDisable(GL_TEXTURE_SHADER_NV);
checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
}
LEAVE_GL();
}
static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
......
......@@ -5578,7 +5578,7 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
};
/* Context activation is done by the caller. */
/* Context activation and GL locking are done by the caller. */
static void ffp_enable(BOOL enable) {}
static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
......
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