Skip to content

Commit ad3af6d

Browse files
committed
Changed type of GL_FALSE/GL_TRUE to GLboolean. Bumped version to 3.1.0.0.
1 parent e63e9b4 commit ad3af6d

File tree

5 files changed

+35
-27
lines changed

5 files changed

+35
-27
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
3.1.0.0
2+
-------
3+
* Changed the type of `GL_FALSE` and `GL_TRUE` to `GLboolean`, leading to fewer
4+
`fromIntegral` calls in user code.
5+
* Updated OpenGL registry to r32348.
6+
17
3.0.0.0
28
-------
39
* Make the `OpenGLRaw` package even more similar to the `gl` package:

OpenGLRaw.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: OpenGLRaw
2-
version: 3.0.0.0
2+
version: 3.1.0.0
33
synopsis: A raw binding for the OpenGL graphics system
44
description:
55
OpenGLRaw is a raw Haskell binding for the OpenGL 4.5 graphics system and

RegistryProcessor/src/Main.hs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -665,35 +665,37 @@ inlineCode s = "@" ++ s ++ "@"
665665

666666
-- TODO: Use Either instead of error below?
667667
toEnumType :: ToEnumType
668-
toEnumType eNamespace eGroup eType suffix = TypeName $
669-
case (eNamespace, eGroup, eType, unTypeSuffix `fmap` suffix) of
668+
toEnumType eNamespace eGroup eType suffix eName = TypeName $
669+
case (eNamespace, eGroup, eType, unTypeSuffix `fmap` suffix, eName) of
670670
-- glx.xml
671-
(Just "GLXStrings", _, _, _) -> "String"
672-
(Just ('G':'L':'X':_), _, _, _) -> "CInt"
671+
(Just "GLXStrings", _, _, _, _) -> "String"
672+
(Just ('G':'L':'X':_), _, _, _, _) -> "CInt"
673673

674674
-- egl.xml
675675
-- TODO: EGLenum for EGL_OPENGL_API, EGL_OPENGL_ES_API, EGL_OPENVG_API, EGL_OPENVG_IMAGE?
676-
(Just ('E':'G':'L':_), _, Nothing, Just "ull") -> "EGLTime"
677-
(Just ('E':'G':'L':_), _, _, _) -> "EGLint"
676+
(Just ('E':'G':'L':_), _, Nothing, Just "ull", _) -> "EGLTime"
677+
(Just ('E':'G':'L':_), _, _, _, _) -> "EGLint"
678678

679679
-- wgl.xml
680-
(Just "WGLLayerPlaneMask", _, _, _) -> "UINT"
681-
(Just "WGLColorBufferMask", _, _, _) -> "UINT"
682-
(Just "WGLContextFlagsMask", _, _, _) -> "INT"
683-
(Just "WGLContextProfileMask", _, _, _) -> "INT"
684-
(Just "WGLImageBufferMaskI3D" , _, _, _) -> "UINT"
685-
(Just "WGLDXInteropMaskNV", _, _, _) -> "GLenum"
686-
(Just ('W':'G':'L':_), _, _, _) -> "CInt"
680+
(Just "WGLLayerPlaneMask", _, _, _, _) -> "UINT"
681+
(Just "WGLColorBufferMask", _, _, _, _) -> "UINT"
682+
(Just "WGLContextFlagsMask", _, _, _, _) -> "INT"
683+
(Just "WGLContextProfileMask", _, _, _, _) -> "INT"
684+
(Just "WGLImageBufferMaskI3D" , _, _, _, _) -> "UINT"
685+
(Just "WGLDXInteropMaskNV", _, _, _, _) -> "GLenum"
686+
(Just ('W':'G':'L':_), _, _, _, _) -> "CInt"
687687

688688
-- gl.xml
689-
(Just "OcclusionQueryEventMaskAMD", _, _, _) -> "GLuint"
690-
(Just "GL", Just "PathRenderingTokenNV", _, _) -> "GLubyte"
691-
(Just "GL", _, Just "bitmask", _) -> "GLbitfield"
692-
(Just "GL", _, Nothing, Just "u") -> "GLuint"
693-
(Just "GL", _, Nothing, Just "ull") -> "GLuint64"
694-
(Just "GL", _, Nothing, Nothing) -> "GLenum"
695-
696-
(_, _, _, _) -> error "can't determine enum type"
689+
(Just "OcclusionQueryEventMaskAMD", _, _, _, _) -> "GLuint"
690+
(Just "GL", Just "SpecialNumbers", _, _, "GL_FALSE") -> "GLboolean"
691+
(Just "GL", Just "SpecialNumbers", _, _, "GL_TRUE") -> "GLboolean"
692+
(Just "GL", Just "PathRenderingTokenNV", _, _, _) -> "GLubyte"
693+
(Just "GL", _, Just "bitmask", _, _) -> "GLbitfield"
694+
(Just "GL", _, Nothing, Just "u", _) -> "GLuint"
695+
(Just "GL", _, Nothing, Just "ull", _) -> "GLuint64"
696+
(Just "GL", _, Nothing, Nothing, _) -> "GLenum"
697+
698+
(_, _, _, _, _) -> error "can't determine enum type"
697699

698700
isMask :: TypeName -> Bool
699701
isMask = (== TypeName "GLbitfield")

RegistryProcessor/src/MangledRegistry.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import qualified Numeric as N
3636
import qualified DeclarationParser as D
3737
import qualified Registry as R
3838

39-
type ToEnumType = Maybe String -> Maybe String -> Maybe String -> Maybe R.TypeSuffix -> R.TypeName
39+
type ToEnumType = Maybe String -> Maybe String -> Maybe String -> Maybe R.TypeSuffix -> String -> R.TypeName
4040

4141
parseRegistry :: ToEnumType -> String -> Either String Registry
4242
parseRegistry toEnumType str = toRegistry toEnumType `fmap` R.parseRegistry str
@@ -118,11 +118,11 @@ data Enum' = Enum {
118118
enumName :: EnumName
119119
} deriving (Eq, Ord, Show)
120120

121-
toEnum' :: (Maybe R.TypeSuffix -> R.TypeName) -> R.Enum' -> Enum'
121+
toEnum' :: (Maybe R.TypeSuffix -> String -> R.TypeName) -> R.Enum' -> Enum'
122122
toEnum' toTypeName e = Enum {
123123
enumValue = EnumValue (R.enumValue e),
124124
enumAPI = API `fmap` R.enumAPI e,
125-
enumType = toTypeName (R.enumType e),
125+
enumType = toTypeName (R.enumType e) (R.enumName e),
126126
enumName = EnumName (R.enumName e) }
127127

128128
splitChar :: Char

src/Graphics/GL/Tokens.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,7 @@ pattern GL_FACTOR_MIN_AMD = 0x901C :: GLenum
28802880

28812881
pattern GL_FAILURE_NV = 0x9030 :: GLenum
28822882

2883-
pattern GL_FALSE = 0 :: GLenum
2883+
pattern GL_FALSE = 0 :: GLboolean
28842884

28852885
pattern GL_FASTEST = 0x1101 :: GLenum
28862886

@@ -10252,7 +10252,7 @@ pattern GL_TRIANGLE_STRIP_ADJACENCY_OES = 0x000D :: GLenum
1025210252

1025310253
pattern GL_TRIANGULAR_NV = 0x90A5 :: GLenum
1025410254

10255-
pattern GL_TRUE = 1 :: GLenum
10255+
pattern GL_TRUE = 1 :: GLboolean
1025610256

1025710257
pattern GL_TYPE = 0x92FA :: GLenum
1025810258

0 commit comments

Comments
 (0)