gl renderer: More color matrix state tracking
This commit is contained in:
@@ -2585,13 +2585,16 @@ apply_color_matrix_op (const Program *program,
|
||||
const OpColorMatrix *op)
|
||||
{
|
||||
float mat[16];
|
||||
float vec[4];
|
||||
OP_PRINT (" -> Color Matrix");
|
||||
graphene_matrix_to_float (op->matrix, mat);
|
||||
glUniformMatrix4fv (program->color_matrix.color_matrix_location, 1, GL_FALSE, mat);
|
||||
|
||||
graphene_vec4_to_float (op->offset, vec);
|
||||
glUniform4fv (program->color_matrix.color_offset_location, 1, vec);
|
||||
if (op->offset.send)
|
||||
{
|
||||
float vec[4];
|
||||
graphene_vec4_to_float (op->offset.value, vec);
|
||||
glUniform4fv (program->color_matrix.color_offset_location, 1, vec);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
||||
@@ -618,21 +618,32 @@ ops_set_color_matrix (RenderOpBuilder *builder,
|
||||
{
|
||||
ProgramState *current_program_state = get_current_program_state (builder);
|
||||
OpColorMatrix *op;
|
||||
bool offset_equal;
|
||||
|
||||
offset_equal = memcmp (offset,
|
||||
¤t_program_state->color_matrix.offset,
|
||||
sizeof (graphene_vec4_t)) == 0;
|
||||
|
||||
if (memcmp (matrix,
|
||||
¤t_program_state->color_matrix.matrix,
|
||||
sizeof (graphene_matrix_t)) == 0 &&
|
||||
memcmp (offset,
|
||||
¤t_program_state->color_matrix.offset,
|
||||
sizeof (graphene_vec4_t)) == 0)
|
||||
offset_equal)
|
||||
return;
|
||||
|
||||
current_program_state->color_matrix.matrix = *matrix;
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
|
||||
op = ops_begin (builder, OP_CHANGE_COLOR_MATRIX);
|
||||
op->matrix = matrix;
|
||||
op->offset = offset;
|
||||
|
||||
if (!offset_equal)
|
||||
{
|
||||
op->offset.value = offset;
|
||||
op->offset.send = TRUE;
|
||||
|
||||
current_program_state->color_matrix.offset = *offset;
|
||||
}
|
||||
else
|
||||
op->offset.send = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -46,6 +46,7 @@ typedef struct { float value; guint send: 1; } FloatUniformValue;
|
||||
typedef struct { float value[2]; guint send: 1; } Float2UniformValue;
|
||||
typedef struct { GskRoundedRect value; guint send: 1; guint send_corners: 1; } RRUniformValue;
|
||||
typedef struct { const GdkRGBA *value; guint send: 1; } RGBAUniformValue;
|
||||
typedef struct { const graphene_vec4_t *value; guint send: 1; } Vec4UniformValue;
|
||||
|
||||
/* OpNode are allocated within OpBuffer.pos, but we keep
|
||||
* a secondary index into the locations of that buffer
|
||||
@@ -137,7 +138,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
const graphene_matrix_t *matrix;
|
||||
const graphene_vec4_t *offset;
|
||||
Vec4UniformValue offset;
|
||||
} OpColorMatrix;
|
||||
|
||||
typedef struct
|
||||
|
||||
Reference in New Issue
Block a user