[Mesa-dev] [Mesa-stable] [PATCH 3/3] i965: Fix component mask and varying_to_slot mapping for gl_ViewportIndex

Chris Forbes chrisf at ijw.co.nz
Mon Apr 14 18:59:19 PDT 2014


Are the streamout values allowed to be restricted to the ranges of the
vertex header fields, or do they have to reflect exactly what the
shader wrote?

(I ran into a similar issue with ARB_fragment_layer_viewport, and
while nothing has been done about it, the consensus was that the FS
had to see exactly what the previous stage wrote, and so a real slot
would be necessary)

On Tue, Apr 15, 2014 at 11:23 AM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> gl_ViewportIndex doesn't get its own varying slot. It is stored
> in VARYING_SLOT_PSIZ.z. This patch fixes the issue for both gen7
> and gen8 because gen7_upload_3dstate_so_decl_list() is shared
> between them.
>
> Fixes failures in OpenGL Khronos CTS test transform_feedback_builtins.
> Makes new piglit test glsl-1.50-transform-feedback-builtins pass for
> 'gl_ViewportIndex'.
>
> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/drivers/dri/i965/gen7_sol_state.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_sol_state.c b/src/mesa/drivers/dri/i965/gen7_sol_state.c
> index 3623238..8e554af 100644
> --- a/src/mesa/drivers/dri/i965/gen7_sol_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_sol_state.c
> @@ -123,6 +123,7 @@ gen7_upload_3dstate_so_decl_list(struct brw_context *brw,
>
>        /* gl_PointSize is stored in VARYING_SLOT_PSIZ.w
>         * gl_Layer is stored in VARYING_SLOT_PSIZ.y
> +       * gl_ViewportIndex is stored in VARYING_SLOT_PSIZ.z
>         */
>        if (varying == VARYING_SLOT_PSIZ) {
>           assert(components == 1);
> @@ -130,6 +131,9 @@ gen7_upload_3dstate_so_decl_list(struct brw_context *brw,
>        } else if (varying == VARYING_SLOT_LAYER) {
>           assert(components == 1);
>           component_mask <<= 1;
> +      } else if (varying == VARYING_SLOT_VIEWPORT) {
> +         assert(components == 1);
> +         component_mask <<= 2;
>        } else {
>           component_mask <<= linked_xfb_info->Outputs[i].ComponentOffset;
>        }
> @@ -137,7 +141,7 @@ gen7_upload_3dstate_so_decl_list(struct brw_context *brw,
>        buffer_mask |= 1 << buffer;
>
>        decl |= buffer << SO_DECL_OUTPUT_BUFFER_SLOT_SHIFT;
> -      if (varying == VARYING_SLOT_LAYER) {
> +      if (varying == VARYING_SLOT_LAYER || varying == VARYING_SLOT_VIEWPORT) {
>           decl |= vue_map->varying_to_slot[VARYING_SLOT_PSIZ] <<
>              SO_DECL_REGISTER_INDEX_SHIFT;
>        } else {
> --
> 1.8.3.1
>
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable


More information about the mesa-dev mailing list