svga: add a cleanup function to clean up sampler state

This patch adds a cleanup function to clean up sampler state at
context destruction time.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Charmaine Lee
2016-08-17 14:53:38 -07:00
committed by Brian Paul
parent e292f38c6c
commit 5313b294e6
3 changed files with 22 additions and 11 deletions
+1 -11
View File
@@ -66,16 +66,6 @@ static void svga_destroy( struct pipe_context *pipe )
}
}
/* free polygon stipple state */
if (svga->polygon_stipple.sampler) {
pipe->delete_sampler_state(pipe, svga->polygon_stipple.sampler);
}
if (svga->polygon_stipple.sampler_view) {
pipe->sampler_view_destroy(pipe,
&svga->polygon_stipple.sampler_view->base);
}
pipe_resource_reference(&svga->polygon_stipple.texture, NULL);
/* free HW constant buffers */
for (shader = 0; shader < ARRAY_SIZE(svga->state.hw_draw.constbuf); shader++) {
pipe_resource_reference(&svga->state.hw_draw.constbuf[shader], NULL);
@@ -91,9 +81,9 @@ static void svga_destroy( struct pipe_context *pipe )
util_blitter_destroy(svga->blitter);
svga_cleanup_sampler_state(svga);
svga_cleanup_framebuffer( svga );
svga_cleanup_tss_binding( svga );
svga_cleanup_vertex_state(svga);
svga_destroy_swtnl( svga );
+1
View File
@@ -639,6 +639,7 @@ void svga_init_stream_output_functions( struct svga_context *svga );
void svga_init_clear_functions( struct svga_context *svga );
void svga_cleanup_vertex_state( struct svga_context *svga );
void svga_cleanup_sampler_state( struct svga_context *svga );
void svga_cleanup_tss_binding( struct svga_context *svga );
void svga_cleanup_framebuffer( struct svga_context *svga );
@@ -538,6 +538,26 @@ done:
SVGA_STATS_TIME_POP(svga_sws(svga));
}
/**
* Clean up sampler, sampler view state at context destruction time
*/
void
svga_cleanup_sampler_state(struct svga_context *svga)
{
if (!svga_have_vgpu10(svga))
return;
/* free polygon stipple state */
if (svga->polygon_stipple.sampler) {
svga->pipe.delete_sampler_state(&svga->pipe, svga->polygon_stipple.sampler);
}
if (svga->polygon_stipple.sampler_view) {
svga->pipe.sampler_view_destroy(&svga->pipe,
&svga->polygon_stipple.sampler_view->base);
}
pipe_resource_reference(&svga->polygon_stipple.texture, NULL);
}
void
svga_init_sampler_functions( struct svga_context *svga )