[Mesa-dev] [PATCH] glsl: re-enable varying packing in GL4.4+
Timothy Arceri
timothy.arceri at collabora.com
Thu May 26 04:50:43 UTC 2016
The i965 backend currently expects doubles to be packed.
---
src/compiler/glsl/link_varyings.cpp | 54 +++++++++++++++++--------------------
1 file changed, 24 insertions(+), 30 deletions(-)
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index dd5c9cc..a7c859b 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -1372,10 +1372,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
@@ -1986,40 +2002,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,
--
2.5.5
More information about the mesa-dev
mailing list