summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r--src/mesa/state_tracker/st_context.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 524e06fb00a..1d26da474e0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -28,6 +28,8 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/extensions.h"
+#include "main/matrix.h"
+#include "main/buffers.h"
#include "vbo/vbo.h"
#include "shader/shader_api.h"
#include "st_public.h"
@@ -163,7 +165,19 @@ 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);
+
+ }
}
else {
_mesa_make_current(NULL, NULL, NULL);