gallium: pipe/p_inlines.h -> util/u_inlines.h
[mesa.git] / src / gallium / drivers / nv50 / nv50_program.c
index 20db51070ffa8802ea8c8d55a3d1efed1a1cbc91..3653e606ef56c070676b68e996da1bad5d308643 100644 (file)
@@ -23,7 +23,7 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
 
 #include "pipe/p_shader_tokens.h"
 #include "tgsi/tgsi_parse.h"
@@ -3283,7 +3283,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn)
 static unsigned
 nv50_revdep_reorder(unsigned m[4], unsigned rdep[4])
 {
-       unsigned i, c, x, unsafe;
+       unsigned i, c, x, unsafe = 0;
 
        for (c = 0; c < 4; c++)
                m[c] = c;
@@ -3728,13 +3728,21 @@ nv50_program_tx_prep(struct nv50_pc *pc)
                copy_semantic_info(p);
        } else
        if (p->type == PIPE_SHADER_FRAGMENT) {
-               int rid, aid, base;
+               int rid, aid;
                unsigned n = 0, m = pc->attr_nr - flat_nr;
 
                pc->allow32 = TRUE;
 
-               base = (TGSI_SEMANTIC_POSITION ==
-                       p->info.input_semantic_name[0]) ? 0 : 1;
+               /* do we read FragCoord ? */
+               if (pc->attr_nr &&
+                   p->info.input_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
+                       /* select FCRD components we want accessible */
+                       for (c = 0; c < 4; ++c)
+                               if (pc->attr[c].acc)
+                                       p->cfg.regs[1] |= 1 << (24 + c);
+                       aid = 0;
+               } else /* offset by 1 if FCRD.w is needed for pinterp */
+                       aid = popcnt4(p->cfg.regs[1] >> 24);
 
                /* non-flat interpolants have to be mapped to
                 * the lower hardware IDs, so sort them:
@@ -3750,12 +3758,6 @@ nv50_program_tx_prep(struct nv50_pc *pc)
                }
                copy_semantic_info(p);
 
-               if (!base) /* set w-coordinate mask from perspective interp */
-                       p->cfg.in[0].mask |= p->cfg.regs[1] >> 24;
-
-               aid = popcnt4( /* if fcrd isn't contained in cfg.io */
-                       base ? (p->cfg.regs[1] >> 24) : p->cfg.in[0].mask);
-
                for (n = 0; n < pc->attr_nr; ++n) {
                        p->cfg.in[n].hw = rid = aid;
                        i = p->cfg.in[n].id;
@@ -3777,9 +3779,6 @@ nv50_program_tx_prep(struct nv50_pc *pc)
                        aid += popcnt4(p->cfg.in[n].mask);
                }
 
-               if (!base)
-                       p->cfg.regs[1] |= p->cfg.in[0].mask << 24;
-
                m = popcnt4(p->cfg.regs[1] >> 24);
 
                /* set count of non-position inputs and of non-flat