From d777c040958f3881d065123b73a7abcf422809a7 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 6 May 2020 23:59:34 +0200 Subject: [PATCH] r600/sfn: Add support for viewport index output Signed-off-by: Gert Wollny Reviewed-by: Reviewed-by: Dave Airlie Part-of: --- .../drivers/r600/sfn/sfn_shader_geometry.cpp | 5 +++++ .../drivers/r600/sfn/sfn_vertexstageexport.cpp | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp index 2edc86ff361..f9993c34120 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader_geometry.cpp @@ -137,6 +137,11 @@ bool GeometryShaderFromNir::do_process_outputs(nir_variable *output) output->data.location == VARYING_SLOT_CLIP_DIST1) { m_num_clip_dist += 4; } + + if (output->data.location == VARYING_SLOT_VIEWPORT) { + sh_info().vs_out_viewport = 1; + sh_info().vs_out_misc_write = 1; + } return true; } return false; diff --git a/src/gallium/drivers/r600/sfn/sfn_vertexstageexport.cpp b/src/gallium/drivers/r600/sfn/sfn_vertexstageexport.cpp index 3de3418c7a4..f7ce29a1a98 100644 --- a/src/gallium/drivers/r600/sfn/sfn_vertexstageexport.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_vertexstageexport.cpp @@ -81,7 +81,7 @@ bool VertexStageExportBase::do_process_outputs(nir_variable *output) if (output->data.location == VARYING_SLOT_PSIZ || output->data.location == VARYING_SLOT_EDGE || - output->data.location == VARYING_SLOT_LAYER) + output->data.location == VARYING_SLOT_LAYER) // VIEWPORT? m_cur_clip_pos = 2; if (output->data.location != VARYING_SLOT_POS && @@ -110,6 +110,11 @@ bool VertexStageExportForFS::store_deref(const nir_variable *out_var, nir_intrin std::array swizzle_override = {7 ,0, 7, 7}; return emit_varying_pos(out_var, instr, &swizzle_override); } + case VARYING_SLOT_VIEWPORT: { + std::array swizzle_override = {7, 7, 7, 0}; + return emit_varying_pos(out_var, instr, &swizzle_override) && + emit_varying_param(out_var, instr); + } case VARYING_SLOT_CLIP_VERTEX: return emit_clip_vertices(out_var, instr); case VARYING_SLOT_CLIP_DIST0: @@ -177,6 +182,11 @@ bool VertexStageExportForFS::emit_varying_pos(const nir_variable *out_var, nir_i case VARYING_SLOT_LAYER: export_slot = 1; break; + case VARYING_SLOT_VIEWPORT: + m_proc.sh_info().vs_out_misc_write = 1; + m_proc.sh_info().vs_out_viewport = 1; + export_slot = 1; + break; case VARYING_SLOT_POS: break; case VARYING_SLOT_CLIP_DIST0: @@ -407,8 +417,11 @@ bool VertexStageExportForGS::store_deref(const nir_variable *out_var, nir_intrin } } - if (out_var->data.location == VARYING_SLOT_VIEWPORT) + if (out_var->data.location == VARYING_SLOT_VIEWPORT) { + m_proc.sh_info().vs_out_viewport = 1; + m_proc.sh_info().vs_out_misc_write = 1; return true; + } if (ring_offset == -1) { sfn_log << SfnLog::err << "VS defines output at " -- 2.30.2