[Mesa-dev] mesa: set _NEW_BUFFERS when updating texture bound to current buffers

Submitted by Ilia Mirkin on July 8, 2016, 6:24 p.m.

Details

Message ID 1468002278-13108-1-git-send-email-imirkin@alum.mit.edu
State New, archived
Headers show
Series "mesa: set _NEW_BUFFERS when updating texture bound to current buffers" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Ilia Mirkin July 8, 2016, 6:24 p.m.
When a glTexImage call updates the parameters of a currently bound
framebuffer, we might miss out on revalidating whether it is complete.
Make sure to set _NEW_BUFFERS which will trigger the revalidation in
that case.

Also while we're at it, fix the fb parameter passed in to the eventual
RenderTexture call.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94148
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
---
 src/mesa/main/teximage.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 26a6c21..a97815f 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2605,10 +2605,16 @@  check_rtt_cb(GLuint key, void *data, void *userData)
              att->Texture == texObj &&
              att->TextureLevel == level &&
              att->CubeMapFace == face) {
-            _mesa_update_texture_renderbuffer(ctx, ctx->DrawBuffer, att);
+            _mesa_update_texture_renderbuffer(ctx, fb, att);
             assert(att->Renderbuffer->TexImage);
             /* Mark fb status as indeterminate to force re-validation */
             fb->_Status = 0;
+
+            /* Make sure that the revalidation actually happens if this is
+             * being done to currently-bound buffers.
+             */
+            if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer)
+               ctx->NewState |= _NEW_BUFFERS;
          }
       }
    }

Comments

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Fri, Jul 8, 2016 at 8:24 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> When a glTexImage call updates the parameters of a currently bound
> framebuffer, we might miss out on revalidating whether it is complete.
> Make sure to set _NEW_BUFFERS which will trigger the revalidation in
> that case.
>
> Also while we're at it, fix the fb parameter passed in to the eventual
> RenderTexture call.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94148
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
> ---
>  src/mesa/main/teximage.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 26a6c21..a97815f 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -2605,10 +2605,16 @@ check_rtt_cb(GLuint key, void *data, void *userData)
>               att->Texture == texObj &&
>               att->TextureLevel == level &&
>               att->CubeMapFace == face) {
> -            _mesa_update_texture_renderbuffer(ctx, ctx->DrawBuffer, att);
> +            _mesa_update_texture_renderbuffer(ctx, fb, att);
>              assert(att->Renderbuffer->TexImage);
>              /* Mark fb status as indeterminate to force re-validation */
>              fb->_Status = 0;
> +
> +            /* Make sure that the revalidation actually happens if this is
> +             * being done to currently-bound buffers.
> +             */
> +            if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer)
> +               ctx->NewState |= _NEW_BUFFERS;
>           }
>        }
>     }
> --
> 2.7.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
On Fri, Jul 08, 2016 at 02:24:38PM -0400, Ilia Mirkin wrote:
> When a glTexImage call updates the parameters of a currently bound
> framebuffer, we might miss out on revalidating whether it is complete.
> Make sure to set _NEW_BUFFERS which will trigger the revalidation in
> that case.
> 
> Also while we're at it, fix the fb parameter passed in to the eventual
> RenderTexture call.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94148
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>

I confirm this fixes the issue Citra was experiencing on i965 before we
decided to check for completeness after every fbo change.

Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>

> Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
> ---
>  src/mesa/main/teximage.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 26a6c21..a97815f 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -2605,10 +2605,16 @@ check_rtt_cb(GLuint key, void *data, void *userData)
>               att->Texture == texObj &&
>               att->TextureLevel == level &&
>               att->CubeMapFace == face) {
> -            _mesa_update_texture_renderbuffer(ctx, ctx->DrawBuffer, att);
> +            _mesa_update_texture_renderbuffer(ctx, fb, att);
>              assert(att->Renderbuffer->TexImage);
>              /* Mark fb status as indeterminate to force re-validation */
>              fb->_Status = 0;
> +
> +            /* Make sure that the revalidation actually happens if this is
> +             * being done to currently-bound buffers.
> +             */
> +            if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer)
> +               ctx->NewState |= _NEW_BUFFERS;
>           }
>        }
>     }
> -- 
> 2.7.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev