[Mesa-dev] [PATCH 4/4] gallium: Enable ARB_clip_control for gallium drivers.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Tue Oct 21 22:31:35 PDT 2014


From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>

Gallium should be prepared fine for ARB_clip_control.
So enable this and mention it in the release notes.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
---
 docs/GL3.txt                                |  2 +-
 docs/relnotes/10.4.html                     |  1 +
 src/mesa/state_tracker/st_atom_rasterizer.c | 14 +++++++++++++-
 src/mesa/state_tracker/st_extensions.c      |  1 +
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 07d1d2c..2fe0da1 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40:
 GL 4.5, GLSL 4.50:
 
   GL_ARB_ES3_1_compatibility                           not started
-  GL_ARB_clip_control                                  not started
+  GL_ARB_clip_control                                  DONE (gallium drivers)
   GL_ARB_conditional_render_inverted                   DONE (i965, nvc0, llvmpipe, softpipe)
   GL_ARB_cull_distance                                 not started
   GL_ARB_derivative_control                            DONE (i965, nv50, nvc0, r600)
diff --git a/docs/relnotes/10.4.html b/docs/relnotes/10.4.html
index 64cbfae..462eeb5 100644
--- a/docs/relnotes/10.4.html
+++ b/docs/relnotes/10.4.html
@@ -46,6 +46,7 @@ Note: some of the new features are only available with certain drivers.
 <ul>
 <li>GL_ARB_sample_shading on r600</li>
 <li>GL_ARB_texture_view on nv50, nvc0</li>
+<li>GL_ARB_clip_control on gallium drivers</li>
 </ul>
 
 
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index a228538..050160d 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -71,6 +71,11 @@ static void update_raster_state( struct st_context *st )
    {
       raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW);
 
+      /* _NEW_VIEWPORT */
+      if (ctx->ClipControl.Origin == GL_UPPER_LEFT) {
+         raster->front_ccw ^= 1;
+      }
+
       /*
        * Gallium's surfaces are Y=0=TOP orientation.  OpenGL is the
        * opposite.  Window system surfaces are Y=0=TOP.  Mesa's FBOs
@@ -234,6 +239,12 @@ static void update_raster_state( struct st_context *st )
    raster->half_pixel_center = 1;
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
       raster->bottom_edge_rule = 1;
+   /* _NEW_VIEWPORT */
+   if (ctx->ClipControl.Origin == GL_UPPER_LEFT)
+      raster->bottom_edge_rule ^= 1;
+
+   /* _NEW_VIEWPORT */
+   raster->clip_halfz = (ctx->ClipControl.Depth == GL_ZERO_TO_ONE);
 
    /* ST_NEW_RASTERIZER */
    raster->rasterizer_discard = ctx->RasterDiscard;
@@ -265,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = {
        _NEW_PROGRAM |
        _NEW_SCISSOR |
        _NEW_FRAG_CLAMP |
-       _NEW_TRANSFORM),      /* mesa state dependencies*/
+       _NEW_TRANSFORM |
+       _NEW_VIEWPORT),      /* mesa state dependencies*/
       (ST_NEW_VERTEX_PROGRAM |
        ST_NEW_RASTERIZER),  /* state tracker dependencies */
    },
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 5dd8278..e22347b 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -585,6 +585,7 @@ void st_init_extensions(struct pipe_screen *screen,
     * Extensions that are supported by all Gallium drivers:
     */
    extensions->ARB_ES2_compatibility = GL_TRUE;
+   extensions->ARB_clip_control = GL_TRUE;
    extensions->ARB_draw_elements_base_vertex = GL_TRUE;
    extensions->ARB_explicit_attrib_location = GL_TRUE;
    extensions->ARB_explicit_uniform_location = GL_TRUE;
-- 
1.9.3



More information about the mesa-dev mailing list