summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-06-17 11:27:55 -0600
committerBrian Paul <brianp@vmware.com>2009-06-17 11:30:30 -0600
commitb7adc92576e9efa05517d19112d5a7add7413500 (patch)
treef22a87edb446b0c367f8075d5255eb8660fccac3
parent1b1acf6fa8189867a15416a098fe70e05913a48b (diff)
downloadmesa-gallium-mesa-7.4.tar.gz
st/mesa: rework viewport/scissor initialization codegallium-mesa-7.4
This is a hand-pick of some of the new viewport code committed to mesa_7_5_branch. See commit 3f856c6b6b7fa95ef97a8712876de88d7d57932e for reference. This is just the state_tracker part. The core Mesa part came from merging in mesa_7_4_branch.
-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 c7fa26d592d..e87106f86e9 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 0d9c7b97e3d..10847abdc81 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);