diff options
author | Robert Bragg <robert@linux.intel.com> | 2011-09-08 23:08:43 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2011-09-09 14:40:48 +0100 |
commit | b6cea6bed6e51e59322e9f9398c9d1810a147563 (patch) | |
tree | df350d78aa699f2132b0982fc50b4dc876b31299 | |
parent | 5888e0c65f336d417d025374b7212d2d125feeab (diff) | |
download | cogl-b6cea6bed6e51e59322e9f9398c9d1810a147563.tar.gz |
arbfp: track which layers have combine constants
We weren't actually tracking which layers have been allocated param
space for combine constants; all layers just had a default constant_id
of 0 that indexes into the program.local[] params array and a dirty flag
to say when the constant needs updating. There are times though when we
say to update everything by-passing the dirty flag and because we
weren't actually tracking which layers needed constants we would always
write a constant to program.local[0] for every layer. The upshot was
that we could end up clobbering a real constant that was actually
allocated the constant_id = 0 slot.
This patch adds a new UnitState bitfield to track if the layer has a
corresponding constant that may need flushing and we only ever write the
constant with glProgramLocalParameter4fv if that's set.
https://bugzilla.gnome.org/show_bug.cgi?id=658092
Reviewed-by: Neil Roberts <neil@linux.intel.com>
-rw-r--r-- | cogl/cogl-pipeline-fragend-arbfp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cogl/cogl-pipeline-fragend-arbfp.c b/cogl/cogl-pipeline-fragend-arbfp.c index f02aec29..813bf144 100644 --- a/cogl/cogl-pipeline-fragend-arbfp.c +++ b/cogl/cogl-pipeline-fragend-arbfp.c @@ -61,6 +61,7 @@ typedef struct _UnitState { int constant_id; /* The program.local[] index */ unsigned int dirty_combine_constant:1; + unsigned int has_combine_constant:1; unsigned int sampled:1; } UnitState; @@ -404,6 +405,7 @@ setup_arg (CoglPipeline *pipeline, UnitState *unit_state = &shader_state->unit_state[unit_index]; unit_state->constant_id = shader_state->next_constant_id++; + unit_state->has_combine_constant = TRUE; unit_state->dirty_combine_constant = TRUE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT; @@ -786,7 +788,8 @@ update_constants_cb (CoglPipeline *pipeline, _COGL_GET_CONTEXT (ctx, FALSE); - if (state->update_all || unit_state->dirty_combine_constant) + if (unit_state->has_combine_constant && + (state->update_all || unit_state->dirty_combine_constant)) { float constant[4]; _cogl_pipeline_get_layer_combine_constant (pipeline, |