[Mesa-dev] [PATCH] i965: set VIEWPORT_BOUNDS_RANGE value depending of the supported OpenGL version

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Feb 26 07:37:33 UTC 2016


>From ARB_viewport_array spec:

" * On GL3-capable hardware the VIEWPORT_BOUNDS_RANGE should be at least
    [-16384, 16383].
  * On GL4-capable hardware the VIEWPORT_BOUNDS_RANGE should be at least
    [-32768, 32767]."

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
 src/mesa/drivers/dri/i965/brw_context.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 31b6b2a..1569992 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -687,10 +687,15 @@ brw_initialize_context_constants(struct brw_context *brw)
       ctx->Const.MaxViewports = GEN6_NUM_VIEWPORTS;
       ctx->Const.ViewportSubpixelBits = 0;
 
-      /* Cast to float before negating because MaxViewportWidth is unsigned.
-       */
-      ctx->Const.ViewportBounds.Min = -(float)ctx->Const.MaxViewportWidth;
-      ctx->Const.ViewportBounds.Max = ctx->Const.MaxViewportWidth;
+      if (brw->intelScreen->driScrnPriv->max_gl_core_version >= 40) {
+         ctx->Const.ViewportBounds.Min = -32768;
+         ctx->Const.ViewportBounds.Max = 32767;
+      } else {
+         /* Cast to float before negating because MaxViewportWidth is unsigned.
+          */
+         ctx->Const.ViewportBounds.Min = -(float)ctx->Const.MaxViewportWidth;
+         ctx->Const.ViewportBounds.Max = ctx->Const.MaxViewportWidth;
+      }
    }
 
    /* ARB_gpu_shader5 */
-- 
2.7.0



More information about the mesa-dev mailing list