glsl: simply packing class comparison
authorBrian Paul <brianp@vmware.com>
Fri, 15 Dec 2017 22:21:46 +0000 (15:21 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 20 Dec 2017 18:23:17 +0000 (11:23 -0700)
Handle comparing the packing class using the same method as we do
for var->data.is_xfb_only

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/link_varyings.cpp

index 7f42f8a2150386974b7b99eab36d4dcf8b30ab3d..e0f3afb9616b442c7b26f58160a9a1c6b1ac89cc 100644 (file)
@@ -1775,6 +1775,7 @@ varying_matches::assign_locations(struct gl_shader_program *prog,
    unsigned generic_location = 0;
    unsigned generic_patch_location = MAX_VARYING*4;
    bool previous_var_xfb_only = false;
+   unsigned previous_packing_class = ~0u;
 
    for (unsigned i = 0; i < this->num_matches; i++) {
       unsigned *location = &generic_location;
@@ -1809,12 +1810,12 @@ varying_matches::assign_locations(struct gl_shader_program *prog,
       if (var->data.must_be_shader_input ||
           (this->disable_varying_packing &&
            !(previous_var_xfb_only && var->data.is_xfb_only)) ||
-          (i > 0 && this->matches[i - 1].packing_class
-          != this->matches[i].packing_class )) {
+          (previous_packing_class != this->matches[i].packing_class )) {
          *location = ALIGN(*location, 4);
       }
 
       previous_var_xfb_only = var->data.is_xfb_only;
+      previous_packing_class = this->matches[i].packing_class;
 
       /* The number of components taken up by this variable. For vertex shader
        * inputs, we use the number of slots * 4, as they have different