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.dal...@googlemail.com> wrote: > Hi Kenneth, > > On Fri, 9 Sep 2011 14:41:45 -0700 > Kenneth Graunke <kenn...@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@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 <mostawesomed...@gmail.com> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev