Merge branch 'master' into gallium-sampler-view
[mesa.git] / src / gallium / drivers / softpipe / sp_quad_fs.c
index 1e7533d0f9ec8cafd0d007fe38ceb2f95e19a165..8ae5a7f028b2985a2f8099d63b52c5a5b4995eaf 100644 (file)
@@ -45,8 +45,6 @@
 #include "sp_state.h"
 #include "sp_quad.h"
 #include "sp_quad_pipe.h"
-#include "sp_texture.h"
-#include "sp_tex_sample.h"
 
 
 struct quad_shade_stage
@@ -67,6 +65,7 @@ quad_shade_stage(struct quad_stage *qs)
 
 /**
  * Execute fragment shader for the four fragments in the quad.
+ * \return TRUE if quad is alive, FALSE if all four pixels are killed
  */
 static INLINE boolean
 shade_quad(struct quad_stage *qs, struct quad_header *quad)
@@ -100,24 +99,28 @@ coverage_quad(struct quad_stage *qs, struct quad_header *quad)
 }
 
 
-
+/**
+ * Shade/write an array of quads
+ * Called via quad_stage::run()
+ */
 static void
 shade_quads(struct quad_stage *qs, 
-                 struct quad_header *quads[],
-                 unsigned nr)
+            struct quad_header *quads[],
+            unsigned nr)
 {
    struct quad_shade_stage *qss = quad_shade_stage( qs );
    struct softpipe_context *softpipe = qs->softpipe;
    struct tgsi_exec_machine *machine = qss->machine;
-
    unsigned i, pass = 0;
-   
-   machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT];
+
+   for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+      machine->Consts[i] = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT][i];
+   }
    machine->InterpCoefs = quads[0]->coef;
 
    for (i = 0; i < nr; i++) {
       if (!shade_quad(qs, quads[i]))
-         continue;
+         continue; /* quad totally culled/killed */
 
       if (/*do_coverage*/ 0)
          coverage_quad( qs, quads[i] );
@@ -130,9 +133,6 @@ shade_quads(struct quad_stage *qs,
 }
    
 
-
-
-
 /**
  * Per-primitive (or per-begin?) setup
  */