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

Timothy Arceri timothy.arceri at collabora.com
Mon Dec 28 21:00:13 PST 2015


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.
---
 src/glsl/link_varyings.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 496b987..ed9ab47 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -1795,8 +1795,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.4.3



More information about the mesa-dev mailing list