summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_framebuffer.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-02-26 14:26:40 -0700
committerBrian <[email protected]>2008-02-26 14:32:57 -0700
commitb93cf55f4ecd94f5e9d5dda49d9092e3b769d044 (patch)
treeb56fff0aa9647038ccb2b5fc9233c2a728096438 /src/mesa/state_tracker/st_framebuffer.c
parent80efc5feb061a8ed9c1e91ad3711547927fa29e3 (diff)
gallium: fix zero-sized viewport bug
If st_create_framebuffer() is called with width=0, height=0 and the program never called glViewport, the viewport wasn't properly initalized. This fixes that.
Diffstat (limited to 'src/mesa/state_tracker/st_framebuffer.c')
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index bca3fa5c383..47d47daf2a1 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -124,6 +124,17 @@ 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_resize_framebuffer(ctx, &stfb->Base, width, height);
assert(stfb->Base.Width == width);