From: Brian Paul Date: Thu, 25 May 2017 18:45:01 +0000 (-0600) Subject: svga: restructure nested if's in emit_src_register() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d806b6f13a7a6abeb9a411ef72f9118e32790ea;p=mesa.git svga: restructure nested if's in emit_src_register() To make it cleaner for subsequent changes. Reviewed-by: Charmaine Lee --- diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index 5f5adf13506..fe24caa62eb 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -985,30 +985,32 @@ emit_src_register(struct svga_shader_emitter_v10 *emit, VGPU10OperandToken0 operand0; VGPU10OperandToken1 operand1; - if (emit->unit == PIPE_SHADER_FRAGMENT && - file == TGSI_FILE_INPUT) { - if (index == emit->fs.face_input_index) { - /* Replace INPUT[FACE] with TEMP[FACE] */ - file = TGSI_FILE_TEMPORARY; - index = emit->fs.face_tmp_index; - } - else if (index == emit->fs.fragcoord_input_index) { - /* Replace INPUT[POSITION] with TEMP[POSITION] */ - file = TGSI_FILE_TEMPORARY; - index = emit->fs.fragcoord_tmp_index; + if (emit->unit == PIPE_SHADER_FRAGMENT){ + if (file == TGSI_FILE_INPUT) { + if (index == emit->fs.face_input_index) { + /* Replace INPUT[FACE] with TEMP[FACE] */ + file = TGSI_FILE_TEMPORARY; + index = emit->fs.face_tmp_index; + } + else if (index == emit->fs.fragcoord_input_index) { + /* Replace INPUT[POSITION] with TEMP[POSITION] */ + file = TGSI_FILE_TEMPORARY; + index = emit->fs.fragcoord_tmp_index; + } + else { + /* We remap fragment shader inputs to that FS input indexes + * match up with VS/GS output indexes. + */ + index = emit->linkage.input_map[index]; + } } - else { - /* We remap fragment shader inputs to that FS input indexes - * match up with VS/GS output indexes. - */ + } + else if (emit->unit == PIPE_SHADER_GEOMETRY) { + if (file == TGSI_FILE_INPUT) { + is_prim_id = (index == emit->gs.prim_id_index); index = emit->linkage.input_map[index]; } } - else if (emit->unit == PIPE_SHADER_GEOMETRY && - file == TGSI_FILE_INPUT) { - is_prim_id = (index == emit->gs.prim_id_index); - index = emit->linkage.input_map[index]; - } else if (emit->unit == PIPE_SHADER_VERTEX) { if (file == TGSI_FILE_INPUT) { /* if input is adjusted... */