/
Types.hs
239 lines (182 loc) · 5.63 KB
/
Types.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
{-# LANGUAGE CPP #-}
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.Types
-- Copyright : (c) Sven Panne 2009-2016
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability : portable
--
-- All types from the whole OpenGL registry.
--
--------------------------------------------------------------------------------
module Graphics.GL.Types (
-- * Types from OpenGL itself.
GLboolean,
GLbyte,
GLubyte,
GLchar,
GLshort,
GLushort,
GLint,
GLuint,
GLfixed,
GLint64,
GLuint64,
GLsizei,
GLenum,
GLintptr,
GLsizeiptr,
GLsync,
GLbitfield,
GLhalf,
GLfloat,
GLclampf,
GLdouble,
GLclampd,
GLDEBUGPROC, GLDEBUGPROCFunc, makeGLDEBUGPROC,
GLvoid,
-- * Pre-standard OpenGL types.
GLcharARB,
GLint64EXT,
GLuint64EXT,
GLintptrARB,
GLsizeiptrARB,
GLhalfARB,
GLhalfNV,
GLDEBUGPROCAMD, GLDEBUGPROCAMDFunc, makeGLDEBUGPROCAMD,
GLDEBUGPROCARB, GLDEBUGPROCARBFunc, makeGLDEBUGPROCARB,
GLDEBUGPROCKHR, GLDEBUGPROCKHRFunc, makeGLDEBUGPROCKHR,
-- * Types from various extensions.
GLclampx,
GLhandleARB,
GLvdpauSurfaceNV,
GLeglImageOES,
-- * Deprecated functions for @gl@ compatibility.
mkGLDEBUGPROC,
mkGLDEBUGPROCAMD,
mkGLDEBUGPROCARB,
mkGLDEBUGPROCKHR
) where
import Data.Int
import Data.Word
import Foreign.C.Types
import Foreign.Ptr
import Numeric.Fixed
import Numeric.Half
--------------------------------------------------------------------------------
-- | 8bit boolean.
type GLboolean = Word8
-- | 8bit signed two\'s complement binary integer.
type GLbyte = Int8
-- | 8bit unsigned binary integer.
type GLubyte = Word8
-- | 8bit characters making up strings.
type GLchar = CChar
-- | 16bit signed two\'s complement binary integer.
type GLshort = Int16
-- | 16bit unsigned binary integer.
type GLushort = Word16
-- | 32bit signed two\'s complement binary integer.
type GLint = Int32
-- | 32bit unsigned binary integer.
type GLuint = Word32
-- | 32bit signed two\'s complement 16.16 scaled integer.
type GLfixed = Fixed
-- | 64bit signed two\'s complement binary integer.
type GLint64 = Int64
-- | 64bit unsigned binary integer.
type GLuint64 = Word64
-- | 32bit non-negative binary integer size.
type GLsizei = Int32
-- | 32bit enumerated binary integer value.
type GLenum = Word32
-- | Pointer-sized signed two\'s complement binary integer.
type GLintptr = CPtrdiff
-- NOTE: OpenGL ES uses khronos_intptr_t for this.
-- | Pointer-sized non-negative binary integer size.
type GLsizeiptr = CPtrdiff
-- NOTE: OpenGL ES uses khronos_ssize_t for this.
-- | Pointer-sized sync object handle.
type GLsync = Ptr ()
-- | 32bit bit field.
type GLbitfield = Word32
-- | 16bit half-precision floating-point value encoded in an unsigned scalar.
type GLhalf = Half
-- | 32bit floating-point value.
type GLfloat = Float
-- | 32bit floating-point value clamped to [0, 1].
type GLclampf = Float
-- | 64bit floating-point value.
type GLdouble = Double
-- | 64bit floating-point value clamped to [0, 1].
type GLclampd = Double
-- | A pointer to a debug callback.
type GLDEBUGPROC = FunPtr GLDEBUGPROCFunc
-- | Debug callback.
type GLDEBUGPROCFunc
= GLenum -- ^ @source@.
-> GLenum -- ^ @type@.
-> GLuint -- ^ @id@.
-> GLenum -- ^ @severity@.
-> GLsizei -- ^ @length@.
-> Ptr GLchar -- ^ @message@.
-> Ptr () -- ^ @userParam@.
-> IO ()
-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import CALLCONV "wrapper"
makeGLDEBUGPROC :: GLDEBUGPROCFunc -> IO (FunPtr GLDEBUGPROCFunc)
-- | Not an actual GL type, though used in headers in the past.
type GLvoid = ()
type GLcharARB = CChar
type GLint64EXT = Int64
type GLuint64EXT = Word64
type GLintptrARB = CPtrdiff
type GLsizeiptrARB = CPtrdiff
type GLhalfARB = Half
type GLhalfNV = Half
type GLDEBUGPROCAMD = FunPtr GLDEBUGPROCAMDFunc
-- | Debug callback.
type GLDEBUGPROCAMDFunc
= GLuint -- ^ @id@.
-> GLenum -- ^ @category@.
-> GLenum -- ^ @severity@.
-> GLsizei -- ^ @length@.
-> Ptr GLchar -- ^ @message@.
-> Ptr () -- ^ @userParam@.
-> IO ()
-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import CALLCONV "wrapper"
makeGLDEBUGPROCAMD :: GLDEBUGPROCAMDFunc -> IO (FunPtr GLDEBUGPROCAMDFunc)
type GLDEBUGPROCARB = GLDEBUGPROC
type GLDEBUGPROCARBFunc = GLDEBUGPROCFunc
makeGLDEBUGPROCARB :: GLDEBUGPROCARBFunc -> IO (FunPtr GLDEBUGPROCARBFunc)
makeGLDEBUGPROCARB = makeGLDEBUGPROC
type GLDEBUGPROCKHR = GLDEBUGPROC
type GLDEBUGPROCKHRFunc = GLDEBUGPROCFunc
makeGLDEBUGPROCKHR :: GLDEBUGPROCKHRFunc -> IO (FunPtr GLDEBUGPROCKHRFunc)
makeGLDEBUGPROCKHR = makeGLDEBUGPROC
type GLclampx = Fixed
#if HANDLE_IS_POINTER
type GLhandleARB = Ptr ()
#else
type GLhandleARB = Word32
#endif
type GLvdpauSurfaceNV = GLintptr
type GLeglImageOES = Ptr ()
{-# DEPRECATED mkGLDEBUGPROC "Use 'makeGLDEBUGPROC' instead." #-}
mkGLDEBUGPROC :: GLDEBUGPROCFunc -> IO (FunPtr GLDEBUGPROCFunc)
mkGLDEBUGPROC = makeGLDEBUGPROC
{-# DEPRECATED mkGLDEBUGPROCAMD "Use 'makeGLDEBUGPROCAMD' instead." #-}
mkGLDEBUGPROCAMD :: GLDEBUGPROCAMDFunc -> IO (FunPtr GLDEBUGPROCAMDFunc)
mkGLDEBUGPROCAMD = makeGLDEBUGPROCAMD
{-# DEPRECATED mkGLDEBUGPROCARB "Use 'makekGLDEBUGPROCARB' instead." #-}
mkGLDEBUGPROCARB :: GLDEBUGPROCARBFunc -> IO (FunPtr GLDEBUGPROCARBFunc)
mkGLDEBUGPROCARB = makeGLDEBUGPROCARB
{-# DEPRECATED mkGLDEBUGPROCKHR "Use 'makeGLDEBUGPROCKHR' instead." #-}
mkGLDEBUGPROCKHR :: GLDEBUGPROCKHRFunc -> IO (FunPtr GLDEBUGPROCKHRFunc)
mkGLDEBUGPROCKHR = makeGLDEBUGPROCKHR