svga: Move rendertarget view related fields to hw_clear state

This patch moves the rendertarget view related fields from
svga_hw_draw_state to svga_hw_clear_state where all the hw
framebuffer related state resides.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Charmaine Lee
2017-04-25 14:27:51 -06:00
committed by Brian Paul
parent f482493dcf
commit dc30ac5c24
4 changed files with 18 additions and 17 deletions
+2 -2
View File
@@ -241,6 +241,8 @@ svga_context_create(struct pipe_screen *screen, void *priv, unsigned flags)
memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear));
memset(&svga->state.hw_clear.framebuffer, 0x0,
sizeof(svga->state.hw_clear.framebuffer));
svga->state.hw_clear.num_rendertargets = 0;
svga->state.hw_clear.dsv = NULL;
memset(&svga->state.hw_draw, 0xcd, sizeof(svga->state.hw_draw));
memset(&svga->state.hw_draw.views, 0x0, sizeof(svga->state.hw_draw.views));
@@ -251,8 +253,6 @@ svga_context_create(struct pipe_screen *screen, void *priv, unsigned flags)
memset(svga->state.hw_draw.sampler_views, 0,
sizeof(svga->state.hw_draw.sampler_views));
svga->state.hw_draw.num_views = 0;
svga->state.hw_draw.num_rendertargets = 0;
svga->state.hw_draw.dsv = NULL;
svga->state.hw_draw.rasterizer_discard = FALSE;
/* Initialize the shader pointers */
+5 -4
View File
@@ -324,6 +324,11 @@ struct svga_hw_clear_state
struct pipe_framebuffer_state framebuffer;
struct svga_prescale prescale;
/* VGPU10 state */
unsigned num_rendertargets;
struct pipe_surface *rtv[SVGA3D_MAX_RENDER_TARGETS];
struct pipe_surface *dsv;
};
struct svga_hw_view_state
@@ -393,10 +398,6 @@ struct svga_hw_draw_state
struct pipe_sampler_view
*sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
unsigned num_rendertargets;
struct pipe_surface *rtv[SVGA3D_MAX_RENDER_TARGETS];
struct pipe_surface *dsv;
/* used for rebinding */
unsigned default_constbuf_size[PIPE_SHADER_TYPES];
@@ -247,9 +247,9 @@ emit_fb_vgpu10(struct svga_context *svga)
}
/* avoid emitting redundant SetRenderTargets command */
if ((num_color != svga->state.hw_draw.num_rendertargets) ||
(dsv != svga->state.hw_draw.dsv) ||
memcmp(rtv, svga->state.hw_draw.rtv, num_color * sizeof(rtv[0]))) {
if ((num_color != svga->state.hw_clear.num_rendertargets) ||
(dsv != svga->state.hw_clear.dsv) ||
memcmp(rtv, svga->state.hw_clear.rtv, num_color * sizeof(rtv[0]))) {
ret = SVGA3D_vgpu10_SetRenderTargets(svga->swc, num_color, rtv, dsv);
if (ret != PIPE_OK)
@@ -258,9 +258,9 @@ emit_fb_vgpu10(struct svga_context *svga)
/* number of render targets sent to the device, not including trailing
* unbound render targets.
*/
svga->state.hw_draw.num_rendertargets = last_rtv + 1;
svga->state.hw_draw.dsv = dsv;
memcpy(svga->state.hw_draw.rtv, rtv, num_color * sizeof(rtv[0]));
svga->state.hw_clear.num_rendertargets = last_rtv + 1;
svga->state.hw_clear.dsv = dsv;
memcpy(svga->state.hw_clear.rtv, rtv, num_color * sizeof(rtv[0]));
for (i = 0; i < ss->max_color_buffers; i++) {
if (hw->cbufs[i] != curr->cbufs[i]) {
@@ -335,7 +335,7 @@ svga_reemit_framebuffer_bindings(struct svga_context *svga)
enum pipe_error
svga_rebind_framebuffer_bindings(struct svga_context *svga)
{
struct svga_hw_draw_state *hw = &svga->state.hw_draw;
struct svga_hw_clear_state *hw = &svga->state.hw_clear;
unsigned i;
enum pipe_error ret;
+4 -4
View File
@@ -751,15 +751,15 @@ svga_propagate_rendertargets(struct svga_context *svga)
* not the svga->curr.framebuffer surfaces, because it's the former
* surfaces which may be backing surface views (the actual render targets).
*/
for (i = 0; i < svga->state.hw_draw.num_rendertargets; i++) {
struct pipe_surface *s = svga->state.hw_draw.rtv[i];
for (i = 0; i < svga->state.hw_clear.num_rendertargets; i++) {
struct pipe_surface *s = svga->state.hw_clear.rtv[i];
if (s) {
svga_propagate_surface(svga, s, FALSE);
}
}
if (svga->state.hw_draw.dsv) {
svga_propagate_surface(svga, svga->state.hw_draw.dsv, FALSE);
if (svga->state.hw_clear.dsv) {
svga_propagate_surface(svga, svga->state.hw_clear.dsv, FALSE);
}
}