On Fri,  7 Oct 2011 20:28:35 -0700, Kenneth Graunke <kenn...@whitecape.org> 
wrote:
> brw_set_compression_control took a GLboolean as an argument, then
> promptly used a switch statement to compare it with various enumeration
> values.  Clearly it's not actually a boolean.
> 
> Introduce a new enumeration type, enum brw_compression, and use that.
> 
> Found by converting GLboolean to bool; clang then gave warnings about
> switching on a boolean and ultimately duplicated case errors.
> 
> Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
>
> ---
>  src/mesa/drivers/dri/i965/brw_defines.h |    8 +++++---
>  src/mesa/drivers/dri/i965/brw_eu.c      |    4 +++-
>  src/mesa/drivers/dri/i965/brw_eu.h      |    2 +-
>  3 files changed, 9 insertions(+), 5 deletions(-)
> 
> Only compile tested.  I think this demonstrates that using stdbool instead of
> GLboolean is worthwhile: the compiler actually recognizes it as a boolean
> data type and offers appropriate warnings---even errors!---when you do stupid
> things like this.
> 
> I have a follow-on patch that actually does the GLboolean->bool conversion,
> should we decide to go that route.  Needs a bit more clean-up but shouldn't
> take too long.

Reviewed-by: Eric Anholt <e...@anholt.net>

I'm looking forward to GLboolean -> bool conversion in the driver.
GLboolean needs to die in a chemical fire.

Attachment: pgpg9XD8o7Dpz.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to