Mesa (master): i965/fs: Add VS output support to nir_setup_outputs().

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Mar 12 19:20:19 UTC 2015


Module: Mesa
Branch: master
Commit: 7ef0b6b367f73e24e6dd47a15d439775d3dd1297
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ef0b6b367f73e24e6dd47a15d439775d3dd1297

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Mar  9 01:58:58 2015 -0700

i965/fs: Add VS output support to nir_setup_outputs().

Adapted from fs_visitor::visit(ir_variable *).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs_nir.cpp |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index dbfb274..a9e75ab 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -255,7 +255,17 @@ fs_visitor::nir_setup_outputs(nir_shader *shader)
       nir_variable *var = (nir_variable *) entry->data;
       fs_reg reg = offset(nir_outputs, var->data.driver_location);
 
-      if (var->data.index > 0) {
+      int vector_elements =
+         var->type->is_array() ? var->type->fields.array->vector_elements
+                               : var->type->vector_elements;
+
+      if (stage == MESA_SHADER_VERTEX) {
+         for (int i = 0; i < ALIGN(type_size(var->type), 4) / 4; i++) {
+            int output = var->data.location + i;
+            this->outputs[output] = offset(reg, 4 * i);
+            this->output_components[output] = vector_elements;
+         }
+      } else if (var->data.index > 0) {
          assert(var->data.location == FRAG_RESULT_DATA0);
          assert(var->data.index == 1);
          this->dual_src_output = reg;
@@ -275,10 +285,6 @@ fs_visitor::nir_setup_outputs(nir_shader *shader)
          assert(var->data.location >= FRAG_RESULT_DATA0 &&
                 var->data.location < FRAG_RESULT_DATA0 + BRW_MAX_DRAW_BUFFERS);
 
-         int vector_elements =
-            var->type->is_array() ? var->type->fields.array->vector_elements
-                                  : var->type->vector_elements;
-
          /* General color output. */
          for (unsigned int i = 0; i < MAX2(1, var->type->length); i++) {
             int output = var->data.location - FRAG_RESULT_DATA0 + i;




More information about the mesa-commit mailing list