diff options
author | Brian Paul <[email protected]> | 2009-11-19 11:37:50 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-11-19 11:39:24 -0700 |
commit | 367cfca808e74101689dd0acb247f3ec38fc4c7f (patch) | |
tree | c6fea2e0058b14461d6bbf8e42ed732b3dd0485b /src | |
parent | 31ea323b4d432b557d7664187f17ccefc6d3947b (diff) |
softpipe: add missing check in softpipe_is_texture_referenced()
Check if the named texture is referenced by the texture cache.
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_context.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 94d000a5acc..d325499bf8d 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -120,7 +120,7 @@ softpipe_destroy( struct pipe_context *pipe ) * if (the texture is being used as a framebuffer surface) * return PIPE_REFERENCED_FOR_WRITE * else if (the texture is a bound texture source) - * return PIPE_REFERENCED_FOR_READ XXX not done yet + * return PIPE_REFERENCED_FOR_READ * else * return PIPE_UNREFERENCED */ @@ -132,6 +132,7 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct softpipe_context *softpipe = softpipe_context( pipe ); unsigned i; + /* check if any of the bound drawing surfaces are this texture */ if (softpipe->dirty_render_cache) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { if (softpipe->framebuffer.cbufs[i] && @@ -145,7 +146,12 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, } } - /* FIXME: we also need to do the same for the texture cache */ + /* check if any of the tex_cache textures are this texture */ + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + if (softpipe->tex_cache[i] && + softpipe->tex_cache[i]->texture == texture) + return PIPE_REFERENCED_FOR_READ; + } return PIPE_UNREFERENCED; } |