They never get reattached to any other program, so saving them to unreference later is a waste of code.
Signed-off-by: Eric Anholt <e...@anholt.net> --- glamor/glamor_gradient.c | 88 ++++-------------------------------------------- glamor/glamor_priv.h | 9 ----- 2 files changed, 6 insertions(+), 91 deletions(-) diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c index 9460199..9ecaf03 100644 --- a/glamor/glamor_gradient.c +++ b/glamor/glamor_gradient.c @@ -356,20 +356,6 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, glamor_get_context(glamor_priv); if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]) { - glDeleteShader(glamor_priv->radial_gradient_shaders - [SHADER_GRADIENT_VS_PROG][2]); - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][2] = 0; - - glDeleteShader(glamor_priv->radial_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][2]); - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][2] = - 0; - - glDeleteShader(glamor_priv->radial_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][2]); - glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][2] = 0; - glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2]); glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][2] = 0; } @@ -394,6 +380,9 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, glAttachShader(gradient_prog, vs_prog); glAttachShader(gradient_prog, fs_getcolor_prog); glAttachShader(gradient_prog, fs_main_prog); + glDeleteShader(vs_prog); + glDeleteShader(fs_getcolor_prog); + glDeleteShader(fs_main_prog); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); @@ -414,13 +403,6 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count, } glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][index] = gradient_prog; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][index] = - vs_prog; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][index] = - fs_main_prog; - glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][index] = - fs_getcolor_prog; glamor_put_context(glamor_priv); } @@ -588,20 +570,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, glamor_get_context(glamor_priv); if (dyn_gen && glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]) { - glDeleteShader(glamor_priv->linear_gradient_shaders - [SHADER_GRADIENT_VS_PROG][2]); - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][2] = 0; - - glDeleteShader(glamor_priv->linear_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][2]); - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][2] = - 0; - - glDeleteShader(glamor_priv->linear_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][2]); - glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][2] = 0; - glDeleteProgram(glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2]); glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][2] = 0; } @@ -624,6 +592,9 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, glAttachShader(gradient_prog, vs_prog); glAttachShader(gradient_prog, fs_getcolor_prog); glAttachShader(gradient_prog, fs_main_prog); + glDeleteShader(vs_prog); + glDeleteShader(fs_getcolor_prog); + glDeleteShader(fs_main_prog); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position"); glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord"); @@ -644,13 +615,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count, } glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][index] = gradient_prog; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][index] = - vs_prog; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][index] = - fs_main_prog; - glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][index] = - fs_getcolor_prog; glamor_put_context(glamor_priv); } @@ -665,18 +629,7 @@ glamor_init_gradient_shader(ScreenPtr screen) for (i = 0; i < 3; i++) { glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i] = 0; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][i] = 0; - glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i] = - 0; - glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i] = 0; - glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i] = 0; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][i] = 0; - glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i] = - 0; - glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i] = 0; } glamor_priv->linear_max_nstops = 0; glamor_priv->radial_max_nstops = 0; @@ -699,39 +652,10 @@ glamor_fini_gradient_shader(ScreenPtr screen) for (i = 0; i < 3; i++) { /* Linear Gradient */ - if (glamor_priv->linear_gradient_shaders[SHADER_GRADIENT_VS_PROG][i]) - glDeleteShader(glamor_priv->linear_gradient_shaders - [SHADER_GRADIENT_VS_PROG][i]); - - if (glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i]) - glDeleteShader(glamor_priv->linear_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][i]); - - if (glamor_priv-> - linear_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i]) - glDeleteShader(glamor_priv->linear_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][i]); - if (glamor_priv->gradient_prog[SHADER_GRADIENT_LINEAR][i]) glDeleteProgram(glamor_priv->gradient_prog [SHADER_GRADIENT_LINEAR][i]); - /* Radial Gradient */ - if (glamor_priv->radial_gradient_shaders[SHADER_GRADIENT_VS_PROG][i]) - glDeleteShader(glamor_priv->radial_gradient_shaders - [SHADER_GRADIENT_VS_PROG][i]); - - if (glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_MAIN_PROG][i]) - glDeleteShader(glamor_priv->radial_gradient_shaders - [SHADER_GRADIENT_FS_MAIN_PROG][i]); - - if (glamor_priv-> - radial_gradient_shaders[SHADER_GRADIENT_FS_GETCOLOR_PROG][i]) - glDeleteShader(glamor_priv->radial_gradient_shaders - [SHADER_GRADIENT_FS_GETCOLOR_PROG][i]); - if (glamor_priv->gradient_prog[SHADER_GRADIENT_RADIAL][i]) glDeleteProgram(glamor_priv->gradient_prog [SHADER_GRADIENT_RADIAL][i]); diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index e28a021..fe4b423 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -141,13 +141,6 @@ enum gradient_shader { SHADER_GRADIENT_COUNT, }; -enum gradient_shader_prog { - SHADER_GRADIENT_VS_PROG, - SHADER_GRADIENT_FS_MAIN_PROG, - SHADER_GRADIENT_FS_GETCOLOR_PROG, - SHADER_GRADIENT_PROG_COUNT, -}; - struct glamor_screen_private; struct glamor_pixmap_private; @@ -251,9 +244,7 @@ typedef struct glamor_screen_private { /* glamor gradient, 0 for small nstops, 1 for large nstops and 2 for dynamic generate. */ GLint gradient_prog[SHADER_GRADIENT_COUNT][3]; - GLint linear_gradient_shaders[SHADER_GRADIENT_PROG_COUNT][3]; int linear_max_nstops; - GLint radial_gradient_shaders[SHADER_GRADIENT_PROG_COUNT][3]; int radial_max_nstops; /* glamor trapezoid shader. */ -- 1.9.rc1 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel