summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-13 14:51:26 -0700
committerBrian Paul <[email protected]>2010-01-13 15:10:57 -0700
commitd59fe448967addb3025d7df90888ff950e03a343 (patch)
tree80b681dfe8a02adca9b5586e62840e8b0a07667a
parenta27b12171d84c6e731af08f48a657c377f8549ba (diff)
llvmpipe: check for texture usage in all scenes
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c20
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h6
2 files changed, 16 insertions, 10 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index bac2db92bae..8193b107d9d 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -50,10 +50,6 @@
#include "draw/draw_vbuf.h"
-/** XXX temporary value, temporary here */
-#define MAX_SCENES 2
-
-
static void set_scene_state( struct setup_context *, unsigned );
@@ -474,15 +470,19 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
/**
- * Is the given texture referenced in the setup module's current scene?
+ * Is the given texture referenced by any scene?
+ * Note: we have to check all scenes including any scenes currently
+ * being rendered and the current scene being built.
*/
boolean
lp_setup_is_texture_referenced( const struct setup_context *setup,
const struct pipe_texture *texture )
{
- const struct lp_scene *scene = setup->scene;
- if (scene && lp_scene_is_textured_referenced(scene, texture)) {
- return PIPE_REFERENCED_FOR_READ;
+ unsigned i;
+ for (i = 0; i < Elements(setup->scenes); i++) {
+ if (lp_scene_is_textured_referenced(setup->scenes[i], texture)) {
+ return PIPE_REFERENCED_FOR_READ;
+ }
}
return PIPE_UNREFERENCED;
}
@@ -645,8 +645,8 @@ lp_setup_create( struct pipe_screen *screen,
/* create some empty scenes */
for (i = 0; i < MAX_SCENES; i++) {
- struct lp_scene *scene = lp_scene_create();
- lp_scene_enqueue(setup->empty_scenes, scene);
+ setup->scenes[i] = lp_scene_create();
+ lp_scene_enqueue(setup->empty_scenes, setup->scenes[i]);
}
setup->triangle = first_triangle;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 66654ec5e71..e6f6f0e0bbb 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -50,6 +50,11 @@
struct lp_scene_queue;
+/** Max number of scenes */
+#define MAX_SCENES 2
+
+
+
/**
* Point/line/triangle setup context.
* Note: "stored" below indicates data which is stored in the bins,
@@ -75,6 +80,7 @@ struct setup_context
*/
struct draw_stage *vbuf;
struct lp_rasterizer *rast;
+ struct lp_scene *scenes[MAX_SCENES]; /**< all the scenes */
struct lp_scene *scene; /**< current scene being built */
struct lp_scene_queue *empty_scenes; /**< queue of empty scenes */