[Mesa-dev] [PATCH] llvmpipe: fix fogcoord writing

Dave Airlie airlied at gmail.com
Sat Feb 4 10:01:50 PST 2012


From: Dave Airlie <airlied at redhat.com>

this fixes the fogcoord related piglit tests, like I fixed them in softpipe.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/draw/draw_llvm.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index e71c802..221aa17 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -475,6 +475,8 @@ generate_vs(struct draw_llvm *llvm,
    struct lp_type vs_type;
    LLVMValueRef consts_ptr = draw_jit_context_vs_constants(llvm->gallivm, context_ptr);
    struct lp_build_sampler_soa *sampler = 0;
+   unsigned attrib, chan;
+   struct lp_build_context bld;
 
    memset(&vs_type, 0, sizeof vs_type);
    vs_type.floating = TRUE; /* floating point values */
@@ -504,11 +506,20 @@ generate_vs(struct draw_llvm *llvm,
                      outputs,
                      sampler,
                      &llvm->draw->vs.vertex_shader->info);
+   {
+      struct tgsi_shader_info* info = &llvm->draw->vs.vertex_shader->info;
+      lp_build_context_init(&bld, llvm->gallivm, vs_type);
+      for (attrib = 0; attrib < info->num_outputs; ++attrib) {
+         if (info->output_semantic_name[attrib] == TGSI_SEMANTIC_FOG) {
+            LLVMBuildStore(builder, bld.zero, outputs[attrib][1]);
+            LLVMBuildStore(builder, bld.zero, outputs[attrib][2]);
+            LLVMBuildStore(builder, bld.one, outputs[attrib][3]);
+         }
+      }
+   }
 
    if (clamp_vertex_color) {
       LLVMValueRef out;
-      unsigned chan, attrib;
-      struct lp_build_context bld;
       struct tgsi_shader_info* info = &llvm->draw->vs.vertex_shader->info;
       lp_build_context_init(&bld, llvm->gallivm, vs_type);
 
@@ -522,6 +533,12 @@ generate_vs(struct draw_llvm *llvm,
                   out = lp_build_clamp(&bld, out, bld.zero, bld.one);
                   LLVMBuildStore(builder, out, outputs[attrib][chan]);
                   break;
+               case TGSI_SEMANTIC_FOG:
+                  if (chan == 1 || chan == 2)
+                     LLVMBuildStore(builder, bld.zero, outputs[attrib][chan]);
+                  else if (chan == 3)
+                     LLVMBuildStore(builder, bld.one, outputs[attrib][chan]);
+                  break;
                }
             }
          }
-- 
1.7.7.6



More information about the mesa-dev mailing list