On Wed, Apr 1, 2015 at 4:26 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote:
> On Wed, Apr 1, 2015 at 7:14 PM, Connor Abbott <cwabbo...@gmail.com> wrote:
>> On Wed, Apr 1, 2015 at 6:49 PM, Jason Ekstrand <ja...@jlekstrand.net> wrote:
>>> On Tue, Mar 31, 2015 at 4:10 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote:
>>>> On Tue, Mar 31, 2015 at 6:57 PM, Rob Clark <robdcl...@gmail.com> wrote:
>>>>> From: Rob Clark <robcl...@freedesktop.org>
>>>>>
>>>>> Signed-off-by: Rob Clark <robcl...@freedesktop.org>
>>>>> ---
>>>>>  src/glsl/nir/nir_opcodes.py | 4 ++--
>>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/src/glsl/nir/nir_opcodes.py b/src/glsl/nir/nir_opcodes.py
>>>>> index 062cd62..b92fc7e 100644
>>>>> --- a/src/glsl/nir/nir_opcodes.py
>>>>> +++ b/src/glsl/nir/nir_opcodes.py
>>>>> @@ -161,11 +161,11 @@ unop_convert("f2i", tfloat, tint, "src0") # 
>>>>> Float-to-integer conversion.
>>>>>  unop_convert("f2u", tfloat, tunsigned, "src0") # Float-to-unsigned 
>>>>> conversion
>>>>>  unop_convert("i2f", tint, tfloat, "src0") # Integer-to-float conversion.
>>>>>  # Float-to-boolean conversion
>>>>> -unop_convert("f2b", tfloat, tbool, "src0 == 0.0f")
>>>>> +unop_convert("f2b", tfloat, tbool, "src0 != 0.0f")
>>>>>  # Boolean-to-float conversion
>>>>>  unop_convert("b2f", tbool, tfloat, "src0 ? 1.0f : 0.0f")
>>>>>  # Int-to-boolean conversion
>>>>> -unop_convert("i2b", tint, tbool, "src0 == 0")
>>>>> +unop_convert("i2b", tint, tbool, "src0 != 0")
>>>>>  unop_convert("b2i", tbool, tint, "src0 ? 0 : -1") # Boolean-to-int 
>>>>> conversion
>>>>
>>>> Fix this while you're at it as well? Should be src0 ? -1 : 0, I assume...
>>>
>>> Or src0 ? 1 : 0... I'm not sure there.
>>> --Jason
>>
>> Yeah, I think it should be src0 ? 1 : 0.
>
> That would mean that a sequence like
>
> bool a;
>
> b2i(a) & 0x3f800000
>
> won't work the way that one might expect it to. Perhaps that's not an
> issue in nir.

Okay. Enough guessing. b2i matches the GLSL rules for bool -> int
conversions: true -> 1; false -> 0.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to