From 02c9bf2d54cc166882a10a5b54b14dda832b4ecd Mon Sep 17 00:00:00 2001 From: Charmaine Lee Date: Wed, 22 Mar 2017 10:46:54 -0700 Subject: [PATCH] svga: add the has_backed_views flag The new has_backed_views flag specifies if any of the render target views or depth stencil view is a backing surface view. The flag is used in svga_propagate_rendertargets() so it can return early if there is no surface to propagate. Reviewed-by: Brian Paul --- src/gallium/drivers/svga/svga_context.h | 1 + src/gallium/drivers/svga/svga_state_framebuffer.c | 6 ++++++ src/gallium/drivers/svga/svga_surface.c | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 2b95a787870..3789a46bf50 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -401,6 +401,7 @@ struct svga_hw_draw_state unsigned default_constbuf_size[PIPE_SHADER_TYPES]; boolean rasterizer_discard; /* set if rasterization is disabled */ + boolean has_backed_views; /* set if any of the rtv/dsv is a backed surface view */ }; diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c index b2b037ddd7f..e76b1da6aa5 100644 --- a/src/gallium/drivers/svga/svga_state_framebuffer.c +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -174,6 +174,12 @@ emit_fb_vgpu10(struct svga_context *svga) assert(svga_have_vgpu10(svga)); + /* Reset the has_backed_views flag. + * The flag is set in svga_validate_surface_view() if + * a backed surface view is used. + */ + svga->state.hw_draw.has_backed_views = FALSE; + /* Setup render targets array. Note that we loop over the max of the * number of previously bound buffers and the new buffers to unbind * any previously bound buffers when the new number of buffers is less diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index ef566c4e255..d9c1e2502fb 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -428,6 +428,10 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s) "same resource used in shaderResource and renderTarget 0x%x\n", s->handle); s = create_backed_surface_view(svga, s); + + if (s) + svga->state.hw_draw.has_backed_views = TRUE; + /* s may be null here if the function failed */ break; } @@ -678,6 +682,10 @@ svga_propagate_rendertargets(struct svga_context *svga) { unsigned i; + /* Early exit if there is no backing texture views in use */ + if (!svga->state.hw_draw.has_backed_views) + return; + /* Note that we examine the svga->state.hw_draw.framebuffer surfaces, * not the svga->curr.framebuffer surfaces, because it's the former * surfaces which may be backing surface views (the actual render targets). -- 2.30.2