nir: fix generated nir_intrinsics.c for MSVC
authorRob Clark <robdclark@gmail.com>
Tue, 27 Mar 2018 18:52:55 +0000 (14:52 -0400)
committerRob Clark <robdclark@gmail.com>
Tue, 27 Mar 2018 19:01:11 +0000 (15:01 -0400)
Apparently it is not happy about things like: .foo = {}

So skip over initializers for empty lists.

Fixes: 76dfed8ae2d5c6c509eb2661389be3c6a25077df
Reported-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/compiler/nir/nir_intrinsics_c.py

index 556db785c2b8e8a67be86489314db3b84fd2d272..339214ac53e38bdb37ca59e5005e30ca54d4f412 100644 (file)
@@ -29,18 +29,22 @@ const nir_intrinsic_info nir_intrinsic_infos[nir_num_intrinsics] = {
 {
    .name = "${name}",
    .num_srcs = ${opcode.num_srcs},
+% if opcode.src_components:
    .src_components = {
       ${", ".join(str(comp) for comp in opcode.src_components)}
    },
+% endif
    .has_dest = ${"true" if opcode.has_dest else "false"},
    .dest_components = ${opcode.dest_components},
    .num_variables = ${opcode.num_variables},
    .num_indices = ${opcode.num_indices},
+% if opcode.indices:
    .index_map = {
 % for i in range(len(opcode.indices)):
       [${opcode.indices[i]}] = ${i + 1},
 % endfor
     },
+% endif
    .flags = ${"0" if len(opcode.flags) == 0 else " | ".join(opcode.flags)},
 },
 % endfor