[Mesa-dev] [PATCH 1/2] nir/opcodes: Simplify and fix the unpack_half_*_split_* constant expressions

Connor Abbott cwabbott0 at gmail.com
Mon Jan 26 11:19:53 PST 2015


Indeed, I guess I misunderstood the purpose of this opcode when I was
writing the constant expression. I see now that it's supposed to be
used for scalarizing unpack_half_2x16. Goes to show how useful this
self-documenting stuff is, I guess.

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

On Mon, Jan 26, 2015 at 12:43 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> Previously, these functions were explicitly writing to dst.x and dst.y.
> However they both return only one component so writing to dst.y is invalid.
> Also, since they only return one component, we don't need the explicit
> assignment in the expression and can simplify it use an implicit
> assignment.
> ---
>  src/glsl/nir/nir_opcodes.py | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/src/glsl/nir/nir_opcodes.py b/src/glsl/nir/nir_opcodes.py
> index 5fe9572..0fa8bf5 100644
> --- a/src/glsl/nir/nir_opcodes.py
> +++ b/src/glsl/nir/nir_opcodes.py
> @@ -252,12 +252,10 @@ unpack_2x16("half")
>  # Lowered floating point unpacking operations.
>
>
> -unop_horiz("unpack_half_2x16_split_x", 1, tfloat, 1, tunsigned, """
> -dst.x = unpack_half_1x16((uint16_t)(src0.x & 0xffff));
> -""")
> -unop_horiz("unpack_half_2x16_split_y", 1, tfloat, 1, tunsigned, """
> -dst.y = unpack_half_1x16((uint16_t)(src0.x >> 16));
> -""")
> +unop_horiz("unpack_half_2x16_split_x", 1, tfloat, 1, tunsigned,
> +           "unpack_half_1x16((uint16_t)(src0.x & 0xffff))")
> +unop_horiz("unpack_half_2x16_split_y", 1, tfloat, 1, tunsigned,
> +           "unpack_half_1x16((uint16_t)(src0.x >> 16))")
>
>
>  # Bit operations, part of ARB_gpu_shader5.
> --
> 2.2.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list