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....@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.
Thanks. BTW, would any of you push my patches(including those patches I sent days before) to mesa repo? I haven't had the commit permission yet. Thanks, Yuanhan Liu > > Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev