i965/urb: fixes division by zero
[mesa.git] / src / mesa / drivers / dri / i965 / brw_eu.h
index a212f51b007b07089e403e142b162fc49bfe3db7..bea90f42f55a3d7de8da202c178ba0258ff48844 100644 (file)
@@ -546,16 +546,29 @@ next_offset(const struct brw_device_info *devinfo, void *store, int offset)
 }
 
 struct opcode_desc {
-   char    *name;
-   int      nsrc;
+   /* The union is an implementation detail used by brw_opcode_desc() to handle
+    * opcodes that have been reused for different instructions across hardware
+    * generations.
+    *
+    * The gens field acts as a tag. If it is non-zero, name points to a string
+    * containing the instruction mnemonic. If it is zero, the table field is
+    * valid and either points to a secondary opcode_desc table with 'size'
+    * elements or is NULL and no such instruction exists for the opcode.
+    */
+   union {
+      struct {
+         char    *name;
+         int      nsrc;
+      };
+      struct {
+         const struct opcode_desc *table;
+         unsigned size;
+      };
+   };
    int      ndst;
    int      gens;
 };
 
-extern const struct opcode_desc opcode_descs[128];
-
-int gen_from_devinfo(const struct brw_device_info *devinfo);
-
 const struct opcode_desc *
 brw_opcode_desc(const struct brw_device_info *devinfo, enum opcode opcode);