gallium: util_blit_pixels() takes source sampler view as argument.
[mesa.git] / src / gallium / auxiliary / draw / draw_pt_fetch_shade_pipeline.c
index 1a9df4cac5d5269723996da3535f7b9c1d455d59..da5106463a700f52a23ca0c9ee64276913267d9b 100644 (file)
@@ -33,7 +33,6 @@
 #include "draw/draw_pt.h"
 #include "draw/draw_vs.h"
 #include "draw/draw_gs.h"
-#include "translate/translate.h"
 
 
 struct fetch_pipeline_middle_end {
@@ -59,6 +58,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
    struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle;
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *vs = draw->vs.vertex_shader;
+   unsigned i;
+   unsigned instance_id_index = ~0;
 
    /* Add one to num_outputs because the pipeline occasionally tags on
     * an additional texcoord, eg for AA lines.
@@ -66,6 +67,15 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
    unsigned nr = MAX2( vs->info.num_inputs,
                       vs->info.num_outputs + 1 );
 
+   /* Scan for instanceID system value.
+    */
+   for (i = 0; i < vs->info.num_inputs; i++) {
+      if (vs->info.input_semantic_name[i] == TGSI_SEMANTIC_INSTANCEID) {
+         instance_id_index = i;
+         break;
+      }
+   }
+
    fpme->prim = prim;
    fpme->opt = opt;
 
@@ -79,14 +89,14 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
 
    draw_pt_fetch_prepare( fpme->fetch, 
                           vs->info.num_inputs,
-                         fpme->vertex_size );
+                          fpme->vertex_size,
+                          instance_id_index );
    /* XXX: it's not really gl rasterization rules we care about here,
     * but gl vs dx9 clip spaces.
     */
    draw_pt_post_vs_prepare( fpme->post_vs,
                            (boolean)draw->bypass_clipping,
-                           (boolean)(draw->identity_viewport ||
-                           draw->rasterizer->bypass_vs_clip_and_viewport),
+                           (boolean)draw->identity_viewport,
                            (boolean)draw->rasterizer->gl_rasterization_rules,
                            (draw->vs.edgeflag_output ? true : false) );    
 
@@ -143,16 +153,14 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
                      (char *)pipeline_verts );
 
    /* Run the shader, note that this overwrites the data[] parts of
-    * the pipeline verts.  If there is no shader, eg if
-    * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
-    * already in the correct place.
+    * the pipeline verts.
     */
    if (opt & PT_SHADE)
    {
       vshader->run_linear(vshader,
                           (const float (*)[4])pipeline_verts->data,
                           (      float (*)[4])pipeline_verts->data,
-                          (const float (*)[4])draw->pt.user.vs_constants,
+                          draw->pt.user.vs_constants,
                           fetch_count,
                           fpme->vertex_size,
                           fpme->vertex_size);
@@ -160,7 +168,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
          draw_geometry_shader_run(gshader,
                                   (const float (*)[4])pipeline_verts->data,
                                   (      float (*)[4])pipeline_verts->data,
-                                  (const float (*)[4])draw->pt.user.gs_constants,
+                                  draw->pt.user.gs_constants,
                                   fetch_count,
                                   fpme->vertex_size,
                                   fpme->vertex_size);
@@ -228,16 +236,14 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
                              (char *)pipeline_verts );
 
    /* Run the shader, note that this overwrites the data[] parts of
-    * the pipeline verts.  If there is no shader, ie if
-    * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
-    * already in the correct place.
+    * the pipeline verts.
     */
    if (opt & PT_SHADE)
    {
       shader->run_linear(shader,
                         (const float (*)[4])pipeline_verts->data,
                         (      float (*)[4])pipeline_verts->data,
-                        (const float (*)[4])draw->pt.user.vs_constants,
+                         draw->pt.user.vs_constants,
                         count,
                         fpme->vertex_size,
                         fpme->vertex_size);
@@ -246,7 +252,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
          draw_geometry_shader_run(geometry_shader,
                                   (const float (*)[4])pipeline_verts->data,
                                   (      float (*)[4])pipeline_verts->data,
-                                  (const float (*)[4])draw->pt.user.gs_constants,
+                                  draw->pt.user.gs_constants,
                                   count,
                                   fpme->vertex_size,
                                   fpme->vertex_size);
@@ -308,16 +314,14 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
                              (char *)pipeline_verts );
 
    /* Run the shader, note that this overwrites the data[] parts of
-    * the pipeline verts.  If there is no shader, ie if
-    * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
-    * already in the correct place.
+    * the pipeline verts.
     */
    if (opt & PT_SHADE)
    {
       shader->run_linear(shader,
                         (const float (*)[4])pipeline_verts->data,
                         (      float (*)[4])pipeline_verts->data,
-                        (const float (*)[4])draw->pt.user.vs_constants,
+                         draw->pt.user.vs_constants,
                         count,
                         fpme->vertex_size,
                         fpme->vertex_size);
@@ -326,7 +330,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
          draw_geometry_shader_run(geometry_shader,
                                   (const float (*)[4])pipeline_verts->data,
                                   (      float (*)[4])pipeline_verts->data,
-                                  (const float (*)[4])draw->pt.user.gs_constants,
+                                  draw->pt.user.gs_constants,
                                   count,
                                   fpme->vertex_size,
                                   fpme->vertex_size);