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. """ This will allow nouveau to report compliant values for ARB_viewport_array. Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu> --- Another alternative is to just hardcode +/- 16384.0 and let the first person who runs into different limits deal with it. src/gallium/docs/source/screen.rst | 2 ++ src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++ src/gallium/drivers/radeon/r600_pipe_common.c | 2 ++ src/gallium/include/pipe/p_defines.h | 3 ++- src/mesa/state_tracker/st_extensions.c | 5 +++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index bd553f4..c76d422 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -203,6 +203,8 @@ The floating-point capabilities are: ``PIPE_CAPF_GUARD_BAND_TOP``, ``PIPE_CAPF_GUARD_BAND_RIGHT``, ``PIPE_CAPF_GUARD_BAND_BOTTOM``: TODO +* ``PIPE_CAPF_VIEWPORT_BOUNDS_RANGE``: The maximum positive viewport bounds. + The minimum will be set to the negative of this value. .. _pipe_shader_cap: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 43142e7..e8c96ac 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -298,6 +298,8 @@ llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_capf param) case PIPE_CAPF_GUARD_BAND_RIGHT: case PIPE_CAPF_GUARD_BAND_BOTTOM: return 0.0; + case PIPE_CAPF_VIEWPORT_BOUNDS_RANGE: + return 16384.0f; } /* should only get here on unhandled cases */ debug_printf("Unexpected PIPE_CAP %d query\n", param); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 7af8124..807ce9a 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -215,6 +215,8 @@ static float r600_get_paramf(struct pipe_screen* pscreen, case PIPE_CAPF_GUARD_BAND_RIGHT: case PIPE_CAPF_GUARD_BAND_BOTTOM: return 0.0f; + case PIPE_CAPF_VIEWPORT_BOUNDS_RANGE: + return 16384.0f; } return 0.0f; } diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 83815cd..13687d7 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -553,7 +553,8 @@ enum pipe_capf PIPE_CAPF_GUARD_BAND_LEFT = 21, PIPE_CAPF_GUARD_BAND_TOP = 22, PIPE_CAPF_GUARD_BAND_RIGHT = 23, - PIPE_CAPF_GUARD_BAND_BOTTOM = 24 + PIPE_CAPF_GUARD_BAND_BOTTOM = 24, + PIPE_CAPF_VIEWPORT_BOUNDS_RANGE = 25, }; /* Shader caps not specific to any single stage */ diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 1f391c9..e0788e8 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -783,8 +783,9 @@ 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; + float bound = screen->get_paramf(screen, PIPE_CAPF_VIEWPORT_BOUNDS_RANGE); + ctx->Const.ViewportBounds.Min = -bound; + ctx->Const.ViewportBounds.Max = bound; ctx->Extensions.ARB_viewport_array = GL_TRUE; } } -- 1.8.3.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev