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

This commit is contained in:
Stefan Dösinger 2011-05-24 23:36:16 +02:00 committed by Alexandre Julliard
parent dbd058a85a
commit dda91ac02a
5 changed files with 18 additions and 18 deletions

View File

@ -5504,10 +5504,9 @@ struct arbfp_ffp_desc
unsigned int num_textures_used; 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) static void arbfp_enable(BOOL enable)
{ {
ENTER_GL();
if(enable) { if(enable) {
glEnable(GL_FRAGMENT_PROGRAM_ARB); glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("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); glDisable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
} }
LEAVE_GL();
} }
static HRESULT arbfp_alloc(struct wined3d_device *device) static HRESULT arbfp_alloc(struct wined3d_device *device)

View File

@ -1054,10 +1054,9 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, {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) static void atifs_enable(BOOL enable)
{ {
ENTER_GL();
if(enable) { if(enable) {
glEnable(GL_FRAGMENT_SHADER_ATI); glEnable(GL_FRAGMENT_SHADER_ATI);
checkGLcall("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); glDisable(GL_FRAGMENT_SHADER_ATI);
checkGLcall("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) static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)

View File

@ -1649,11 +1649,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
{ {
GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT)); GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT));
} }
device->frag_pipe->enable_extension(TRUE);
LEAVE_GL(); LEAVE_GL();
device->frag_pipe->enable_extension(TRUE);
TRACE("Created context %p.\n", ret); TRACE("Created context %p.\n", ret);
return 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); Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPING), StateTable);
set_blit_dimension(width, height); set_blit_dimension(width, height);
device->frag_pipe->enable_extension(FALSE);
LEAVE_GL(); LEAVE_GL();
context->blit_w = width; context->blit_h = height; context->blit_w = width; context->blit_h = height;
Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable); Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable);
Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable); Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable);
device->frag_pipe->enable_extension(FALSE);
} }
/* Do not call while under the GL lock. */ /* 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(); LEAVE_GL();
} }
ENTER_GL();
if (context->last_was_blit) if (context->last_was_blit)
{ {
device->frag_pipe->enable_extension(TRUE); 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 /* Blending and clearing should be orthogonal, but tests on the nvidia
* driver show that disabling blending when clearing improves the clearing * driver show that disabling blending when clearing improves the clearing
* performance incredibly. */ * performance incredibly. */
ENTER_GL();
glDisable(GL_BLEND); glDisable(GL_BLEND);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
checkGLcall("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(); LEAVE_GL();
} }
ENTER_GL();
if (context->last_was_blit) if (context->last_was_blit)
{ {
device->frag_pipe->enable_extension(TRUE); device->frag_pipe->enable_extension(TRUE);
} }
ENTER_GL();
for (i = 0; i < context->numDirtyEntries; ++i) for (i = 0; i < context->numDirtyEntries; ++i)
{ {
DWORD rep = context->dirtyArray[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 != current_context)
{ {
if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); if (!context_set_current(context))
else device->frag_pipe->enable_extension(!context->last_was_blit); {
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) if (context->vshader_const_dirty)
{ {

View File

@ -623,10 +623,9 @@ static void nvrc_texfactor(DWORD state, struct wined3d_stateblock *stateblock, s
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void nvrc_enable(BOOL enable) {} 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) static void nvts_enable(BOOL enable)
{ {
ENTER_GL();
if(enable) { if(enable) {
glEnable(GL_TEXTURE_SHADER_NV); glEnable(GL_TEXTURE_SHADER_NV);
checkGLcall("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); glDisable(GL_TEXTURE_SHADER_NV);
checkGLcall("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) static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)

View File

@ -5578,7 +5578,7 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, {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_enable(BOOL enable) {}
static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)