[Mesa-dev] [PATCH 1/3] gallium/st: add pipe_context::generate_mipmap()
Axel Davy
axel.davy at ens.fr
Mon Jan 11 23:59:29 PST 2016
On 12/01/2016 07:18, Charmaine Lee wrote:
> --- a/src/mesa/state_tracker/st_gen_mipmap.c
> +++ b/src/mesa/state_tracker/st_gen_mipmap.c
> @@ -149,12 +149,19 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
> last_layer = util_max_layer(pt, baseLevel);
> }
>
> - /* Try to generate the mipmap by rendering/texturing. If that fails,
> - * use the software fallback.
> + /* First see if the driver supports hardware mipmap generation,
> + * if not then generate the mipmap by rendering/texturing.
> + * If that fails, use the software fallback.
> */
> - if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
> - first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
> - _mesa_generate_mipmap(ctx, target, texObj);
> + if (!st->pipe->screen->get_param(st->pipe->screen,
> + PIPE_CAP_GENERATE_MIPMAP) ||
> + !st->pipe->generate_mipmap(st->pipe, pt, baseLevel, lastLevel,
> + first_layer, last_layer)) {
> +
> + if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
> + first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
> + _mesa_generate_mipmap(ctx, target, texObj);
> + }
> }
>
> /* Fill in the Mesa gl_texture_image fields */
I think it would be better if instead of checking the cap there, we'd
just call util_gen_mipmap, and there it would check the cap, and call
generate_mipmap or fallback to the current implementation of
util_gen_mipmap.
Axel
More information about the mesa-dev
mailing list