r600g: allow vs to write to gl_ViewportIndex
authorIlia Mirkin <imirkin@alum.mit.edu>
Wed, 2 Jul 2014 16:16:01 +0000 (12:16 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 3 Jul 2014 23:39:25 +0000 (19:39 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Tobias Droste <tdroste@gmx.de>
src/gallium/drivers/r600/r600_shader.c

index 3767e5fbc185f1ad2e8cdc3a02aa7899b454bc41..448ca8044de8ed7a504775f6fde1dd37d70be588 100644 (file)
@@ -2042,6 +2042,23 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
                                        output[j].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS;
                                        pos_emitted = true;
                                        break;
+                               case TGSI_SEMANTIC_VIEWPORT_INDEX:
+                                       /* spi_sid is 0 for outputs that are
+                                        * not consumed by PS */
+                                       if (shader->output[i].spi_sid) {
+                                               output[j].array_base = next_param_base++;
+                                               output[j].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM;
+                                               j++;
+                                               memcpy(&output[j], &output[j-1], sizeof(struct r600_bytecode_output));
+                                       }
+                                       output[j].array_base = 61;
+                                       output[j].swizzle_x = 7;
+                                       output[j].swizzle_y = 7;
+                                       output[j].swizzle_z = 7;
+                                       output[j].swizzle_w = 0;
+                                       output[j].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS;
+                                       pos_emitted = true;
+                                       break;
                                case TGSI_SEMANTIC_CLIPVERTEX:
                                        j--;
                                        break;