[Mesa-dev] [PATCH] i965: Replace incorrect use of GLboolean with enum brw_compression.

Eric Anholt eric at anholt.net
Mon Oct 10 09:46:59 PDT 2011


On Fri,  7 Oct 2011 20:28:35 -0700, Kenneth Graunke <kenneth at 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 <kenneth at 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 <eric at anholt.net>

I'm looking forward to GLboolean -> bool conversion in the driver.
GLboolean needs to die in a chemical fire.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111010/639ae37d/attachment.pgp>


More information about the mesa-dev mailing list