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.pho...@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallag...@alterapraxis.com>
Reviewed-by: Kenneth Graunke <kenn...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to