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

Timothy Arceri timothy.arceri at collabora.com
Mon Feb 29 01:17:47 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 a5ddf3d..ad91249 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1771,8 +1771,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.0



More information about the mesa-dev mailing list