mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
cogl: Use graphene APIs
These are the easy, trivial ones. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
parent
9e1004da0c
commit
182b51774e
@ -193,9 +193,7 @@ _cogl_clip_stack_push_rectangle (CoglClipStack *stack,
|
|||||||
cogl_matrix_entry_get (modelview_entry, &modelview);
|
cogl_matrix_entry_get (modelview_entry, &modelview);
|
||||||
cogl_matrix_entry_get (projection_entry, &projection);
|
cogl_matrix_entry_get (projection_entry, &projection);
|
||||||
|
|
||||||
cogl_matrix_multiply (&modelview_projection,
|
graphene_matrix_multiply (&modelview, &projection, &modelview_projection);
|
||||||
&projection,
|
|
||||||
&modelview);
|
|
||||||
|
|
||||||
/* Technically we could avoid the viewport transform at this point
|
/* Technically we could avoid the viewport transform at this point
|
||||||
* if we want to make this a bit faster. */
|
* if we want to make this a bit faster. */
|
||||||
|
@ -221,9 +221,9 @@ cogl_context_new (CoglDisplay *display,
|
|||||||
|
|
||||||
context->legacy_backface_culling_enabled = FALSE;
|
context->legacy_backface_culling_enabled = FALSE;
|
||||||
|
|
||||||
cogl_matrix_init_identity (&context->identity_matrix);
|
graphene_matrix_init_identity (&context->identity_matrix);
|
||||||
cogl_matrix_init_identity (&context->y_flip_matrix);
|
graphene_matrix_init_identity (&context->y_flip_matrix);
|
||||||
cogl_matrix_scale (&context->y_flip_matrix, 1, -1, 1);
|
graphene_matrix_scale (&context->y_flip_matrix, 1, -1, 1);
|
||||||
|
|
||||||
context->opaque_color_pipeline = cogl_pipeline_new (context);
|
context->opaque_color_pipeline = cogl_pipeline_new (context);
|
||||||
|
|
||||||
|
@ -1585,8 +1585,7 @@ cogl_framebuffer_orthographic (CoglFramebuffer *framebuffer,
|
|||||||
* so we need to flush all journaled primitives first... */
|
* so we need to flush all journaled primitives first... */
|
||||||
_cogl_framebuffer_flush_journal (framebuffer);
|
_cogl_framebuffer_flush_journal (framebuffer);
|
||||||
|
|
||||||
cogl_matrix_init_identity (&ortho);
|
graphene_matrix_init_ortho (&ortho, x_1, x_2, y_2, y_1, near, far);
|
||||||
cogl_matrix_orthographic (&ortho, x_1, y_1, x_2, y_2, near, far);
|
|
||||||
cogl_matrix_stack_set (projection_stack, &ortho);
|
cogl_matrix_stack_set (projection_stack, &ortho);
|
||||||
|
|
||||||
if (framebuffer->context->current_draw_buffer == framebuffer)
|
if (framebuffer->context->current_draw_buffer == framebuffer)
|
||||||
|
@ -789,7 +789,7 @@ _cogl_pipeline_layer_user_matrix_equal (CoglPipelineLayer *authority0,
|
|||||||
CoglPipelineLayerBigState *big_state0 = authority0->big_state;
|
CoglPipelineLayerBigState *big_state0 = authority0->big_state;
|
||||||
CoglPipelineLayerBigState *big_state1 = authority1->big_state;
|
CoglPipelineLayerBigState *big_state1 = authority1->big_state;
|
||||||
|
|
||||||
if (!cogl_matrix_equal (&big_state0->matrix, &big_state1->matrix))
|
if (!graphene_matrix_equal (&big_state0->matrix, &big_state1->matrix))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1164,7 +1164,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
|
|||||||
* state we want to change */
|
* state we want to change */
|
||||||
authority = _cogl_pipeline_layer_get_authority (layer, state);
|
authority = _cogl_pipeline_layer_get_authority (layer, state);
|
||||||
|
|
||||||
if (cogl_matrix_equal (matrix, &authority->big_state->matrix))
|
if (graphene_matrix_equal (matrix, &authority->big_state->matrix))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, state);
|
new = _cogl_pipeline_layer_pre_change_notify (pipeline, layer, state);
|
||||||
@ -1183,7 +1183,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
|
|||||||
CoglPipelineLayer *old_authority =
|
CoglPipelineLayer *old_authority =
|
||||||
_cogl_pipeline_layer_get_authority (parent, state);
|
_cogl_pipeline_layer_get_authority (parent, state);
|
||||||
|
|
||||||
if (cogl_matrix_equal (matrix, &old_authority->big_state->matrix))
|
if (graphene_matrix_equal (matrix, &old_authority->big_state->matrix))
|
||||||
{
|
{
|
||||||
layer->differences &= ~state;
|
layer->differences &= ~state;
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ _cogl_pipeline_init_default_layers (void)
|
|||||||
|
|
||||||
big_state->point_sprite_coords = FALSE;
|
big_state->point_sprite_coords = FALSE;
|
||||||
|
|
||||||
cogl_matrix_init_identity (&big_state->matrix);
|
graphene_matrix_init_identity (&big_state->matrix);
|
||||||
|
|
||||||
ctx->default_layer_0 = _cogl_pipeline_layer_object_new (layer);
|
ctx->default_layer_0 = _cogl_pipeline_layer_object_new (layer);
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
|
|||||||
* If @transpose is %FALSE then the matrix is expected to be in
|
* If @transpose is %FALSE then the matrix is expected to be in
|
||||||
* column-major order or if it is %TRUE then the matrix is in
|
* column-major order or if it is %TRUE then the matrix is in
|
||||||
* row-major order. You can pass a #graphene_matrix_t by calling by passing
|
* row-major order. You can pass a #graphene_matrix_t by calling by passing
|
||||||
* the result of cogl_matrix_to_float() in @value and setting
|
* the result of graphene_matrix_to_float() in @value and setting
|
||||||
* @transpose to %FALSE.
|
* @transpose to %FALSE.
|
||||||
*
|
*
|
||||||
* Since: 2.0
|
* Since: 2.0
|
||||||
|
@ -137,6 +137,7 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
|||||||
int num_rectangles = cairo_region_num_rectangles (region);
|
int num_rectangles = cairo_region_num_rectangles (region);
|
||||||
int i;
|
int i;
|
||||||
CoglVertexP2 *vertices;
|
CoglVertexP2 *vertices;
|
||||||
|
graphene_point3d_t p;
|
||||||
|
|
||||||
/* NB: This can be called while flushing the journal so we need
|
/* NB: This can be called while flushing the journal so we need
|
||||||
* to be very conservative with what state we change.
|
* to be very conservative with what state we change.
|
||||||
@ -151,17 +152,18 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
|
|||||||
* make a matrix that translates those across the viewport, and into
|
* make a matrix that translates those across the viewport, and into
|
||||||
* the default [-1, -1, 1, 1] range.
|
* the default [-1, -1, 1, 1] range.
|
||||||
*/
|
*/
|
||||||
cogl_matrix_init_identity (&matrix);
|
graphene_point3d_init (&p,
|
||||||
cogl_matrix_translate (&matrix, -1, 1, 0);
|
|
||||||
cogl_matrix_scale (&matrix,
|
|
||||||
2.0 / framebuffer->viewport_width,
|
|
||||||
- 2.0 / framebuffer->viewport_height,
|
|
||||||
1);
|
|
||||||
cogl_matrix_translate (&matrix,
|
|
||||||
- framebuffer->viewport_x,
|
- framebuffer->viewport_x,
|
||||||
- framebuffer->viewport_y,
|
- framebuffer->viewport_y,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
graphene_matrix_init_translate (&matrix, &p);
|
||||||
|
graphene_matrix_scale (&matrix,
|
||||||
|
2.0 / framebuffer->viewport_width,
|
||||||
|
- 2.0 / framebuffer->viewport_height,
|
||||||
|
1);
|
||||||
|
graphene_matrix_translate (&matrix, &GRAPHENE_POINT3D_INIT (-1.f, 1.f, 0.f));
|
||||||
|
|
||||||
GE( ctx, glColorMask (FALSE, FALSE, FALSE, FALSE) );
|
GE( ctx, glColorMask (FALSE, FALSE, FALSE, FALSE) );
|
||||||
GE( ctx, glDepthMask (FALSE) );
|
GE( ctx, glDepthMask (FALSE) );
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ update_constants_cb (CoglPipeline *pipeline,
|
|||||||
float array[16];
|
float array[16];
|
||||||
|
|
||||||
matrix = _cogl_pipeline_get_layer_matrix (pipeline, layer_index);
|
matrix = _cogl_pipeline_get_layer_matrix (pipeline, layer_index);
|
||||||
cogl_matrix_to_float (matrix, array);
|
graphene_matrix_to_float (matrix, array);
|
||||||
GE (ctx, glUniformMatrix4fv (unit_state->texture_matrix_uniform,
|
GE (ctx, glUniformMatrix4fv (unit_state->texture_matrix_uniform,
|
||||||
1, FALSE, array));
|
1, FALSE, array));
|
||||||
unit_state->dirty_texture_matrix = FALSE;
|
unit_state->dirty_texture_matrix = FALSE;
|
||||||
@ -1053,9 +1053,9 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline,
|
|||||||
{
|
{
|
||||||
graphene_matrix_t tmp_matrix;
|
graphene_matrix_t tmp_matrix;
|
||||||
cogl_matrix_entry_get (projection_entry, &tmp_matrix);
|
cogl_matrix_entry_get (projection_entry, &tmp_matrix);
|
||||||
cogl_matrix_multiply (&projection,
|
graphene_matrix_multiply (&tmp_matrix,
|
||||||
&ctx->y_flip_matrix,
|
&ctx->y_flip_matrix,
|
||||||
&tmp_matrix);
|
&projection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cogl_matrix_entry_get (projection_entry, &projection);
|
cogl_matrix_entry_get (projection_entry, &projection);
|
||||||
@ -1063,7 +1063,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline,
|
|||||||
|
|
||||||
if (projection_changed && program_state->projection_uniform != -1)
|
if (projection_changed && program_state->projection_uniform != -1)
|
||||||
{
|
{
|
||||||
cogl_matrix_to_float (&projection, v);
|
graphene_matrix_to_float (&projection, v);
|
||||||
GE (ctx, glUniformMatrix4fv (program_state->projection_uniform,
|
GE (ctx, glUniformMatrix4fv (program_state->projection_uniform,
|
||||||
1, /* count */
|
1, /* count */
|
||||||
FALSE, /* transpose */
|
FALSE, /* transpose */
|
||||||
@ -1072,7 +1072,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline,
|
|||||||
|
|
||||||
if (modelview_changed && program_state->modelview_uniform != -1)
|
if (modelview_changed && program_state->modelview_uniform != -1)
|
||||||
{
|
{
|
||||||
cogl_matrix_to_float (&modelview,v);
|
graphene_matrix_to_float (&modelview,v);
|
||||||
GE (ctx, glUniformMatrix4fv (program_state->modelview_uniform,
|
GE (ctx, glUniformMatrix4fv (program_state->modelview_uniform,
|
||||||
1, /* count */
|
1, /* count */
|
||||||
FALSE, /* transpose */
|
FALSE, /* transpose */
|
||||||
@ -1086,7 +1086,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline,
|
|||||||
avoiding the matrix multiplication */
|
avoiding the matrix multiplication */
|
||||||
if (cogl_matrix_entry_is_identity (modelview_entry))
|
if (cogl_matrix_entry_is_identity (modelview_entry))
|
||||||
{
|
{
|
||||||
cogl_matrix_to_float (&projection, v);
|
graphene_matrix_to_float (&projection, v);
|
||||||
GE (ctx,
|
GE (ctx,
|
||||||
glUniformMatrix4fv (program_state->mvp_uniform,
|
glUniformMatrix4fv (program_state->mvp_uniform,
|
||||||
1, /* count */
|
1, /* count */
|
||||||
@ -1097,10 +1097,8 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline,
|
|||||||
{
|
{
|
||||||
graphene_matrix_t combined;
|
graphene_matrix_t combined;
|
||||||
|
|
||||||
cogl_matrix_multiply (&combined,
|
graphene_matrix_multiply (&modelview, &projection, &combined);
|
||||||
&projection,
|
graphene_matrix_to_float (&combined, v);
|
||||||
&modelview);
|
|
||||||
cogl_matrix_to_float (&combined, v);
|
|
||||||
|
|
||||||
GE (ctx,
|
GE (ctx,
|
||||||
glUniformMatrix4fv (program_state->mvp_uniform,
|
glUniformMatrix4fv (program_state->mvp_uniform,
|
||||||
|
Loading…
Reference in New Issue
Block a user