summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_scene.h
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.h
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.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h
index 3e2bd0e7b38..d3a8586a44d 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.h
+++ b/src/gallium/drivers/llvmpipe/lp_scene.h
@@ -119,6 +119,11 @@ struct lp_scene {
/** list of resources referenced by the scene commands */
struct resource_ref resources;
+ /** Approx memory used by the scene (in bytes). This includes the
+ * shared and per-tile bins plus any referenced resources/textures.
+ */
+ unsigned scene_size;
+
boolean write_depth;
boolean has_color_clear;
boolean has_depth_clear;
@@ -182,6 +187,8 @@ lp_scene_alloc( struct lp_scene *scene, unsigned size)
lp_bin_new_data_block( list );
}
+ scene->scene_size += size;
+
{
struct data_block *tail = list->tail;
ubyte *data = tail->data + tail->used;
@@ -204,6 +211,8 @@ lp_scene_alloc_aligned( struct lp_scene *scene, unsigned size,
lp_bin_new_data_block( list );
}
+ scene->scene_size += size;
+
{
struct data_block *tail = list->tail;
ubyte *data = tail->data + tail->used;
@@ -220,6 +229,7 @@ static INLINE void
lp_scene_putback_data( struct lp_scene *scene, unsigned size)
{
struct data_block_list *list = &scene->data;
+ scene->scene_size -= size;
assert(list->tail->used >= size);
list->tail->used -= size;
}
@@ -309,4 +319,12 @@ void
lp_scene_begin_binning( struct lp_scene *scene,
struct pipe_framebuffer_state *fb );
+
+static INLINE unsigned
+lp_scene_get_size(const struct lp_scene *scene)
+{
+ return scene->scene_size;
+}
+
+
#endif /* LP_BIN_H */