[Mesa-dev] [PATCH] i965: consider a 'base level' when calculating width0, height0, depth0
Rafael Antognolli
rafael.antognolli at intel.com
Mon Oct 8 20:46:21 UTC 2018
On Tue, Oct 02, 2018 at 07:16:01PM +0300, asimiklit.work at gmail.com wrote:
> From: Andrii Simiklit <andrii.simiklit at globallogic.com>
>
> I guess that when we calculating the width0, height0, depth0
> to use for function 'intel_miptree_create' we need to consider
> the 'base level' like it is done in the 'intel_miptree_create_for_teximage'
> function.
Hi Andrii, this makes sense to me. I'm also not familiar with this code,
so I'm not sure this is the right way to solve the issue, but at least
it's a way.
You added a simple test case in the bug, do you think you could make
that a piglit test?
Thanks,
Rafael
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
> ---
> .../drivers/dri/i965/intel_tex_validate.c | 26 ++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c b/src/mesa/drivers/dri/i965/intel_tex_validate.c
> index 72ce83c7ce..37aa8f43ec 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_validate.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c
> @@ -119,8 +119,32 @@ intel_finalize_mipmap_tree(struct brw_context *brw,
> /* May need to create a new tree:
> */
> if (!intelObj->mt) {
> + const unsigned level = firstImage->base.Base.Level;
> intel_get_image_dims(&firstImage->base.Base, &width, &height, &depth);
> -
> + /* Figure out image dimensions at start level. */
> + switch(intelObj->base.Target) {
> + case GL_TEXTURE_2D_MULTISAMPLE:
> + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> + case GL_TEXTURE_RECTANGLE:
> + case GL_TEXTURE_EXTERNAL_OES:
> + assert(level == 0);
> + break;
> + case GL_TEXTURE_3D:
> + depth = depth << level;
> + /* Fall through */
> + case GL_TEXTURE_2D:
> + case GL_TEXTURE_2D_ARRAY:
> + case GL_TEXTURE_CUBE_MAP:
> + case GL_TEXTURE_CUBE_MAP_ARRAY:
> + height = height << level;
> + /* Fall through */
> + case GL_TEXTURE_1D:
> + case GL_TEXTURE_1D_ARRAY:
> + width = width << level;
> + break;
> + default:
> + unreachable("Unexpected target");
> + }
> perf_debug("Creating new %s %dx%dx%d %d-level miptree to handle "
> "finalized texture miptree.\n",
> _mesa_get_format_name(firstImage->base.Base.TexFormat),
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list