i965/vec4: take into account doubles when creating attribute mapping
authorAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 21 Apr 2016 12:16:18 +0000 (14:16 +0200)
committerJuan A. Suarez Romero <jasuarez@igalia.com>
Thu, 12 Jan 2017 11:56:56 +0000 (12:56 +0100)
Doubles needs more that one slot per attribute. So when filling the
attribute_map we check if it is a double in order to allocate one
extra register.

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_vec4.cpp

index f80162d82036ea1b73fb5878054a152d5cb8c85f..748a068b1428d3a801cc777d272384f0fca4e3d2 100644 (file)
@@ -1733,10 +1733,15 @@ vec4_vs_visitor::setup_attributes(int payload_reg)
    memset(attribute_map, 0, sizeof(attribute_map));
 
    nr_attributes = 0;
-   for (int i = 0; i < VERT_ATTRIB_MAX; i++) {
-      if (vs_prog_data->inputs_read & BITFIELD64_BIT(i)) {
-        attribute_map[i] = payload_reg + nr_attributes;
-        nr_attributes++;
+   GLbitfield64 vs_inputs = vs_prog_data->inputs_read;
+   while (vs_inputs) {
+      GLuint first = ffsll(vs_inputs) - 1;
+      int needed_slots =
+         (vs_prog_data->double_inputs_read & BITFIELD64_BIT(first)) ? 2 : 1;
+      for (int c = 0; c < needed_slots; c++) {
+         attribute_map[nr_attributes] = payload_reg + nr_attributes;
+         nr_attributes++;
+         vs_inputs &= ~BITFIELD64_BIT(first + c);
       }
    }