[Mesa-dev] [PATCH] glsl/ast: Implicit conversion from double to float is not allowed

Dave Airlie airlied at gmail.com
Sat Mar 26 23:54:18 UTC 2016


On 21 February 2016 at 04:08, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Saturday, February 20, 2016 1:30:46 PM PST Andres Gomez wrote:
>> Also, renamed get_conversion_operation to avoid
>> future misunderstandings.
>> ---

I posted the same patch long ago, Tapani said this, not sure if it
still applies, I never got back to it.

"This seems to be used in ast_function.cpp for implementing
constructors where this type of conversion can happen, so not a
implicit conversion but a 'conversion constructor'.

(5.4.1 Conversion and Scalar Constructors)

You would need to change that also."

Dave.



>>  src/compiler/glsl/ast_to_hir.cpp | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/
> ast_to_hir.cpp
>> index 75abef6..db5ec9a 100644
>> --- a/src/compiler/glsl/ast_to_hir.cpp
>> +++ b/src/compiler/glsl/ast_to_hir.cpp
>> @@ -231,15 +231,14 @@ _mesa_ast_to_hir(exec_list *instructions, struct
> _mesa_glsl_parse_state *state)
>>
>>
>>  static ir_expression_operation
>> -get_conversion_operation(const glsl_type *to, const glsl_type *from,
>> -                         struct _mesa_glsl_parse_state *state)
>> +get_implicit_conversion_operation(const glsl_type *to, const glsl_type
> *from,
>> +                                  struct _mesa_glsl_parse_state *state)
>>  {
>>     switch (to->base_type) {
>>     case GLSL_TYPE_FLOAT:
>>        switch (from->base_type) {
>>        case GLSL_TYPE_INT: return ir_unop_i2f;
>>        case GLSL_TYPE_UINT: return ir_unop_u2f;
>> -      case GLSL_TYPE_DOUBLE: return ir_unop_d2f;
>>        default: return (ir_expression_operation)0;
>>        }
>>
>> @@ -311,7 +310,7 @@ apply_implicit_conversion(const glsl_type *to, ir_rvalue
> * &from,
>>     to = glsl_type::get_instance(to->base_type, from->type->vector_elements,
>>                                  from->type->matrix_columns);
>>
>> -   ir_expression_operation op = get_conversion_operation(to, from->type,
> state);
>> +   ir_expression_operation op = get_implicit_conversion_operation(to, from-
>>type, state);
>>     if (op) {
>>        from = new(ctx) ir_expression(op, to, from, NULL);
>>        return true;
>>
>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list