diff options
author | Eric Anholt <eric@anholt.net> | 2013-08-30 12:21:38 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-09-30 14:35:42 -0700 |
commit | 3b9a2dc9385cd59471fd57def0bb70d7d902b5ed (patch) | |
tree | 68feee29a5849e520d925aaac8b950e483bb1b1f /src | |
parent | 7de88ac38004e68b5a0a94c881cc1da1ee4371d7 (diff) | |
download | external_mesa3d-3b9a2dc9385cd59471fd57def0bb70d7d902b5ed.zip external_mesa3d-3b9a2dc9385cd59471fd57def0bb70d7d902b5ed.tar.gz external_mesa3d-3b9a2dc9385cd59471fd57def0bb70d7d902b5ed.tar.bz2 |
i965: Drop a special case for guessing small miptree levels.
Let's say you started allocating your 2D texture with level 2 of a tree as
a 1x1 image. The driver doesn't know if this means that level 0 is 4x4 or
4x1 or 1x4, so we would just allocate a single 1x1 and let it get copied
in to the real location at texture validate time later.
Since this is just a temporary allocation that *will* get copied, the
extra space allocation of just taking the normal path which will happen to
producing a 4x1 level 0, 2x1 level 1, and 1x1 level 2 is the right way to
go, to reduce complexity in the normal case.
No change in miptree copies over the course of a piglit run.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_tex_image.c | 73 |
1 files changed, 30 insertions, 43 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c index f270862..725d315 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_image.c +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c @@ -45,50 +45,37 @@ intel_miptree_create_for_teximage(struct brw_context *brw, DBG("%s\n", __FUNCTION__); - if (intelImage->base.Base.Level > intelObj->base.BaseLevel && - (width == 1 || - (intelObj->base.Target != GL_TEXTURE_1D && height == 1) || - (intelObj->base.Target == GL_TEXTURE_3D && depth == 1))) { - /* For this combination, we're at some lower mipmap level and - * some important dimension is 1. We can't extrapolate up to a - * likely base level width/height/depth for a full mipmap stack - * from this info, so just allocate this one level. - */ - firstLevel = intelImage->base.Base.Level; - lastLevel = intelImage->base.Base.Level; - } else { - /* If this image disrespects BaseLevel, allocate from level zero. - * Usually BaseLevel == 0, so it's unlikely to happen. - */ - if (intelImage->base.Base.Level < intelObj->base.BaseLevel) - firstLevel = 0; - else - firstLevel = intelObj->base.BaseLevel; - - /* Figure out image dimensions at start level. */ - for (i = intelImage->base.Base.Level; i > firstLevel; i--) { - width <<= 1; - if (height != 1) - height <<= 1; - if (depth != 1) - depth <<= 1; - } + /* If this image disrespects BaseLevel, allocate from level zero. + * Usually BaseLevel == 0, so it's unlikely to happen. + */ + if (intelImage->base.Base.Level < intelObj->base.BaseLevel) + firstLevel = 0; + else + firstLevel = intelObj->base.BaseLevel; + + /* Figure out image dimensions at start level. */ + for (i = intelImage->base.Base.Level; i > firstLevel; i--) { + width <<= 1; + if (height != 1) + height <<= 1; + if (depth != 1) + depth <<= 1; + } - /* Guess a reasonable value for lastLevel. This is probably going - * to be wrong fairly often and might mean that we have to look at - * resizable buffers, or require that buffers implement lazy - * pagetable arrangements. - */ - if ((intelObj->base.Sampler.MinFilter == GL_NEAREST || - intelObj->base.Sampler.MinFilter == GL_LINEAR) && - intelImage->base.Base.Level == firstLevel && - firstLevel == 0) { - lastLevel = firstLevel; - } else { - lastLevel = (firstLevel + - _mesa_get_tex_max_num_levels(intelObj->base.Target, - width, height, depth) - 1); - } + /* Guess a reasonable value for lastLevel. This is probably going + * to be wrong fairly often and might mean that we have to look at + * resizable buffers, or require that buffers implement lazy + * pagetable arrangements. + */ + if ((intelObj->base.Sampler.MinFilter == GL_NEAREST || + intelObj->base.Sampler.MinFilter == GL_LINEAR) && + intelImage->base.Base.Level == firstLevel && + firstLevel == 0) { + lastLevel = firstLevel; + } else { + lastLevel = (firstLevel + + _mesa_get_tex_max_num_levels(intelObj->base.Target, + width, height, depth) - 1); } return intel_miptree_create(brw, |