[Mesa-dev] [PATCH 11/14] i965/fs: Handle compact outputs.

Kenneth Graunke kenneth at whitecape.org
Tue Nov 15 01:41:35 UTC 2016


We need to calculate the number of vec4 slots correctly.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs.h       | 2 +-
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index da01174..6446a61 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -191,7 +191,7 @@ public:
 
    void emit_nir_code();
    void nir_setup_single_output_varying(fs_reg *reg, const glsl_type *type,
-                                        unsigned *location);
+                                        bool is_compact, unsigned *location);
    void nir_setup_outputs();
    void nir_setup_uniforms();
    void nir_emit_system_values();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index e770502..82e22c2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -55,7 +55,9 @@ fs_visitor::nir_setup_outputs()
       return;
 
    nir_foreach_variable(var, &nir->outputs) {
-      const unsigned vec4s = type_size_vec4(var->type);
+      const unsigned vec4s =
+         var->data.compact ? DIV_ROUND_UP(glsl_get_length(var->type), 4)
+                           : type_size_vec4(var->type);
       fs_reg reg = bld.vgrf(BRW_REGISTER_TYPE_F, 4 * vec4s);
       for (unsigned i = 0; i < vec4s; i++) {
          if (outputs[var->data.driver_location + i].file == BAD_FILE)
-- 
2.10.2



More information about the mesa-dev mailing list