glsl: Pass parse state to can_implicitly_convert_to()

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Chris Forbes 2014-05-04 20:23:57 +12:00
parent a78c663c22
commit f17428a276
4 changed files with 8 additions and 6 deletions

View File

@ -701,7 +701,7 @@ process_vec_mat_constructor(exec_list *instructions,
glsl_type::get_instance(GLSL_TYPE_FLOAT, glsl_type::get_instance(GLSL_TYPE_FLOAT,
ir->type->vector_elements, ir->type->vector_elements,
ir->type->matrix_columns); ir->type->matrix_columns);
if (result->type->can_implicitly_convert_to(desired_type)) { if (result->type->can_implicitly_convert_to(desired_type, state)) {
/* Even though convert_component() implements the constructor /* Even though convert_component() implements the constructor
* conversion rules (not the implicit conversion rules), its safe * conversion rules (not the implicit conversion rules), its safe
* to use it here because we already checked that the implicit * to use it here because we already checked that the implicit
@ -830,7 +830,7 @@ process_array_constructor(exec_list *instructions,
glsl_type::get_instance(GLSL_TYPE_FLOAT, glsl_type::get_instance(GLSL_TYPE_FLOAT,
ir->type->vector_elements, ir->type->vector_elements,
ir->type->matrix_columns); ir->type->matrix_columns);
if (result->type->can_implicitly_convert_to(desired_type)) { if (result->type->can_implicitly_convert_to(desired_type, state)) {
/* Even though convert_component() implements the constructor /* Even though convert_component() implements the constructor
* conversion rules (not the implicit conversion rules), its safe * conversion rules (not the implicit conversion rules), its safe
* to use it here because we already checked that the implicit * to use it here because we already checked that the implicit

View File

@ -678,7 +678,8 @@ glsl_type::component_slots() const
} }
bool bool
glsl_type::can_implicitly_convert_to(const glsl_type *desired) const glsl_type::can_implicitly_convert_to(const glsl_type *desired,
_mesa_glsl_parse_state *state) const
{ {
if (this == desired) if (this == desired)
return true; return true;

View File

@ -314,7 +314,8 @@ struct glsl_type {
* integers. * integers.
* \endverbatim * \endverbatim
*/ */
bool can_implicitly_convert_to(const glsl_type *desired) const; bool can_implicitly_convert_to(const glsl_type *desired,
_mesa_glsl_parse_state *state) const;
/** /**
* Query whether or not a type is a scalar (non-vector and non-matrix). * Query whether or not a type is a scalar (non-vector and non-matrix).

View File

@ -80,12 +80,12 @@ parameter_lists_match(_mesa_glsl_parse_state *state,
case ir_var_const_in: case ir_var_const_in:
case ir_var_function_in: case ir_var_function_in:
if (!actual->type->can_implicitly_convert_to(param->type)) if (!actual->type->can_implicitly_convert_to(param->type, state))
return PARAMETER_LIST_NO_MATCH; return PARAMETER_LIST_NO_MATCH;
break; break;
case ir_var_function_out: case ir_var_function_out:
if (!param->type->can_implicitly_convert_to(actual->type)) if (!param->type->can_implicitly_convert_to(actual->type, state))
return PARAMETER_LIST_NO_MATCH; return PARAMETER_LIST_NO_MATCH;
break; break;