glsl: Fix implicit conversions in non-constructor function calls
authorChad Versace <chad@chad-versace.us>
Wed, 27 Jul 2011 19:31:10 +0000 (12:31 -0700)
committerChad Versace <chad@chad-versace.us>
Sat, 30 Jul 2011 14:27:14 +0000 (07:27 -0700)
commit8b3627fd7b52723102f070957d87f98073e92d7c
treede67534da6af93d78d9bd88470cd2c8a31847c0d
parent200e4972c1579e8dfaa6f11eee2a7e54baad4852
glsl: Fix implicit conversions in non-constructor function calls

Context
-------
In ast_function_expression::hir(), parameter_lists_match() checks if the
function call's actual parameter list matches the signature's parameter
list, where the match may require implicit conversion of some arguments.
To check if an implicit conversion exists between individual arguments,
type_compare() is used.

Problems
--------
type_compare() allowed the following illegal implicit conversions:
    bool -> float
    bvecN -> vecN

    int -> uint
    ivecN -> uvecN

    uint -> int
    uvecN -> ivecN

Change
------
type_compare() is buggy, so replace it with glsl_type::can_be_implicitly_converted_to().
This comprises a rewrite of parameter_lists_match().

Fixes piglit:spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec*.vert

Note: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
src/glsl/ir_function.cpp