summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_context.c14
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c11
2 files changed, 3 insertions, 22 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index c7fa26d592..e87106f86e 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -59,6 +59,7 @@
#include "st_cb_texture.h"
#include "st_cb_flush.h"
#include "st_cb_strings.h"
+#include "st_cb_viewport.h"
#include "st_atom.h"
#include "st_draw.h"
#include "st_extensions.h"
@@ -254,19 +255,8 @@ void st_make_current(struct st_context *st,
struct st_framebuffer *read)
{
if (st) {
- GLboolean firstTime = st->ctx->FirstTimeCurrent;
_mesa_make_current(st->ctx, &draw->Base, &read->Base);
- /* 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);
}
else {
_mesa_make_current(NULL, NULL, NULL);
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 0d9c7b97e3..10847abdc8 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -133,16 +133,7 @@ void st_resize_framebuffer( struct st_framebuffer *stfb,
if (stfb->Base.Width != width || stfb->Base.Height != height) {
GET_CURRENT_CONTEXT(ctx);
if (ctx) {
- if (stfb->InitWidth == 0 && stfb->InitHeight == 0) {
- /* didn't have a valid size until now */
- stfb->InitWidth = width;
- stfb->InitHeight = height;
- if (ctx->Viewport.Width <= 1) {
- /* set context's initial viewport/scissor size */
- _mesa_set_viewport(ctx, 0, 0, width, height);
- _mesa_set_scissor(ctx, 0, 0, width, height);
- }
- }
+ _mesa_check_init_viewport(ctx, width, height);
_mesa_resize_framebuffer(ctx, &stfb->Base, width, height);