diff options
author | José Fonseca <[email protected]> | 2009-10-19 11:53:22 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-10-19 11:53:22 +0100 |
commit | f2be08ae0e20b3da8ff684ffeb94412cc6a5a5a1 (patch) | |
tree | 275ad7551dc28362b430eacfac3a4c8ff82a4c09 /src/gallium/drivers/llvmpipe/lp_setup_context.h | |
parent | 269342d916fff3bf0fa0a5c1f26aec30b62ed352 (diff) |
llvmpipe: Allocate the blend color from the data store, and ensure it's aligned.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_context.h')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_context.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h index 82ec71f1000..bcd3b9b7aa3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_context.h +++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h @@ -43,8 +43,9 @@ #define DATA_BLOCK_SIZE (16 * 1024 - sizeof(unsigned) - sizeof(void *)) -#define LP_SETUP_NEW_FS 0x01 -#define LP_SETUP_NEW_CONSTANTS 0x02 +#define LP_SETUP_NEW_FS 0x01 +#define LP_SETUP_NEW_CONSTANTS 0x02 +#define LP_SETUP_NEW_BLEND_COLOR 0x04 /* switch to a non-pointer value for this: @@ -124,6 +125,11 @@ struct setup_context { const void *stored_data; } constants; + struct { + struct pipe_blend_color current; + uint8_t *stored; + } blend_color; + unsigned dirty; void (*point)( struct setup_context *, @@ -163,6 +169,24 @@ static INLINE void *get_data( struct data_block_list *list, } } +static INLINE void *get_data_aligned( struct data_block_list *list, + unsigned size, + unsigned alignment ) +{ + + if (list->tail->used + size + alignment - 1 > DATA_BLOCK_SIZE) { + lp_setup_new_data_block( list ); + } + + { + struct data_block *tail = list->tail; + ubyte *data = tail->data + tail->used; + unsigned offset = (((uintptr_t)data + alignment - 1) & ~(alignment - 1)) - (uintptr_t)data; + tail->used += offset + size; + return data + offset; + } +} + /* Add a command to a given bin. */ static INLINE void bin_command( struct cmd_block_list *list, |