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

wined3d: Don't activate a context unless we need one.

parent c68a20fb
......@@ -4359,8 +4359,6 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)baseShader->baseShader.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
if (shader_is_pshader_version(baseShader->baseShader.reg_maps.shader_version.type))
{
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *) iface;
......@@ -4369,6 +4367,9 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
if(!shader_data) return; /* This can happen if a shader was never compiled */
ENTER_GL();
if(shader_data->num_gl_shaders) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
for(i = 0; i < shader_data->num_gl_shaders; i++) {
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
......@@ -4384,6 +4385,9 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
if(!shader_data) return; /* This can happen if a shader was never compiled */
ENTER_GL();
if(shader_data->num_gl_shaders) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
for(i = 0; i < shader_data->num_gl_shaders; i++) {
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
......
......@@ -4331,8 +4331,6 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
*/
char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type);
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
if(pshader) {
struct glsl_pshader_private *shader_data;
ps = (IWineD3DPixelShaderImpl *) This;
......@@ -4344,6 +4342,8 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
return;
}
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->pshader == iface)
{
ENTER_GL();
......@@ -4361,6 +4361,8 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
return;
}
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->vshader == iface)
{
ENTER_GL();
......
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