summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharmaine Lee <charmainel@vmware.com>2017-04-12 16:21:51 -0700
committerBrian Paul <brianp@vmware.com>2017-04-26 11:37:59 -0600
commitf482493dcff6fc9141ba703c9d64ff61d374072c (patch)
treebfe1104ed31f96242855ded94d3369512c0a85af
parent1ee181b3548a93b19474de5a13cfade208056996 (diff)
svga: Move setting the rendered_to flags to framebuffer emit time
Instead of setting the rendered_to flags at set time, this patch moves the setting of the flags to framebuffer emit time. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/gallium/drivers/svga/svga_pipe_misc.c16
-rw-r--r--src/gallium/drivers/svga/svga_state_framebuffer.c30
2 files changed, 28 insertions, 18 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c
index e5d37419cc2..04707f61d2a 100644
--- a/src/gallium/drivers/svga/svga_pipe_misc.c
+++ b/src/gallium/drivers/svga/svga_pipe_misc.c
@@ -150,15 +150,6 @@ svga_set_framebuffer_state(struct pipe_context *pipe,
util_copy_framebuffer_state(dst, fb);
- /* Set the rendered-to flags */
- for (i = 0; i < dst->nr_cbufs; i++) {
- struct pipe_surface *s = dst->cbufs[i];
- if (s) {
- struct svga_texture *t = svga_texture(s->texture);
- svga_set_texture_rendered_to(t, s->u.tex.first_layer, s->u.tex.level);
- }
- }
-
if (svga->curr.framebuffer.zsbuf) {
switch (svga->curr.framebuffer.zsbuf->format) {
case PIPE_FORMAT_Z16_UNORM:
@@ -180,13 +171,6 @@ svga_set_framebuffer_state(struct pipe_context *pipe,
svga->curr.depthscale = 0.0f;
break;
}
-
- /* Set rendered-to flag */
- {
- struct pipe_surface *s = dst->zsbuf;
- struct svga_texture *t = svga_texture(s->texture);
- svga_set_texture_rendered_to(t, s->u.tex.first_layer, s->u.tex.level);
- }
}
else {
svga->curr.depthscale = 0.0f;
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
index 146d9dcf5d3..7fe09579c31 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -34,6 +34,7 @@
#include "svga_debug.h"
#include "svga_screen.h"
#include "svga_surface.h"
+#include "svga_resource_texture.h"
/*
@@ -82,6 +83,13 @@ emit_fb_vgpu9(struct svga_context *svga)
pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]);
}
+
+ /* Set the rendered-to flag */
+ struct pipe_surface *s = curr->cbufs[i];
+ if (s) {
+ svga_set_texture_rendered_to(svga_texture(s->texture),
+ s->u.tex.first_layer, s->u.tex.level);
+ }
}
if ((curr->zsbuf != hw->zsbuf) || (reemit && hw->zsbuf)) {
@@ -107,6 +115,13 @@ emit_fb_vgpu9(struct svga_context *svga)
}
pipe_surface_reference(&hw->zsbuf, curr->zsbuf);
+
+ /* Set the rendered-to flag */
+ struct pipe_surface *s = curr->zsbuf;
+ if (s) {
+ svga_set_texture_rendered_to(svga_texture(s->texture),
+ s->u.tex.first_layer, s->u.tex.level);
+ }
}
return PIPE_OK;
@@ -195,14 +210,19 @@ emit_fb_vgpu10(struct svga_context *svga)
*/
for (i = 0; i < num_color; i++) {
if (curr->cbufs[i]) {
- rtv[i] = svga_validate_surface_view(svga,
- svga_surface(curr->cbufs[i]));
+ struct pipe_surface *s = curr->cbufs[i];
+
+ rtv[i] = svga_validate_surface_view(svga, svga_surface(s));
if (rtv[i] == NULL) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
assert(svga_surface(rtv[i])->view_id != SVGA3D_INVALID_ID);
last_rtv = i;
+
+ /* Set the rendered-to flag */
+ svga_set_texture_rendered_to(svga_texture(s->texture),
+ s->u.tex.first_layer, s->u.tex.level);
}
else {
rtv[i] = NULL;
@@ -211,10 +231,16 @@ emit_fb_vgpu10(struct svga_context *svga)
/* Setup depth stencil view */
if (curr->zsbuf) {
+ struct pipe_surface *s = curr->zsbuf;
+
dsv = svga_validate_surface_view(svga, svga_surface(curr->zsbuf));
if (!dsv) {
return PIPE_ERROR_OUT_OF_MEMORY;
}
+
+ /* Set the rendered-to flag */
+ svga_set_texture_rendered_to(svga_texture(s->texture),
+ s->u.tex.first_layer, s->u.tex.level);
}
else {
dsv = NULL;