[Mesa-dev] [PATCH] gl.h, gl2.h, gallium: use stdbool.h for GLboolean and boolean

Nicolas Kaiser nikai at nikai.net
Wed Oct 13 11:26:38 PDT 2010


This patch adds support for the compiler built-in Boolean type
to GLboolean and the "boolean" type in gallium
by bringing them in line with the "bool" type in stdbool.h.

Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
---
 include/GL/gl.h                       |    7 ++++---
 include/GLES/gl.h                     |    7 ++++---
 include/GLES2/gl2.h                   |    7 ++++---
 src/gallium/include/pipe/p_compiler.h |    2 +-
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index 8e5f138..2d66053 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -149,11 +149,12 @@ extern "C" {
 #define GL_ARB_imaging   1
 
 
+#include <stdbool.h>
 /*
  * Datatypes
  */
 typedef unsigned int	GLenum;
-typedef unsigned char	GLboolean;
+typedef bool		GLboolean;
 typedef unsigned int	GLbitfield;
 typedef void		GLvoid;
 typedef signed char	GLbyte;		/* 1-byte signed */
@@ -175,8 +176,8 @@ typedef double		GLclampd;	/* double precision float in [0,1] */
  */
 
 /* Boolean values */
-#define GL_FALSE				0x0
-#define GL_TRUE					0x1
+#define GL_FALSE				false
+#define GL_TRUE					true
 
 /* Data types */
 #define GL_BYTE					0x1400
diff --git a/include/GLES/gl.h b/include/GLES/gl.h
index 5b8d85a..100b0c2 100644
--- a/include/GLES/gl.h
+++ b/include/GLES/gl.h
@@ -4,6 +4,7 @@
 /* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
 
 #include <GLES/glplatform.h>
+#include <stdbool.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -17,7 +18,7 @@ extern "C" {
 typedef void             GLvoid;
 typedef char             GLchar;
 typedef unsigned int     GLenum;
-typedef unsigned char    GLboolean;
+typedef bool             GLboolean;
 typedef unsigned int     GLbitfield;
 typedef khronos_int8_t   GLbyte;
 typedef short            GLshort;
@@ -49,8 +50,8 @@ typedef khronos_ssize_t  GLsizeiptr;
 #define GL_COLOR_BUFFER_BIT               0x00004000
 
 /* Boolean */
-#define GL_FALSE                          0
-#define GL_TRUE                           1
+#define GL_FALSE                          false
+#define GL_TRUE                           true
 
 /* BeginMode */
 #define GL_POINTS                         0x0000
diff --git a/include/GLES2/gl2.h b/include/GLES2/gl2.h
index e1d3b87..811a9f1 100644
--- a/include/GLES2/gl2.h
+++ b/include/GLES2/gl2.h
@@ -4,6 +4,7 @@
 /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
 
 #include <GLES2/gl2platform.h>
+#include <stdbool.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -21,7 +22,7 @@ extern "C" {
 typedef void             GLvoid;
 typedef char             GLchar;
 typedef unsigned int     GLenum;
-typedef unsigned char    GLboolean;
+typedef bool             GLboolean;
 typedef unsigned int     GLbitfield;
 typedef khronos_int8_t   GLbyte;
 typedef short            GLshort;
@@ -47,8 +48,8 @@ typedef khronos_ssize_t  GLsizeiptr;
 #define GL_COLOR_BUFFER_BIT               0x00004000
 
 /* Boolean */
-#define GL_FALSE                          0
-#define GL_TRUE                           1
+#define GL_FALSE                          false
+#define GL_TRUE                           true
 
 /* BeginMode */
 #define GL_POINTS                         0x0000
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 3d6b5b5..b12399b 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -72,7 +72,7 @@ typedef unsigned short     ushort;
 #endif
 typedef unsigned char      ubyte;
 
-typedef unsigned char boolean;
+typedef bool               boolean;
 #ifndef TRUE
 #define TRUE  true
 #endif
-- 
1.7.2.2


More information about the mesa-dev mailing list