We can't clip and viewport transform the vertices before we let
the geometry shader process them. Lets make sure the generated
vertex shader has both disabled if geometry shader is present.

Signed-off-by: Zack Rusin <za...@vmware.com>
---
 src/gallium/auxiliary/draw/draw_llvm.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
b/src/gallium/auxiliary/draw/draw_llvm.c
index 8e46687..ff38a11 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1176,11 +1176,16 @@ draw_llvm_generate(struct draw_llvm *llvm, struct 
draw_llvm_variant *variant,
    LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][TGSI_NUM_CHANNELS];
    LLVMValueRef fetch_max;
    struct lp_build_sampler_soa *sampler = 0;
-   LLVMValueRef ret, clipmask_bool_ptr;
-   const boolean bypass_viewport = variant->key.bypass_viewport;
-   const boolean enable_cliptest = variant->key.clip_xy || 
-                                   variant->key.clip_z  ||
-                                   variant->key.clip_user;
+   LLVMValueRef ret, clipmask_bool_ptr;   
+   const struct draw_geometry_shader *gs = draw->gs.geometry_shader;
+   /* If geometry shader is present we need to skip both the viewport
+    * transformation and clipping otherwise the inputs to the geometry
+    * shader will be incorrect.
+    */
+   const boolean bypass_viewport = gs || variant->key.bypass_viewport;
+   const boolean enable_cliptest = !gs && (variant->key.clip_xy || 
+                                           variant->key.clip_z  ||
+                                           variant->key.clip_user);
    LLVMValueRef variant_func;
    const unsigned pos = draw_current_shader_position_output(llvm->draw);
    const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
-- 
1.7.10.4
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to