clutter/blur: Remove uniform locations from BlurPass

They're not used anywhere except when setting up the pipeline, so
make them local variables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1646>
This commit is contained in:
Georges Basile Stavracas Neto 2020-12-17 00:35:49 -03:00 committed by Marge Bot
parent 261447a498
commit 8588352d1d

View File

@ -123,9 +123,6 @@ typedef struct
CoglPipeline *pipeline; CoglPipeline *pipeline;
CoglTexture *texture; CoglTexture *texture;
int orientation; int orientation;
int sigma_uniform;
int pixel_step_uniform;
int vertical_uniform;
} BlurPass; } BlurPass;
struct _ClutterBlur struct _ClutterBlur
@ -180,10 +177,13 @@ update_blur_uniforms (ClutterBlur *blur,
BlurPass *pass) BlurPass *pass)
{ {
gboolean vertical = pass->orientation == VERTICAL; gboolean vertical = pass->orientation == VERTICAL;
int sigma_uniform;
int pixel_step_uniform;
int vertical_uniform;
pass->pixel_step_uniform = pixel_step_uniform =
cogl_pipeline_get_uniform_location (pass->pipeline, "pixel_step"); cogl_pipeline_get_uniform_location (pass->pipeline, "pixel_step");
if (pass->pixel_step_uniform > -1) if (pixel_step_uniform > -1)
{ {
float pixel_step; float pixel_step;
@ -193,25 +193,24 @@ update_blur_uniforms (ClutterBlur *blur,
pixel_step = 1.f / cogl_texture_get_width (pass->texture); pixel_step = 1.f / cogl_texture_get_width (pass->texture);
cogl_pipeline_set_uniform_1f (pass->pipeline, cogl_pipeline_set_uniform_1f (pass->pipeline,
pass->pixel_step_uniform, pixel_step_uniform,
pixel_step); pixel_step);
} }
pass->sigma_uniform = sigma_uniform = cogl_pipeline_get_uniform_location (pass->pipeline, "sigma");
cogl_pipeline_get_uniform_location (pass->pipeline, "sigma"); if (sigma_uniform > -1)
if (pass->sigma_uniform > -1)
{ {
cogl_pipeline_set_uniform_1f (pass->pipeline, cogl_pipeline_set_uniform_1f (pass->pipeline,
pass->sigma_uniform, sigma_uniform,
blur->sigma / blur->downscale_factor); blur->sigma / blur->downscale_factor);
} }
pass->vertical_uniform = vertical_uniform =
cogl_pipeline_get_uniform_location (pass->pipeline, "vertical"); cogl_pipeline_get_uniform_location (pass->pipeline, "vertical");
if (pass->vertical_uniform > -1) if (vertical_uniform > -1)
{ {
cogl_pipeline_set_uniform_1i (pass->pipeline, cogl_pipeline_set_uniform_1i (pass->pipeline,
pass->vertical_uniform, vertical_uniform,
vertical); vertical);
} }
} }