mirror of
https://github.com/brl/mutter.git
synced 2025-06-24 14:09:25 +00:00
[cogl] cache the viewport width and height
This avoids some calls to glGetFloatv, which have at least proven to be very in-efficient in mesa at this point in time, since it always updates all derived state even when it may not relate to the state being requested.
This commit is contained in:
@ -92,6 +92,9 @@ cogl_create_context ()
|
||||
|
||||
_context->in_begin_gl_block = FALSE;
|
||||
|
||||
_context->viewport_width = 0;
|
||||
_context->viewport_height = 0;
|
||||
|
||||
_context->pf_glGenRenderbuffersEXT = NULL;
|
||||
_context->pf_glBindRenderbufferEXT = NULL;
|
||||
_context->pf_glRenderbufferStorageEXT = NULL;
|
||||
|
@ -112,6 +112,9 @@ typedef struct
|
||||
|
||||
gboolean in_begin_gl_block;
|
||||
|
||||
guint viewport_width;
|
||||
guint viewport_height;
|
||||
|
||||
/* Relying on glext.h to define these */
|
||||
COGL_PFNGLGENRENDERBUFFERSEXTPROC pf_glGenRenderbuffersEXT;
|
||||
COGL_PFNGLDELETERENDERBUFFERSEXTPROC pf_glDeleteRenderbuffersEXT;
|
||||
|
@ -209,7 +209,7 @@ cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
||||
}
|
||||
|
||||
/* Setup new viewport and matrices */
|
||||
GE( glViewport (0, 0, fbo->width, fbo->height) );
|
||||
cogl_viewport (fbo->width, fbo->height);
|
||||
_cogl_current_matrix_translate (-1.0f, -1.0f, 0.0f);
|
||||
_cogl_current_matrix_scale (2.0f / fbo->width, 2.0f / fbo->height, 1.0f);
|
||||
|
||||
|
Reference in New Issue
Block a user