+
+
+/* Map name/sid pair from tgsi to the 8-bit semantic index for SPI setup */
+static int r600_spi_sid(struct r600_shader_io * io)
+{
+ int index, name = io->name;
+
+ /* These params are handled differently, they don't need
+ * semantic indices, so we'll use 0 for them.
+ */
+ if (name == TGSI_SEMANTIC_POSITION ||
+ name == TGSI_SEMANTIC_PSIZE ||
+ name == TGSI_SEMANTIC_FACE)
+ index = 0;
+ else {
+ if (name == TGSI_SEMANTIC_GENERIC) {
+ /* For generic params simply use sid from tgsi */
+ index = io->sid;
+ } else {
+
+ /* FIXME: two-side rendering is broken in r600g, this will
+ * keep old functionality */
+ if (name == TGSI_SEMANTIC_BCOLOR)
+ name = TGSI_SEMANTIC_COLOR;
+
+ /* For non-generic params - pack name and sid into 8 bits */
+ index = 0x80 | (name<<3) | (io->sid);
+ }
+
+ /* Make sure that all really used indices have nonzero value, so
+ * we can just compare it to 0 later instead of comparing the name
+ * with different values to detect special cases. */
+ index++;
+ }
+
+ return index;
+};
+