[Mesa-dev] [PATCH 16/92] st/nir: make nir_lower_tex configurable
Rob Clark
robdclark at gmail.com
Mon Jun 26 19:09:54 UTC 2017
So the solution to this so far has been to call this both from driver
and from mesa/st. (The mesa/st call to nir_lower_tex is only in the
rare case of gles + yuv EGLImageExternal (ie. basically a hack because
android expects YUV texture support. So I guess not worth optimizing
for.)
BR,
-R
On Mon, Jun 26, 2017 at 10:09 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
> src/mesa/state_tracker/st_program.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
> index eb44fc5..a3b8bbf 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -1072,22 +1072,31 @@ st_create_fp_variant(struct st_context *st,
> sizeof(options.bias_state_tokens));
> }
>
> _mesa_add_state_reference(params, texcoord_state);
> memcpy(options.texcoord_state_tokens, texcoord_state,
> sizeof(options.texcoord_state_tokens));
>
> NIR_PASS_V(tgsi.ir.nir, nir_lower_drawpixels, &options);
> }
>
> - if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
> - nir_lower_tex_options options = {0};
> + const nir_lower_tex_options *screen_lower_tex_options =
> + st->pipe->screen->get_struct_param(st->pipe->screen,
> + PIPE_STRUCT_CAP_NIR_LOWER_TEX_OPTIONS);
> +
> + if (screen_lower_tex_options ||
> + unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
> + nir_lower_tex_options options;
> + if (screen_lower_tex_options)
> + memcpy(&options, screen_lower_tex_options, sizeof(options));
> + else
> + memset(&options, 0, sizeof(options));
> options.lower_y_uv_external = key->external.lower_nv12;
> options.lower_y_u_v_external = key->external.lower_iyuv;
> NIR_PASS_V(tgsi.ir.nir, nir_lower_tex, &options);
> }
>
> st_finalize_nir(st, &stfp->Base, tgsi.ir.nir);
>
> if (unlikely(key->external.lower_nv12 || key->external.lower_iyuv)) {
> /* This pass needs to happen *after* nir_lower_sampler */
> NIR_PASS_V(tgsi.ir.nir, st_nir_lower_tex_src_plane,
> --
> 2.9.3
>
> _______________________________________________
> 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