Mesa (master): mesa/st: hardcode the viewport bounds range

Dave Airlie airlied at kemper.freedesktop.org
Thu Feb 13 02:46:02 UTC 2014


Module: Mesa
Branch: master
Commit: a7012eede83f3a6b014b952ff837e5b377a7a12a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7012eede83f3a6b014b952ff837e5b377a7a12a

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Tue Feb 11 00:26:32 2014 -0500

mesa/st: hardcode the viewport bounds range

The bound range is disconnected from the viewport dimensions. This is
the relevant bit from glViewportArray:

"""
The location of the viewport's bottom left corner, given by (x, y) is
clamped to be within the implementaiton-dependent viewport bounds range.
The viewport bounds range [min, max] can be determined by calling glGet
with argument GL_VIEWPORT_BOUNDS_RANGE. Viewport width and height are
silently clamped to a range that depends on the implementation. To query
this range, call glGet with argument GL_MAX_VIEWPORT_DIMS.
"""

Just set it to +/-16384, as that is the minimum required by
ARB_viewport_array and the value that all current drivers provide.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/state_tracker/st_extensions.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 1b3b220..e43e7b4 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -782,8 +782,8 @@ void st_init_extensions(struct st_context *st)
    if (ctx->API == API_OPENGL_CORE) {
       ctx->Const.MaxViewports = screen->get_param(screen, PIPE_CAP_MAX_VIEWPORTS);
       if (ctx->Const.MaxViewports >= 16) {
-         ctx->Const.ViewportBounds.Min = -(float)ctx->Const.MaxViewportWidth;
-         ctx->Const.ViewportBounds.Max = ctx->Const.MaxViewportWidth;
+         ctx->Const.ViewportBounds.Min = -16384.0;
+         ctx->Const.ViewportBounds.Max = 16384.0;
          ctx->Extensions.ARB_viewport_array = GL_TRUE;
       }
    }




More information about the mesa-commit mailing list