summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-06-17 08:35:55 -0600
committerBrian Paul <brianp@vmware.com>2009-06-17 08:38:38 -0600
commit3f856c6b6b7fa95ef97a8712876de88d7d57932e (patch)
tree7526ac71fb959936334a1dbb63c6fc5755fcc98a /src/mesa/state_tracker/st_context.c
parentd18c57aaeac37cde0cb551191ecd3c3a56a0ffba (diff)
mesa: rework viewport/scissor initialization code
The first time a context is bound to a drawable, the viewport and scissor bounds are initialized to the buffer's size. This is actually a bit tricky. A new _mesa_check_init_viewport() function is called in several places to check if the viewport has been initialized. We also use a new ctx->ViewportInitialized flag instead of the overloaded ctx->FirstTimeCurrent flag.
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r--src/mesa/state_tracker/st_context.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 92ddffc014..8514b6b375 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -274,20 +274,11 @@ st_make_current(struct st_context *st,
_glapi_check_multithread();
if (st) {
- GLboolean firstTime = st->ctx->FirstTimeCurrent;
- if(!_mesa_make_current(st->ctx, &draw->Base, &read->Base))
+ if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base))
return GL_FALSE;
- /* Need to initialize viewport here since draw->Base->Width/Height
- * will still be zero at this point.
- * This could be improved, but would require rather extensive work
- * elsewhere (allocate rb surface storage sooner)
- */
- if (firstTime) {
- GLuint w = draw->InitWidth, h = draw->InitHeight;
- _mesa_set_viewport(st->ctx, 0, 0, w, h);
- _mesa_set_scissor(st->ctx, 0, 0, w, h);
- }
+ _mesa_check_init_viewport(st->ctx, draw->InitWidth, draw->InitHeight);
+
return GL_TRUE;
}
else {