This repository was archived by the owner on May 31, 2020. It is now read-only.
Commit 9a26e11
committed
Change the generated commands script.
Commands and their type info are now kept in a hash of function names to
hashes of data types (GL_COMMAND_TYPES). This effectively allows me to query a function's info rather than just loading it and hoping it exists. As a result, the loading code can be reduce to a call to __load_gl_sym__, which is also included in the generated code. I should probably break it off into the GlSym code but for now this'll do.
The upshot to this is that loading a symbol no longer raises exceptions
if it doesn't exist. It simply returns the wrapped function if loaded or
false if not. So, if you load a symbol and it's not there, the exception
only comes from attempting to use that symbol. So, it's better now to
query whether the function is loaded first rather than using it if I
can't be certain it's available.
Also, Gl#have_gl_command? is now a thing, so the above query is now doable as well. There's also Gl#load_all_gl_commands!, which does what it says on the tin.
--
GlSym is now a submodule of Gl. __load_gl_sym__ caches the loaded function. It also stores the command types because I didn't want to make those part of the Gl module (and thereby accidentally infect the global namespace if someone does `include Gl`, which sounds pretty reasonable to me).1 parent fbca139 commit 9a26e11
File tree
4 files changed
+62
-28
lines changed- ext/opengl-core
- lib
- opengl-core
4 files changed
+62
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | 227 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 242 | + | |
| 243 | + | |
246 | 244 | | |
247 | | - | |
| 245 | + | |
248 | 246 | | |
| 247 | + | |
249 | 248 | | |
250 | | - | |
251 | | - | |
252 | 249 | | |
253 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
7 | 17 | | |
| 18 | + | |
8 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
6 | 13 | | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
11 | | - | |
12 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
13 | 23 | | |
14 | 24 | | |
15 | 25 | | |
| |||
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
27 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
28 | 49 | | |
29 | 50 | | |
30 | 51 | | |
0 commit comments