summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-13 13:54:46 -0700
committerBrian Paul <[email protected]>2010-01-13 15:10:57 -0700
commita27b12171d84c6e731af08f48a657c377f8549ba (patch)
tree754267ee5d7ed5379f0ae6617e13818b61f82e04 /src
parent592e40aa7bdbda5a09becb898300393d599c033a (diff)
llvmpipe: add scene texture referencing code
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c29
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h2
2 files changed, 22 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 61b968c49f5..bac2db92bae 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -432,25 +432,22 @@ lp_setup_set_vertex_info( struct setup_context *setup,
}
+/**
+ * Called during state validation when LP_NEW_TEXTURE is set.
+ */
void
lp_setup_set_sampler_textures( struct setup_context *setup,
unsigned num, struct pipe_texture **texture)
{
- struct pipe_texture *dummy;
unsigned i;
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
-
assert(num <= PIPE_MAX_SAMPLERS);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
struct pipe_texture *tex = i < num ? texture[i] : NULL;
- /* FIXME: hold on to the reference */
- dummy = NULL;
- pipe_texture_reference(&dummy, tex);
-
if(tex) {
struct llvmpipe_texture *lp_tex = llvmpipe_texture(tex);
struct lp_jit_texture *jit_tex;
@@ -463,21 +460,37 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
else
/* FIXME: map the rendertarget */
assert(0);
+
+ /* the scene references this texture */
+ {
+ struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ lp_scene_texture_reference(scene, tex);
+ }
}
}
setup->dirty |= LP_SETUP_NEW_FS;
}
+
+/**
+ * Is the given texture referenced in the setup module's current scene?
+ */
boolean
-lp_setup_is_texture_referenced( struct setup_context *setup,
+lp_setup_is_texture_referenced( const struct setup_context *setup,
const struct pipe_texture *texture )
{
- /* FIXME */
+ const struct lp_scene *scene = setup->scene;
+ if (scene && lp_scene_is_textured_referenced(scene, texture)) {
+ return PIPE_REFERENCED_FOR_READ;
+ }
return PIPE_UNREFERENCED;
}
+/**
+ * Called by vbuf code when we're about to draw something.
+ */
void
lp_setup_update_state( struct setup_context *setup )
{
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index bac7d73e8d2..429abeba43b 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -118,7 +118,7 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
unsigned num, struct pipe_texture **texture);
boolean
-lp_setup_is_texture_referenced( struct setup_context *setup,
+lp_setup_is_texture_referenced( const struct setup_context *setup,
const struct pipe_texture *texture );
void