[virglrenderer-devel] [PATCH] vrend_clear: clear and restore rasterizer discard and depth clamp
Gurchetan Singh
gurchetansingh at chromium.org
Tue May 8 18:35:59 UTC 2018
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
On Tue, May 8, 2018 at 3:47 AM, Gert Wollny <gert.wollny at collabora.com> wrote:
> vrend_clear is passed in from gallium clear which, unlike glClear, must
> not obey rasterizer discard and depth_clmap. However, the guest doesn't
> foreard the latest update of the rendering states to the host before issuing
> "clear". Therefore, the host clear command must clear these states before
> calling glClear in turn. After calling glClear these states are again brought
> into sync with what the host assumes.
>
> Fixes CTS:
> dEQP-GLES3.functional.rasterizer_discard.fbo.*
>
> Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> ---
> src/vrend_renderer.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index ac9723c..34fa32b 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -2486,6 +2486,8 @@ void vrend_clear(struct vrend_context *ctx,
> } else {
> glClearDepth(depth);
> }
> + if (!ctx->sub->hw_rs_state.depth_clip)
> + glDisable(GL_DEPTH_CLAMP);
> }
>
> if (buffers & PIPE_CLEAR_STENCIL) {
> @@ -2493,6 +2495,9 @@ void vrend_clear(struct vrend_context *ctx,
> glClearStencil(stencil);
> }
>
> + if (ctx->sub->hw_rs_state.rasterizer_discard)
> + glDisable(GL_RASTERIZER_DISCARD);
> +
> if (buffers & PIPE_CLEAR_COLOR) {
> uint32_t mask = 0;
> int i;
> @@ -2526,9 +2531,19 @@ void vrend_clear(struct vrend_context *ctx,
> if (bits)
> glClear(bits);
>
> - if (buffers & PIPE_CLEAR_DEPTH)
> + /* Is it really necessary to restore the old states? The only reason we
> + * get here is because the guest cleared all those states but gallium
> + * didn't forward them before calling the clear command
> + */
> + if (ctx->sub->hw_rs_state.rasterizer_discard)
> + glEnable(GL_RASTERIZER_DISCARD);
> +
> + if (buffers & PIPE_CLEAR_DEPTH) {
> if (!ctx->sub->dsa_state.depth.writemask)
> glDepthMask(GL_FALSE);
> + if (!ctx->sub->hw_rs_state.depth_clip)
> + glEnable(GL_DEPTH_CLAMP);
> + }
>
> /* Restore previous stencil buffer write masks for both front and back faces */
> if (buffers & PIPE_CLEAR_STENCIL) {
> --
> 2.16.1
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
More information about the virglrenderer-devel
mailing list