summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/link_varyings.cpp54
1 files changed, 24 insertions, 30 deletions
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index 29362c4f21c..f6778b6a855 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1405,10 +1405,26 @@ varying_matches::record(ir_variable *producer_var, ir_variable *consumer_var)
sizeof(*this->matches) * this->matches_capacity);
}
- const ir_variable *const var = (producer_var != NULL)
- ? producer_var : consumer_var;
- const gl_shader_stage stage = (producer_var != NULL)
- ? producer_stage : consumer_stage;
+ /* We must use the consumer to compute the packing class because in GL4.4+
+ * there is no guarantee interpolation qualifiers will match across stages.
+ *
+ * From Section 4.5 (Interpolation Qualifiers) of the GLSL 4.30 spec:
+ *
+ * "The type and presence of interpolation qualifiers of variables with
+ * the same name declared in all linked shaders for the same cross-stage
+ * interface must match, otherwise the link command will fail.
+ *
+ * When comparing an output from one stage to an input of a subsequent
+ * stage, the input and output don't match if their interpolation
+ * qualifiers (or lack thereof) are not the same."
+ *
+ * This text was also in at least revison 7 of the 4.40 spec but is no
+ * longer in revision 9 and not in the 4.50 spec.
+ */
+ const ir_variable *const var = (consumer_var != NULL)
+ ? consumer_var : producer_var;
+ const gl_shader_stage stage = (consumer_var != NULL)
+ ? consumer_stage : producer_stage;
const glsl_type *type = get_varying_type(var, stage);
this->matches[this->num_matches].packing_class
@@ -2023,40 +2039,18 @@ assign_varying_locations(struct gl_context *ctx,
bool xfb_enabled =
ctx->Extensions.EXT_transform_feedback && !unpackable_tess;
- /* Disable varying packing for GL 4.4+ as there is no guarantee
- * that interpolation qualifiers will match between shaders in these
- * versions. We also disable packing on outward facing interfaces for
- * SSO because in ES we need to retain the unpacked varying information
- * for draw time validation. For desktop GL we could allow packing for
- * versions < 4.4 but it's just safer not to do packing.
+ /* Disable packing on outward facing interfaces for SSO because in ES we
+ * need to retain the unpacked varying information for draw time
+ * validation.
*
* Packing is still enabled on individual arrays, structs, and matrices as
* these are required by the transform feedback code and it is still safe
* to do so. We also enable packing when a varying is only used for
* transform feedback and its not a SSO.
- *
- * Varying packing currently only packs together varyings with matching
- * interpolation qualifiers as the backends assume all packed components
- * are to be processed in the same way. Therefore we cannot do packing in
- * these versions of GL without the risk of mismatching interfaces.
- *
- * From Section 4.5 (Interpolation Qualifiers) of the GLSL 4.30 spec:
- *
- * "The type and presence of interpolation qualifiers of variables with
- * the same name declared in all linked shaders for the same cross-stage
- * interface must match, otherwise the link command will fail.
- *
- * When comparing an output from one stage to an input of a subsequent
- * stage, the input and output don't match if their interpolation
- * qualifiers (or lack thereof) are not the same."
- *
- * This text was also in at least revison 7 of the 4.40 spec but is no
- * longer in revision 9 and not in the 4.50 spec.
*/
bool disable_varying_packing =
ctx->Const.DisableVaryingPacking || unpackable_tess;
- if ((ctx->API == API_OPENGL_CORE && ctx->Version >= 44) ||
- (prog->SeparateShader && (producer == NULL || consumer == NULL)))
+ if (prog->SeparateShader && (producer == NULL || consumer == NULL))
disable_varying_packing = true;
varying_matches matches(disable_varying_packing, xfb_enabled,