[Mesa-dev] [PATCH] intel: fix the wrong code to detect null texture.
Eric Anholt
eric at anholt.net
Thu Sep 22 22:26:37 PDT 2011
On Fri, 23 Sep 2011 11:09:14 +0800, Yuanhan Liu <yuanhan.liu at linux.intel.com> wrote:
> On Thu, Sep 08, 2011 at 09:12:44PM -0700, Kenneth Graunke wrote:
> > On 09/08/2011 07:56 PM, Yuanhan Liu wrote:
> > > There is already comments show how to detect a null texture. Fix the
> > > code to match the comments.
> > >
> > > This would fix the oglc divzero(basic.texQOrWEqualsZero) and
> > > divzero(basic.texTrivialPrim) test case fail.
> > >
> > > Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
> > > ---
> > > src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 2 +-
> > > 1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> > > index f36240d..717e0ae 100644
> > > --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> > > +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> > > @@ -137,7 +137,7 @@ intel_miptree_create(struct intel_context *intel,
> > > /*
> > > * pitch == 0 || height == 0 indicates the null texture
> > > */
> > > - if (!mt || !mt->total_height) {
> > > + if (!mt->total_width || !mt->total_height) {
> > > free(mt);
> > > return NULL;
> > > }
> >
> > I was a bit skeptical about removing the !mt check, but I think it's
> > actually okay since intel_miptree_create_internal never returns NULL.
> >
> > I had to convince myself of that by writing the patch I'm about to reply
> > with. intel_miptree_create_internal has explicit "if (!ok) return NULL"
> > code in it, but it turns out that ok is statically provable to always be
> > true. My patch deletes it.
> >
> > The only other reason it might want to return NULL is if allocation of
> > the struct intel_mipmap_tree fails, but it doesn't check for that.
> > Perhaps it should? (But, it's a tiny struct and I'm pretty sure we fail
> > to check things like that all over the place, so...eh...)
> >
> > Anyway, this looks right to me. I'll defer to Eric and Ian though.
>
> Hi Eric and Ian, does this patch looks Ok to you? If no problem
> reported, I would like to push this patch with a change suggested by
> Kenneth in this mail to repo next monday.
Yeah, if you get an R-B and nobody else responds in a few days, you can
probably just go ahead :) Anyway, it gets my
Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110922/6a9ac697/attachment-0001.pgp>
More information about the mesa-dev
mailing list