[Mesa-dev] [Mesa-stable] [PATCH] meta blit: Set Z texcoord during meta blit to sample the right layer

Anuj Phogat anuj.phogat at gmail.com
Wed May 21 19:21:52 PDT 2014


On Wed, May 21, 2014 at 4:18 PM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> If the source renderbuffer has a depth > 0, then send a Z texcoord
> which is set to the source attachment Z index.
>
> This fixes piglit's gl-3.2-layered-rendering-gl-layer-render with the
> GL_TEXTURE_2D_MULTISAMPLE_ARRAY case test on i965/gen8.
>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> Cc: "10.2" <mesa-stable at lists.freedesktop.org>
> ---
>
> No piglit regressions on BDW, but glean was not tested (gbm).
>
>  src/mesa/drivers/common/meta_blit.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
> index e10a181..753afff 100644
> --- a/src/mesa/drivers/common/meta_blit.c
> +++ b/src/mesa/drivers/common/meta_blit.c
> @@ -328,7 +328,10 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx,
>     /* target = GL_TEXTURE_RECTANGLE is not supported in GLES 3.0 */
>     assert(_mesa_is_desktop_gl(ctx) || target == GL_TEXTURE_2D);
>
> -   _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true, 2, 2, 0);
> +   unsigned texcoord_size = 2 + (src_rb->Depth > 1 ? 1 : 0);
> +
> +   _mesa_meta_setup_vertex_objects(&blit->VAO, &blit->VBO, true,
> +                                   2, texcoord_size, 0);
>
>     if (target == GL_TEXTURE_2D_MULTISAMPLE ||
>         target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
> @@ -533,12 +536,16 @@ blitframebuffer_texture(struct gl_context *ctx,
>
>        verts[0].tex[0] = s0;
>        verts[0].tex[1] = t0;
> +      verts[0].tex[2] = readAtt->Zoffset;
>        verts[1].tex[0] = s1;
>        verts[1].tex[1] = t0;
> +      verts[1].tex[2] = readAtt->Zoffset;
>        verts[2].tex[0] = s1;
>        verts[2].tex[1] = t1;
> +      verts[2].tex[2] = readAtt->Zoffset;
>        verts[3].tex[0] = s0;
>        verts[3].tex[1] = t1;
> +      verts[3].tex[2] = readAtt->Zoffset;
>
>        _mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
>     }
> --
> 1.9.1
>
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable

Looks good to me. Tested the fix on IVB by forcing the driver to use
meta blit path.
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list