nir/inline_uniforms: support loop
authorQiang Yu <yuq825@gmail.com>
Mon, 19 Jul 2021 06:25:36 +0000 (14:25 +0800)
committerMarge Bot <eric+marge@anholt.net>
Thu, 19 Aug 2021 02:17:35 +0000 (02:17 +0000)
commite6790d4a31ad16490e574d200b1ca4fd38debd28
tree3c77844c3f03389e8256c149cb5d9d505db7de88
parent3c93ebbae58e3e3f5b1ab716a801eb9dfb26fbff
nir/inline_uniforms: support loop

Be able to inline uniforms in loop for unrolling it.
Nested loop/if is also supported.

Some example:

    for (i = 0; i < count; i++)
...

uniform "count" will be inlined. But note this does not
make sure the loop will be unrolled (ie. count = 1000).

    for (i = 0; i < count; i++)
        for (j = init; j < 10; j++)
            if (type == 2)
                ...

uniform "count", "init" and "type" will be inlined.

It is intentional to not be too aggressive to add uniforms
to avoid false positive case while be able to support most
common usage.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11950>
src/compiler/nir/nir_inline_uniforms.c