nir: Add positional argument specifiers.
authorVinson Lee <vlee@freedesktop.org>
Fri, 17 Mar 2017 23:21:38 +0000 (16:21 -0700)
committerVinson Lee <vlee@dropbox.com>
Tue, 21 Mar 2017 20:38:00 +0000 (13:38 -0700)
Fix build with Python < 2.7.

  File "src/compiler/nir/nir_builder_opcodes_h.py", line 46, in <module>
    from nir_opcodes import opcodes
  File "src/compiler/nir/nir_opcodes.py", line 178, in <module>
    unop_convert("{}2{}{}".format(src_t[0], dst_t[0], bit_size),
ValueError: zero length field name in format

Fixes: 762a6333f21f ("nir: Rework conversion opcodes")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
src/compiler/nir/nir_opcodes.py
src/compiler/nir/nir_opcodes_c.py

index 52868d5f5a4397247224a5ed9ec7b1d1dab44965..98692da7be6f6ad30e0895c239144cfd88246444 100644 (file)
@@ -175,7 +175,7 @@ for src_t in [tint, tuint, tfloat]:
 
    for dst_t in dst_types:
       for bit_size in [32, 64]:
-         unop_convert("{}2{}{}".format(src_t[0], dst_t[0], bit_size),
+         unop_convert("{0}2{1}{2}".format(src_t[0], dst_t[0], bit_size),
                       dst_t + str(bit_size), src_t, "src0")
 
 # We'll hand-code the to/from bool conversion opcodes.  Because bool doesn't
index c66f3bc7ad4143d4908fe96e2507b288731410d2..a1db54f05a8228ec1f4b71e7cbd1d2a761868952 100644 (file)
@@ -64,7 +64,7 @@ nir_type_conversion_op(nir_alu_type src, nir_alu_type dst)
                switch (dst_bit_size) {
 %                 for dst_bits in [32, 64]:
                   case ${dst_bits}:
-                     return ${'nir_op_{}2{}{}'.format(src_t[0], dst_t[0], dst_bits)};
+                     return ${'nir_op_{0}2{1}{2}'.format(src_t[0], dst_t[0], dst_bits)};
 %                 endfor
                   default:
                      unreachable("Invalid nir alu bit size");