draw/llvm: fix inputs to the geometry shader
authorZack Rusin <zackr@vmware.com>
Wed, 27 Feb 2013 09:28:18 +0000 (01:28 -0800)
committerZack Rusin <zackr@vmware.com>
Wed, 6 Mar 2013 04:13:08 +0000 (20:13 -0800)
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 <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/draw/draw_llvm.c

index 763158b5c93e9e925ee4dfef86d144c3bc33d6c6..f1c1f55a58681144901c5aa3fd87b8dfc1ffd4ff 100644 (file)
@@ -1177,10 +1177,15 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant,
    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;
+   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);