From 9b75627fab5bf2ea90f27ddd31b60c54895f6de6 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 15 Apr 2009 15:53:34 +0200 Subject: gallium: Make sure we flush before some texture / buffer operations. Also implement context member functions to optimize away those flushes whenever possible. Signed-off-by: Thomas Hellstrom --- src/gallium/include/pipe/p_context.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/gallium/include/pipe/p_context.h') diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index c5c839799e..57e966ac3b 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -42,7 +42,6 @@ struct pipe_state_cache; struct pipe_query; struct pipe_winsys; - /** * Gallium rendering context. Basically: * - state setting functions @@ -231,6 +230,34 @@ struct pipe_context { void (*flush)( struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence ); + + /** + * Check whether a texture is referenced by an unflushed hw command. + * The state-tracker uses this function to optimize away unnecessary + * flushes. It is safe (but wasteful) to always return. + * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE. + * \param pipe The pipe context whose unflushed hw commands will be + * checked. + * \param level mipmap level. + * \param texture texture to check. + * \param face cubemap face. Use 0 for non-cubemap texture. + */ + + unsigned int (*is_texture_referenced) (struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level); + /** + * Check whether a buffer is referenced by an unflushed hw command. + * The state-tracker uses this function to optimize away unnecessary + * flushes. It is safe (but wasteful) to always return + * PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE. + * \param pipe The pipe context whose unflushed hw commands will be + * checked. + * \param buf Buffer to check. + */ + + unsigned int (*is_buffer_referenced) (struct pipe_context *pipe, + struct pipe_buffer *buf); }; -- cgit v1.2.3