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>
This commit is contained in:
Charmaine Lee 2017-04-12 16:21:51 -07:00 committed by Brian Paul
parent 1ee181b354
commit f482493dcf
2 changed files with 28 additions and 18 deletions

View file

@ -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;

View file

@ -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;