On Tue, Jun 24, 2014 at 8:43 PM, Ilia Mirkin <imir...@alum.mit.edu> wrote: > In order to support ARB_fragment_layer_viewport, we need to explicitly > send these along to the fragment shader, since it has no other way to > retrieve them. > > Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu> > Tested-by: Tobias Droste <tdro...@gmx.de> > --- > > v1 -> v2: > > - Add forgotten copy to initialize new output with the settings of the > previous one for vertex layer > > Tobias was able to test this version with the vertex shader setting the layer > as well. (And it passed. The first version crashed his box.) > > I would like to reiterate my disclaimers from the v1 commit... I don't know > much about r600, don't have the hw, and was just going on the advice of Alex > Deucher and Jerome Glisse. I largely copied how clipvertex was handled.
This looks good to me. Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> > > It's unclear to me whether these outputs will be eliminated in the > (overwhelmingly common) case where the fragment shader does not actually > consume them, but I was told they would be. > > src/gallium/drivers/r600/r600_shader.c | 22 ++++++++++++++++++++-- > 1 file changed, 20 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/drivers/r600/r600_shader.c > b/src/gallium/drivers/r600/r600_shader.c > index b3d1998..3767e5f 100644 > --- a/src/gallium/drivers/r600/r600_shader.c > +++ b/src/gallium/drivers/r600/r600_shader.c > @@ -498,8 +498,6 @@ static int r600_spi_sid(struct r600_shader_io * io) > if (name == TGSI_SEMANTIC_POSITION || > name == TGSI_SEMANTIC_PSIZE || > name == TGSI_SEMANTIC_EDGEFLAG || > - name == TGSI_SEMANTIC_LAYER || > - name == TGSI_SEMANTIC_VIEWPORT_INDEX || > name == TGSI_SEMANTIC_FACE) > index = 0; > else { > @@ -1337,6 +1335,12 @@ static int generate_gs_copy_shader(struct r600_context > *rctx, > ctx.shader->vs_out_point_size = 1; > break; > case TGSI_SEMANTIC_LAYER: > + if (out->spi_sid) { > + /* duplicate it as PARAM to pass to the pixel > shader */ > + output.array_base = next_param++; > + r600_bytecode_add_output(ctx.bc, &output); > + last_exp_param = ctx.bc->cf_last; > + } > output.array_base = 61; > if (next_clip_pos == 61) > next_clip_pos = 62; > @@ -1349,6 +1353,12 @@ static int generate_gs_copy_shader(struct r600_context > *rctx, > ctx.shader->vs_out_layer = 1; > break; > case TGSI_SEMANTIC_VIEWPORT_INDEX: > + if (out->spi_sid) { > + /* duplicate it as PARAM to pass to the pixel > shader */ > + output.array_base = next_param++; > + r600_bytecode_add_output(ctx.bc, &output); > + last_exp_param = ctx.bc->cf_last; > + } > output.array_base = 61; > if (next_clip_pos == 61) > next_clip_pos = 62; > @@ -2016,6 +2026,14 @@ static int r600_shader_from_tgsi(struct r600_context > *rctx, > pos_emitted = true; > break; > case TGSI_SEMANTIC_LAYER: > + /* 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; > -- > 1.8.5.5 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev