spirv: Handle instruction aliases in vtn_gather_types
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 22 Apr 2020 04:54:56 +0000 (21:54 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 24 Apr 2020 05:56:05 +0000 (05:56 +0000)
Same solution as done in spirv_info generation.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4682>

src/compiler/spirv/vtn_gather_types_c.py

index 7b42e95cc35d4a44e0ba07538a36f64a9f46b3bf..d30a91d2b7a41271ddcd02ea80f8582e2d03021b 100644 (file)
@@ -29,7 +29,13 @@ from sys import stdout
 from mako.template import Template
 
 def find_result_types(spirv):
+    seen = set()
     for inst in spirv['instructions']:
+        # Handle aliases by choosing the first one in the grammar.
+        if inst['opcode'] in seen:
+            continue
+        seen.add(inst['opcode'])
+
         name = inst['opname']
 
         if 'operands' not in inst: