[Mesa-dev] [PATCH 1/2] nvc0/ir: Export viewport index in fragment shaders
Ilia Mirkin
imirkin at alum.mit.edu
Wed Apr 19 21:50:39 UTC 2017
On Wed, Apr 19, 2017 at 5:10 PM, Lyude <lyude at redhat.com> wrote:
> Since ABR_vertex_shader_layer/viewport_index enables the ability to
> interact with gl_ViewportIndex from the fragment shader, we don't want
> to skip emitting the viewport index for fragment shaders.
>
> As well, only save the viewport index into a scratch register for
> Geometry shaders, since EMIT is not a thing elsewhere.
>
> Signed-off-by: Lyude <lyude at redhat.com>
> ---
> .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 22 ++++++++++------------
> 1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> index 92cc13d..5af0ac5 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> @@ -2150,18 +2150,16 @@ Converter::storeDst(const tgsi::Instruction::DstRegister dst, int c,
> assert(!ptr);
> mkOp2(OP_WRSV, TYPE_U32, NULL, dstToSym(dst, c), val);
> } else
> - if (f == TGSI_FILE_OUTPUT && prog->getType() != Program::TYPE_FRAGMENT) {
> -
> - if (ptr || (info->out[idx].mask & (1 << c))) {
> - /* Save the viewport index into a scratch register so that it can be
> - exported at EMIT time */
> - if (info->out[idx].sn == TGSI_SEMANTIC_VIEWPORT_INDEX &&
> - viewport != NULL)
> - mkOp1(OP_MOV, TYPE_U32, viewport, val);
> - else
> - mkStore(OP_EXPORT, TYPE_U32, dstToSym(dst, c), ptr, val)->perPatch =
> - info->out[idx].patch;
> - }
> + if (f == TGSI_FILE_OUTPUT && (ptr || (info->out[idx].mask & (1 << c)))) {
This actually still needs to prog->getType() !=
Program::TYPE_FRAGMENT. Sorry. The original condition was correct.
> + /* Save the viewport index into a scratch register so that it can be
> + exported at EMIT time */
> + if (prog->getType() == Program::TYPE_GEOMETRY &&
And that's what was missing before. So I think just adding that to the
existing code would solve the issue quite nicely.
> + info->out[idx].sn == TGSI_SEMANTIC_VIEWPORT_INDEX &&
> + viewport != NULL)
> + mkOp1(OP_MOV, TYPE_U32, viewport, val);
> + else
> + mkStore(OP_EXPORT, TYPE_U32, dstToSym(dst, c), ptr, val)->perPatch =
> + info->out[idx].patch;
> } else
> if (f == TGSI_FILE_TEMPORARY ||
> f == TGSI_FILE_ADDRESS ||
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list