st/mesa: Enable clip planes lowering for geometry shaders
[mesa.git] / src / mesa / state_tracker / st_atom_shader.c
index e09be71f59c82497631a58f4b732a8473127ec9c..d92a542922e69e174df8ecc5cf778b37acaa8764 100644 (file)
@@ -1,8 +1,8 @@
 /**************************************************************************
- * 
+ *
  * Copyright 2003 VMware, Inc.
  * All Rights Reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * "Software"), to deal in the Software without restriction, including
  * distribute, sub license, and/or sell copies of the Software, and to
  * permit persons to whom the Software is furnished to do so, subject to
  * the following conditions:
- * 
+ *
  * The above copyright notice and this permission notice (including the
  * next paragraph) shall be included in all copies or substantial portions
  * of the Software.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -22,7 +22,7 @@
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
+ *
  **************************************************************************/
 
 /**
@@ -35,7 +35,7 @@
  *   Brian Paul
  */
 
-#include "util/imports.h"
+
 #include "main/mtypes.h"
 #include "main/framebuffer.h"
 #include "main/state.h"
@@ -133,7 +133,7 @@ st_update_fp( struct st_context *st )
       key.lower_two_sided_color = st->lower_two_sided_color &&
          _mesa_vertex_program_two_side_enabled(st->ctx);
 
-      /* _NEW_FRAG_CLAMP */
+      /* gl_driver_flags::NewFragClamp */
       key.clamp_color = st->clamp_frag_color_in_shader &&
                         st->ctx->Color._ClampFragmentColor;
 
@@ -228,7 +228,8 @@ st_update_vp( struct st_context *st )
                              !st_point_size_per_vertex(st->ctx);
 
       /* _NEW_TRANSFORM */
-      if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx))
+      if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx) &&
+          !st->ctx->GeometryProgram._Current)
          key.lower_ucp = st->ctx->Transform.ClipPlanesEnabled;
 
       st->vp_variant = st_get_vp_variant(st, stvp, &key);
@@ -236,7 +237,7 @@ st_update_vp( struct st_context *st )
 
    st_reference_prog(st, &st->vp, stvp);
 
-   cso_set_vertex_shader_handle(st->cso_context, 
+   cso_set_vertex_shader_handle(st->cso_context,
                                 st->vp_variant->base.driver_shader);
 }
 
@@ -285,6 +286,9 @@ st_update_common_program(struct st_context *st, struct gl_program *prog,
          key.clip_negative_one_to_one =
                st->ctx->Transform.ClipDepthMode == GL_NEGATIVE_ONE_TO_ONE;
 
+      if (st->lower_ucp && st_user_clip_planes_enabled(st->ctx) &&
+          pipe_shader == PIPE_SHADER_GEOMETRY)
+         key.lower_ucp = st->ctx->Transform.ClipPlanesEnabled;
    }
 
    return st_get_common_variant(st, stp, &key)->driver_shader;