summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_scene.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-04-27 11:44:33 -0600
committerBrian Paul <[email protected]>2010-04-27 11:44:36 -0600
commitbb527c0af6c53b335330da1063979f5ac3a19174 (patch)
tree5eaa65afd5c1d272fae325d5a00d397e8c58de6c /src/gallium/drivers/llvmpipe/lp_scene.c
parent1db3a55b9c59093f7bf4df39579287eeb0cf0a2b (diff)
llvmpipe: implement max scene size
When the size of the scene (binned data plus referenced resources/textures) exceeds LP_MAX_SCENE_SIZE flush/render the scene. This could be improved in various ways but is a good start. Fixes piglit streaming-texture-leak test.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_scene.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 71d9529230b..7a94116f036 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -43,6 +43,10 @@ struct texture_ref {
+/**
+ * Create a new scene object.
+ * \param queue the queue to put newly rendered/emptied scenes into
+ */
struct lp_scene *
lp_scene_create( struct pipe_context *pipe,
struct lp_scene_queue *queue )
@@ -195,6 +199,8 @@ lp_scene_reset(struct lp_scene *scene )
make_empty_list(ref_list);
}
+ scene->scene_size = 0;
+
scene->has_color_clear = FALSE;
scene->has_depth_clear = FALSE;
}
@@ -226,7 +232,10 @@ lp_bin_new_data_block( struct data_block_list *list )
}
-/** Return number of bytes used for all bin data within a scene */
+/**
+ * Return number of bytes used for all bin data within a scene.
+ * This does not include resources (textures) referenced by the scene.
+ */
unsigned
lp_scene_data_size( const struct lp_scene *scene )
{
@@ -267,6 +276,8 @@ lp_scene_add_resource_reference(struct lp_scene *scene,
pipe_resource_reference(&ref->resource, resource);
insert_at_tail(ref_list, ref);
}
+
+ scene->scene_size += llvmpipe_resource_size(resource);
}