Module: Mesa Branch: gallium-0.1 Commit: a1276bfdd8ea2c2840f3ea8edd3cea8720804498 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1276bfdd8ea2c2840f3ea8edd3cea8720804498
Author: José Fonseca <[email protected]> Date: Tue Oct 13 13:47:51 2009 +0100 pipebuffer: is_texture/buffer_referenced helper. A hash table would be more efficient, but this likely isn't used often enough to make a difference. --- src/gallium/auxiliary/pipebuffer/pb_validate.c | 14 ++++++++++++++ src/gallium/auxiliary/pipebuffer/pb_validate.h | 8 ++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c index 1e54fc3..1c7b919 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_validate.c +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c @@ -99,6 +99,20 @@ pb_validate_add_buffer(struct pb_validate *vl, } +unsigned +pb_validate_is_buffer_referenced(struct pb_validate *vl, + struct pb_buffer *buf) +{ + unsigned i; + + for(i = 0; i < vl->used; ++i) + if(vl->buffers[i] == buf) + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + + return 0; +} + + enum pipe_error pb_validate_validate(struct pb_validate *vl) { diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.h b/src/gallium/auxiliary/pipebuffer/pb_validate.h index 3db1d53..1da7b1a 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_validate.h +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.h @@ -61,6 +61,14 @@ pb_validate_add_buffer(struct pb_validate *vl, struct pb_buffer *buf); /** + * Helper for pipe_context::is_texture_referenced and + * pipe_context::is_buffer_referenced + */ +unsigned +pb_validate_is_buffer_referenced(struct pb_validate *vl, + struct pb_buffer *buf); + +/** * Validate all buffers for hardware access. * * Should be called right before issuing commands to the hardware. _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
