Commit 2f917d79 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Simplify shader_arb_destroy().

parent f025570c
...@@ -4733,56 +4733,42 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex ...@@ -4733,56 +4733,42 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex
static void shader_arb_destroy(struct wined3d_shader *shader) static void shader_arb_destroy(struct wined3d_shader *shader)
{ {
struct wined3d_device *device = shader->device; struct wined3d_device *device = shader->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
unsigned int i;
if (shader_is_pshader_version(shader->reg_maps.shader_version.type)) /* This can happen if a shader was never compiled */
{ if (!shader->backend_data)
struct arb_pshader_private *shader_data = shader->backend_data; return;
UINT i;
if(!shader_data) return; /* This can happen if a shader was never compiled */ context = context_acquire(device, NULL, 0);
gl_info = context->gl_info;
if (shader_data->num_gl_shaders) if (shader_is_pshader_version(shader->reg_maps.shader_version.type))
{ {
struct wined3d_context *context = context_acquire(device, NULL, 0); struct arb_pshader_private *shader_data = shader->backend_data;
for (i = 0; i < shader_data->num_gl_shaders; ++i) for (i = 0; i < shader_data->num_gl_shaders; ++i)
{
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
}
context_release(context);
}
heap_free(shader_data->gl_shaders); heap_free(shader_data->gl_shaders);
heap_free(shader_data);
shader->backend_data = NULL;
} }
else else
{ {
struct arb_vshader_private *shader_data = shader->backend_data; struct arb_vshader_private *shader_data = shader->backend_data;
UINT i;
if(!shader_data) return; /* This can happen if a shader was never compiled */
if (shader_data->num_gl_shaders)
{
struct wined3d_context *context = context_acquire(device, NULL, 0);
for (i = 0; i < shader_data->num_gl_shaders; ++i) for (i = 0; i < shader_data->num_gl_shaders; ++i)
{
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
heap_free(shader_data->gl_shaders);
} }
checkGLcall("delete programs");
context_release(context); context_release(context);
}
heap_free(shader_data->gl_shaders); heap_free(shader->backend_data);
heap_free(shader_data);
shader->backend_data = NULL; shader->backend_data = NULL;
}
} }
static int sig_tree_compare(const void *key, const struct wine_rb_entry *entry) static int sig_tree_compare(const void *key, const struct wine_rb_entry *entry)
......
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