mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
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>
This commit is contained in:
parent
5888e0c65f
commit
b6cea6bed6
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user