glsl: Avoid buffer overflow when assigning attribute locations

Shaders with excessive number of attributes (>16) can produce a crash
due to buffer overflow in assign_attribute_or_color_locations. The
overflow can happen because we declare a fixed size array that can hold
up to 16 attributes and we don't check that we don't go beyond that
limit.

This patch changes the limit from a fixed size of 16 element to
MAX2(MAX_VERTEX_GENERIC_ATTRIBS, MAX_DRAW_BUFFERS), which seems more
reasonable. It also makes sure that we don't process more than this
amount of attributes, producing a linker error if the shader requires
more than this.

v2:
  - With fragment shaders, this function processes outputs, not inputs (Ian)
  - Error message should tell if the problem is with vertex inputs or
    fragment outputs (Ian)
  - The function receives a parameter with the attribute limit (max_index),
    so no need to compute it inside
  - Assert if max_index is too large for the size of to_assign[]

Avoids crashes in 108 dEQP tests in these categories:
dEQP-GLES3.functional.transform_feedback.array_element.separate.
dEQP-GLES3.functional.transform_feedback.array_element.interleaved.*
1 file changed