Mesa (master): draw/llvm: fix inputs to the geometry shader

Zack Rusin zack at kemper.freedesktop.org
Wed Mar 6 22:17:10 UTC 2013


Module: Mesa
Branch: master
Commit: 2532147f8b28c3a990ad64288ece4b7f8decd237
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2532147f8b28c3a990ad64288ece4b7f8decd237

Author: Zack Rusin <zackr at vmware.com>
Date:   Wed Feb 27 01:28:18 2013 -0800

draw/llvm: fix inputs to the geometry shader

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 at vmware.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/draw/draw_llvm.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 763158b..f1c1f55 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -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);




More information about the mesa-commit mailing list