[Mesa-dev] [RFC PATCH 19/40] mesa: Change internal state flag to a 64-bits
Kenneth Graunke
kenneth at whitecape.org
Sun Jan 4 22:17:01 PST 2015
On Sunday, January 04, 2015 04:04:33 PM Abdiel Janulgue wrote:
> Existing state flag cannot publish additional values.
That's not quite true - there are actually two available bits.
However, I don't think we should be adding _NEW_WHATEVER flags. These are
basically for Mesa internals, and we've been moving drivers away from them.
Instead, you should consider using ctx->DriverFlags.
1. Create a new field, uint64_t ctx->DriverFlags.NewVSUniforms.
2. Create a new BRW_NEW_VS_UNIFORMS flag, and in brw_init_state(),
set ctx->DriverFlags = BRW_NEW_VS_UNIFORMS.
3. When you want to signal the new flag, do:
ctx->NewDriverState |= ctx->DriverFlags.NewVSUniforms.
This causes BRW_NEW_VS_UNIFORMS to get flagged at the appropriate time.
Other drivers can set the ctx->DriverFlags field to whatever flag they
wish to be signalled.
I like the idea of per-stage uniform flags. I'd started implementing
that myself, but never got it all hooked up right.
> Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> ---
> src/mesa/main/dd.h | 2 +-
> src/mesa/main/mtypes.h | 3 ++-
> src/mesa/main/state.c | 6 +++---
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 2f40915..8c737e0 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -91,7 +91,7 @@ struct dd_function_table {
> * This is in addition to any state change callbacks Mesa may already have
> * made.
> */
> - void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
> + void (*UpdateState)( struct gl_context *ctx, GLbitfield64 new_state );
>
> /**
> * Resize the given framebuffer to the given size.
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index b95dfb9..12ab3e8 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3932,6 +3932,7 @@ struct gl_matrix_stack
> #define _NEW_FRAG_CLAMP (1 << 29)
> /* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
> #define _NEW_VARYING_VP_INPUTS (1 << 31) /**< gl_context::varying_vp_inputs */
> +
> #define _NEW_ALL ~0
> /*@}*/
>
> @@ -4399,7 +4400,7 @@ struct gl_context
> struct gl_debug_state *Debug;
>
> GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
> - GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
> + GLbitfield64 NewState; /**< bitwise-or of _NEW_* flags */
> uint64_t NewDriverState; /**< bitwise-or of flags from DriverFlags */
>
> struct gl_driver_flags DriverFlags;
> diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
> index 45bce78..ccf60de 100644
> --- a/src/mesa/main/state.c
> +++ b/src/mesa/main/state.c
> @@ -349,9 +349,9 @@ update_twoside(struct gl_context *ctx)
> void
> _mesa_update_state_locked( struct gl_context *ctx )
> {
> - GLbitfield new_state = ctx->NewState;
> - GLbitfield prog_flags = _NEW_PROGRAM;
> - GLbitfield new_prog_state = 0x0;
> + GLbitfield64 new_state = ctx->NewState;
> + GLbitfield64 prog_flags = _NEW_PROGRAM;
> + GLbitfield64 new_prog_state = 0x0;
>
> if (new_state == _NEW_CURRENT_ATTRIB)
> goto out;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150104/90a04cdd/attachment.sig>
More information about the mesa-dev
mailing list