Mesa (master): svga: add the has_backed_views flag
Brian Paul
brianp at kemper.freedesktop.org
Fri Apr 7 19:51:09 UTC 2017
Module: Mesa
Branch: master
Commit: 02c9bf2d54cc166882a10a5b54b14dda832b4ecd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=02c9bf2d54cc166882a10a5b54b14dda832b4ecd
Author: Charmaine Lee <charmainel at vmware.com>
Date: Wed Mar 22 10:46:54 2017 -0700
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 <brianp at vmware.com>
---
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 2b95a78787..3789a46bf5 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 b2b037ddd7..e76b1da6aa 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 ef566c4e25..d9c1e2502f 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).
More information about the mesa-commit
mailing list