glsl: Clean up apply_implicit_conversion

We're about to add new implicit conversions, first for ARB_gpu_shader5,
and then later for ARB_gpu_shader_fp64. Pull out the opcode
determination into its own function, and get rid of the bool -> float
case that could never be hit anyway [since it fails the is_numeric()
check].

V2: Retain the vector width mangling. It turns out this is necessary for
the conversions done (and then thrown away) when determining the return
type of arithmetic operators.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Add support for int -> uint implicit conversions

This is required for ARB_gpu_shader5.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Pass parse state to parameter_lists_match()

The available implicit conversions depend on the GLSL version we're
compiling.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Pass parse state to can_implicitly_convert_to()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Allow int -> uint implicit conversions on function parameters

V2: Fix crashes during linking, where the parse state is NULL. In this
case, all required checks have already been done, so we assume the
extension is enabled.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Build a list of inexact function matches

This will facilitate GLSL 4.0 / ARB_gpu_shader5's enhanced overload
resolution rules, and also possibly better error reporting for ambiguous
function calls.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Add support for comparing function parameter conversions

The ARB_gpu_shader5 spec says:

"To determine whether the conversion for a single argument in one match is
better than that for another match, the following rules are applied, in
order:

  1. An exact match is better than a match involving any implicit
     conversion.

  2. A match involving an implicit conversion from float to double is
     better than a match involving any other implicit conversion.

  3. A match involving an implicit conversion from either int or uint to
     float is better than a match involving an implicit conversion from
     either int or uint to double.

If none of the rules above apply to a particular pair of conversions,
neither conversion is considered better than the other."

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
glsl: Implement overload resolution for ARB_gpu_shader5

The ARB_gpu_shader5 spec says:

"A function definition A is considered a better
match than function definition B if:

  * for at least one function argument, the conversion for that argument
    in A is better than the corresponding conversion in B; and

  * there is no function argument for which the conversion in B is better
    than the corresponding conversion in A.

If a single function definition is considered a better match than every
other matching function definition, it will be used.  Otherwise, a
semantic error occurs and the shader will fail to compile."

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
docs: Update GL3.txt

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>