[Mesa-dev] [PATCH 4/5] r600g: allow vs to write to gl_ViewportIndex

Ilia Mirkin imirkin at alum.mit.edu
Wed Jul 2 13:30:55 PDT 2014


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Tested-by: Tobias Droste <tdroste at gmx.de>
---

In addition to the existing ARB_fragment_layer_viewport piglits passing and
the new AMD_vertex_shader_viewport_index piglit that is on the list passing,
Tobias did a regression comparison to an earlier run and found no regressions.

 src/gallium/drivers/r600/r600_shader.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 3767e5f..448ca80 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -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;
-- 
1.8.5.5



More information about the mesa-dev mailing list