mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
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.
This commit is contained in:
parent
80efc5feb0
commit
b93cf55f4e
1 changed files with 11 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue