[Mesa-dev] [PATCH 07/27] glsl: include varyings with explicit locations in slot count

Timothy Arceri timothy.arceri at collabora.com
Thu Mar 31 10:57:42 UTC 2016


This count is used by the packing pass and we need to include
varying with explicit locations to be able to pack varyings
with explicit components.

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/link_varyings.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index e0d6919..2be3fb0 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -2121,8 +2121,13 @@ assign_varying_locations(struct gl_context *ctx,
       reserved_varying_slot(producer, ir_var_shader_out) |
       reserved_varying_slot(consumer, ir_var_shader_in);
 
-   const unsigned slots_used = matches.assign_locations(prog, reserved_slots,
-                                                        prog->SeparateShader);
+   /* Add varyings with explicit locations to varyings with implicit locations
+    * to get the total number of slots used.
+    */
+   const unsigned slots_used =
+      matches.assign_locations(prog, reserved_slots, prog->SeparateShader) +
+      _mesa_bitcount_64(reserved_slots);
+
    matches.store_locations();
 
    for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
-- 
2.5.5



More information about the mesa-dev mailing list