summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2010-11-01 20:33:20 +0000
committerRobert Bragg <robert@linux.intel.com>2010-11-04 18:22:41 +0000
commitb41bf9e67fd09a71600f333947c4b50ae6eeed1e (patch)
tree567828e8513086eacb0918340885b08778a282ef /cogl/cogl-pipeline.c
parente5eff5fc89fb0a789b1130135d3c699b4c78c370 (diff)
downloadcogl-b41bf9e67fd09a71600f333947c4b50ae6eeed1e.tar.gz
pipeline: Avoid costly checking of lighting properties
During _cogl_pipeline_needs_blending_enabled we were always checking the current lighting properties (ambient,diffuse,specular,emission) which had a notable impact during micro-benchmarks that exercise journal throughput of simple colored rectangles. This #if 0's the offending code considering that Cogl doesn't actually support lighting currently and when it actually does then we will be able to optimize this by avoiding the checks when lighting is disabled.
Diffstat (limited to 'cogl/cogl-pipeline.c')
-rw-r--r--cogl/cogl-pipeline.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index bde53f11..ce2c143f 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -864,9 +864,6 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
if (changes & COGL_PIPELINE_STATE_LAYERS)
changes = COGL_PIPELINE_STATE_AFFECTS_BLENDING;
- /* XXX: we don't currently handle specific changes in an optimal way*/
- changes = COGL_PIPELINE_STATE_AFFECTS_BLENDING;
-
if ((override_color && cogl_color_get_alpha_byte (override_color) != 0xff))
return TRUE;
@@ -878,13 +875,13 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
return TRUE;
}
- /* We can't make any assumptions about the alpha channel if the user
- * is using an unknown fragment shader.
- *
- * TODO: check that it isn't just a vertex shader!
- */
if (changes & COGL_PIPELINE_STATE_USER_SHADER)
{
+ /* We can't make any assumptions about the alpha channel if the user
+ * is using an unknown fragment shader.
+ *
+ * TODO: check that it isn't just a vertex shader!
+ */
if (_cogl_pipeline_get_user_program (pipeline) != COGL_INVALID_HANDLE)
return TRUE;
}
@@ -893,8 +890,13 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
*/
if (changes & COGL_PIPELINE_STATE_LIGHTING)
{
+ /* XXX: This stuff is showing up in sysprof reports which is
+ * silly because lighting isn't currently actually supported
+ * by Cogl except for these token properties. When we actually
+ * expose lighting support we can avoid these checks when
+ * lighting is disabled. */
+#if 0
CoglColor tmp;
-
cogl_pipeline_get_ambient (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
@@ -907,6 +909,7 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
cogl_pipeline_get_emission (pipeline, &tmp);
if (cogl_color_get_alpha_byte (&tmp) != 0xff)
return TRUE;
+#endif
}
if (changes & COGL_PIPELINE_STATE_LAYERS)
@@ -921,15 +924,18 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
if (has_alpha)
return TRUE;
}
-
- /* So far we have only checked the property that has been changed so
- * we now need to check all the other properties too. */
- other_state = COGL_PIPELINE_STATE_AFFECTS_BLENDING & ~changes;
- if (other_state &&
- _cogl_pipeline_needs_blending_enabled (pipeline,
- other_state,
- NULL))
- return TRUE;
+ else
+ {
+ /* In this case we have so far only checked the property that
+ * has been changed so we now need to check all the other
+ * properties too. */
+ other_state = COGL_PIPELINE_STATE_AFFECTS_BLENDING & ~changes;
+ if (other_state &&
+ _cogl_pipeline_needs_blending_enabled (pipeline,
+ other_state,
+ NULL))
+ return TRUE;
+ }
return FALSE;
}