[Mesa-dev] Fixup: Use C++ style constant member functions for is_one and is_zero.

Corbin Simpson mostawesomedude at gmail.com
Sun Sep 11 08:54:34 PDT 2011


I haven't read the surrounding code, but I'm relatively sure this
patch covers whether or not the given register can be filled with a
constant zero or one, which would be represented in the shader as a
special swizzle or selector. In that case, you'd only want to match
exact 0.0 and 1.0, but that's okay, because both 0.0 and 1.0 are
relatively common constants.

~ C.

On Sun, Sep 11, 2011 at 4:05 AM, Tolga Dalman
<tolga.dalman at googlemail.com> wrote:
> Hi Kenneth,
>
> On Fri,  9 Sep 2011 14:41:45 -0700
> Kenneth Graunke <kenneth at whitecape.org> wrote:
>
>> -   if (reg->type == BRW_REGISTER_TYPE_F) {
>> -      return reg->imm.f == 0.0;
>> +   if (type == BRW_REGISTER_TYPE_F) {
>> +      return imm.f == 0.0;
> [...]
>> -   if (reg->type == BRW_REGISTER_TYPE_F) {
>> -      return reg->imm.f == 1.0;
>> +   if (type == BRW_REGISTER_TYPE_F) {
>> +      return imm.f == 1.0;
>
> Shouldn't this rather be something like
> fabs(imm.f - 1.0) < std::numeric_limits<float>::eps() ?
>
> Nevertheless, I like your patch.
>
> Best regards
> Tolga Dalman
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 
When the facts change, I change my mind. What do you do, sir? ~ Keynes

Corbin Simpson
<MostAwesomeDude at gmail.com>


More information about the mesa-dev mailing list