[Mesa-dev] [PATCH] glsl: add ir_unop_b2d

Ian Romanick idr at freedesktop.org
Tue Jan 12 09:33:00 PST 2016


On 01/12/2016 07:29 AM, Ilia Mirkin wrote:
> IIRC this should come out as b2i + i2d. You should be able to test this
> with llvmpipe/softpipe, which support fp64.

Either that or b2f + f2d.  I remember there being discussion about this
topic when Dave first sent out the fp64 patches.  I thought we decided
against a b2d opcode.

> On Jan 12, 2016 9:49 AM, "Iago Toral Quiroga" <itoral at igalia.com
> <mailto:itoral at igalia.com>> wrote:
> 
>     For boolean to double conversions
>     ---
> 
>     Looks like d2b is present but this one was missing for some reason.
>     I found
>     this while testing fp64 support on Intel.
> 
>     I have the NIR and i965 implementation of this too but that is be
>     part of
>     the fp64 enablement in NIR/i965 that is not ready for review yet.
> 
>     I guess drivers that already implement fp64 should implement this
>     operation
>     too.
> 
>      src/glsl/ir.cpp                                          | 1 +
>      src/glsl/ir.h                                            | 1 +
>      src/glsl/ir_validate.cpp                                 | 4 ++++
>      src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 1 +
>      src/mesa/program/ir_to_mesa.cpp                          | 1 +
>      src/mesa/state_tracker/st_glsl_to_tgsi.cpp               | 1 +
>      6 files changed, 9 insertions(+)
> 
>     diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
>     index d82bccd..f4a6f85 100644
>     --- a/src/glsl/ir.cpp
>     +++ b/src/glsl/ir.cpp
>     @@ -518,6 +518,7 @@ static const char *const operator_strs[] = {
>         "i2f",
>         "f2b",
>         "b2f",
>     +   "b2d",
>         "i2b",
>         "b2i",
>         "u2f",
>     diff --git a/src/glsl/ir.h b/src/glsl/ir.h
>     index 93e0734..f64fbec 100644
>     --- a/src/glsl/ir.h
>     +++ b/src/glsl/ir.h
>     @@ -1337,6 +1337,7 @@ enum ir_expression_operation {
>         ir_unop_i2f,         /**< Integer-to-float conversion. */
>         ir_unop_f2b,         /**< Float-to-boolean conversion */
>         ir_unop_b2f,         /**< Boolean-to-float conversion */
>     +   ir_unop_b2d,         /**< Boolean-to-double conversion */
>         ir_unop_i2b,         /**< int-to-boolean conversion */
>         ir_unop_b2i,         /**< Boolean-to-int conversion */
>         ir_unop_u2f,         /**< Unsigned-to-float conversion. */
>     diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
>     index dcc079c..7ae01a9 100644
>     --- a/src/glsl/ir_validate.cpp
>     +++ b/src/glsl/ir_validate.cpp
>     @@ -283,6 +283,10 @@ ir_validate::visit_leave(ir_expression *ir)
>            assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
>            assert(ir->type->base_type == GLSL_TYPE_FLOAT);
>            break;
>     +   case ir_unop_b2d:
>     +      assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
>     +      assert(ir->type->base_type == GLSL_TYPE_DOUBLE);
>     +      break;
>         case ir_unop_i2b:
>            assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT);
>            assert(ir->type->base_type == GLSL_TYPE_BOOL);
>     diff --git
>     a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
>     b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
>     index 78a8240..9e1b8aa 100644
>     --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
>     +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
>     @@ -434,6 +434,7 @@
>     ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
>         case ir_unop_d2u:
>         case ir_unop_u2d:
>         case ir_unop_d2b:
>     +   case ir_unop_b2d:
>            unreachable("no fp64 support yet");
>         }
> 
>     diff --git a/src/mesa/program/ir_to_mesa.cpp
>     b/src/mesa/program/ir_to_mesa.cpp
>     index 852655d..9d85cbc 100644
>     --- a/src/mesa/program/ir_to_mesa.cpp
>     +++ b/src/mesa/program/ir_to_mesa.cpp
>     @@ -1259,6 +1259,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
>         case ir_unop_d2u:
>         case ir_unop_u2d:
>         case ir_unop_d2b:
>     +   case ir_unop_b2d:
>         case ir_unop_frexp_sig:
>         case ir_unop_frexp_exp:
>            assert(!"not supported");
>     diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>     b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>     index 27a0a4f..676e378 100644
>     --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>     +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>     @@ -2197,6 +2197,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>            break;
> 
>         case ir_unop_get_buffer_size:
>     +   case ir_unop_b2d:
>            assert(!"Not implemented yet");
>            break;
>         }
>     --
>     1.9.1
> 
>     _______________________________________________
>     mesa-dev mailing list
>     mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.freedesktop.org>
>     http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list