}
if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS))
ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
+
+ /* Unpacking a varying in the fragment shader costs 1 texture indirection.
+ * If the number of available texture indirections is very limited, then we
+ * prefer to disable varying packing rather than run the risk of varying
+ * packing preventing a shader from running.
+ */
+ if (screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS) <= 8) {
+ /* We can't disable varying packing if transform feedback is available,
+ * because transform feedback code assumes a packed varying layout.
+ */
+ if (!ctx->Extensions.EXT_transform_feedback)
+ ctx->Const.DisableVaryingPacking = GL_TRUE;
+ }
}