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
static void shader_arb_destroy(struct wined3d_shader *shader)
{
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;
/* This can happen if a shader was never compiled */
if (!shader->backend_data)
return;
context = context_acquire(device, NULL, 0);
gl_info = context->gl_info;
if (shader_is_pshader_version(shader->reg_maps.shader_version.type))
{
struct arb_pshader_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)
{
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))");
}
context_release(context);
}
for (i = 0; i < shader_data->num_gl_shaders; ++i)
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
heap_free(shader_data->gl_shaders);
heap_free(shader_data);
shader->backend_data = NULL;
}
else
{
struct arb_vshader_private *shader_data = shader->backend_data;
UINT i;
if(!shader_data) return; /* This can happen if a shader was never compiled */
for (i = 0; i < shader_data->num_gl_shaders; ++i)
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
if (shader_data->num_gl_shaders)
{
struct wined3d_context *context = context_acquire(device, NULL, 0);
heap_free(shader_data->gl_shaders);
}
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))");
}
checkGLcall("delete programs");
context_release(context);
}
context_release(context);
heap_free(shader_data->gl_shaders);
heap_free(shader_data);
shader->backend_data = NULL;
}
heap_free(shader->backend_data);
shader->backend_data = NULL;
}
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