diff options
author | Keith Whitwell <keithw@vmware.com> | 2009-11-04 19:32:44 +0000 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2009-11-04 19:32:44 +0000 |
commit | 4e335a213acd535af81dd0c4b448003eb81db0cf (patch) | |
tree | 4f3f38451bc1f3b14d573d7332538df023e2aaa4 /src/gallium/drivers/i965/brw_screen_texture.c | |
parent | 0cf432c7a180a6b847fa49c97ea1c48d90a7d5f8 (diff) |
i965g: add missing is_*_referenced callbacks
Diffstat (limited to 'src/gallium/drivers/i965/brw_screen_texture.c')
-rw-r--r-- | src/gallium/drivers/i965/brw_screen_texture.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c index fe3e57da90..c318b07f97 100644 --- a/src/gallium/drivers/i965/brw_screen_texture.c +++ b/src/gallium/drivers/i965/brw_screen_texture.c @@ -325,6 +325,45 @@ static boolean brw_is_format_supported( struct pipe_screen *screen, } +boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen, + struct pipe_texture *texture, + unsigned face, + unsigned level, + struct brw_winsys_buffer *bo ) +{ + struct brw_texture *tex = brw_texture(texture); + struct brw_surface *surf; + int i; + + /* XXX: this is subject to false positives if the underlying + * texture BO is referenced, we can't tell whether the sub-region + * we care about participates in that. + */ + if (brw_screen->sws->bo_references( bo, tex->bo )) + return TRUE; + + /* Find any view on this texture for this face/level and see if it + * is referenced: + */ + for (i = 0; i < 2; i++) { + foreach (surf, &tex->views[i]) { + if (surf->bo == tex->bo) + continue; + + if (surf->id.bits.face != face || + surf->id.bits.level != level) + continue; + + if (brw_screen->sws->bo_references( bo, surf->bo)) + return TRUE; + } + } + + return FALSE; +} + + + void brw_screen_tex_init( struct brw_screen *brw_screen ) { brw_screen->base.is_format_supported = brw_is_format_supported; |