[Mesa-dev] [PATCH RFC 1/2] nir/lower_tex: Actually report when projector lowering happened
Jason Ekstrand
jason at jlekstrand.net
Mon Jun 17 15:54:58 UTC 2019
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On Mon, Jun 17, 2019 at 5:21 AM Boris Brezillon <
boris.brezillon at collabora.com> wrote:
> The code considers that projector lowering was done even if it's not
> really the case. Change the project_src() prototype to return a bool
> encoding whether projector lowering happened or not and update the
> progress var accordingly in nir_lower_tex_block().
>
> This prevents an infinite loop when doing:
>
> do progress = nir_lower_tex(); while (progress);
>
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
> src/compiler/nir/nir_lower_tex.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/nir/nir_lower_tex.c
> b/src/compiler/nir/nir_lower_tex.c
> index c29581d9b048..73b26dbdb238 100644
> --- a/src/compiler/nir/nir_lower_tex.c
> +++ b/src/compiler/nir/nir_lower_tex.c
> @@ -39,13 +39,13 @@
> #include "nir_builder.h"
> #include "nir_format_convert.h"
>
> -static void
> +static bool
> project_src(nir_builder *b, nir_tex_instr *tex)
> {
> /* Find the projector in the srcs list, if present. */
> int proj_index = nir_tex_instr_src_index(tex, nir_tex_src_projector);
> if (proj_index < 0)
> - return;
> + return false;
>
> b->cursor = nir_before_instr(&tex->instr);
>
> @@ -100,6 +100,7 @@ project_src(nir_builder *b, nir_tex_instr *tex)
> }
>
> nir_tex_instr_remove_src(tex, proj_index);
> + return true;
> }
>
> static nir_ssa_def *
> @@ -1049,8 +1050,7 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
> * as clamping happens *after* projection:
> */
> if (lower_txp || sat_mask) {
> - project_src(b, tex);
> - progress = true;
> + progress |= project_src(b, tex);
> }
>
> if ((tex->op == nir_texop_txf && options->lower_txf_offset) ||
> --
> 2.20.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190617/5564de5a/attachment-0001.html>
More information about the mesa-dev
mailing list