mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
cogl-gst: Don't replace previous layers in default shader
Previously, when CoglGST generated the default sampling snippet it would set the replace string so that Cogl wouldn't generate any redundant code for the other layers. However this also meant that it wouldn't modulate with the default colour. This patch changes it to set the combine mode on all of the layers to REPLACE(PREVIOUS) so that it just copies the previous layer without generating any texture sampling. That way the fragment snippet for the final layer can just modulate the previous value with the video sampling function. This makes it possible to set a color on the pipeline and have it modulate the video. Also if we eventually add a way to insert layers before the GST sampling layer then it can modulate with those. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit f5da8d2caf4b2fbaf6941642a5d5ea7b93d0dd0f)
This commit is contained in:
parent
e85a681788
commit
4eb9987699
@ -78,4 +78,4 @@ _cogl_gst_shader_ayuv_to_rgba_decl[] =
|
||||
|
||||
const char
|
||||
_cogl_gst_shader_default_sample[] =
|
||||
" cogl_layer = cogl_gst_sample_video (cogl_tex_coord0_in.st);\n";
|
||||
" cogl_layer *= cogl_gst_sample_video (cogl_tex_coord0_in.st);\n";
|
||||
|
@ -226,6 +226,7 @@ create_template_pipeline (CoglGstVideoSink *sink,
|
||||
if (decl)
|
||||
{
|
||||
static CoglSnippet *default_sample_snippet = NULL;
|
||||
int i;
|
||||
|
||||
/* The global sampling function gets added to both the fragment
|
||||
* and vertex stages. The hope is that the GLSL compiler will
|
||||
@ -246,16 +247,21 @@ create_template_pipeline (CoglGstVideoSink *sink,
|
||||
cogl_pipeline_add_snippet (priv->pipeline,
|
||||
snippet_cache->fragment_snippet);
|
||||
|
||||
/* Set the replace string for the last layer so that no
|
||||
* redundant code for the previous layers will be generated. The
|
||||
* application can also replace this default sampling by adding
|
||||
* another layer */
|
||||
/* Set all of the layers to just directly copy from the previous
|
||||
* layer so that it won't redundantly generate code to sample
|
||||
* the intermediate textures */
|
||||
for (i = 0; i < n_layers; i++)
|
||||
cogl_pipeline_set_layer_combine (priv->pipeline,
|
||||
i,
|
||||
"RGBA=REPLACE(PREVIOUS)",
|
||||
NULL);
|
||||
|
||||
if (default_sample_snippet == NULL)
|
||||
{
|
||||
default_sample_snippet =
|
||||
cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT, NULL, NULL);
|
||||
cogl_snippet_set_replace (default_sample_snippet,
|
||||
_cogl_gst_shader_default_sample);
|
||||
cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT,
|
||||
NULL, /* declarations */
|
||||
_cogl_gst_shader_default_sample);
|
||||
}
|
||||
cogl_pipeline_add_layer_snippet (priv->pipeline,
|
||||
n_layers - 1,
|
||||
|
Loading…
Reference in New Issue
Block a user