-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGLPUniformBase.c
366 lines (324 loc) · 9.88 KB
/
GLPUniformBase.c
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
#include "GLPUniformBase.h"
void glpUniform1f(GLuint program, GLint location, GLfloat x)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform1fEXT(program, location, x);
#else
glUseProgram(program);
glUniform1f(location, x);
#endif
}
void glpUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform2fEXT(program, location, x, y);
#else
glUseProgram(program);
glUniform2f(location, x, y);
#endif
}
void glpUniform3f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform3fEXT(program, location, x, y, z);
#else
glUseProgram(program);
glUniform3f(location, x, y, z);
#endif
}
void glpUniform4f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform4fEXT(program, location, x, y, z, w);
#else
glUseProgram(program);
glUniform4f(location, x, y, z, w);
#endif
}
void glpUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform1fvEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform1fv(location, count, v);
#endif
}
void glpUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform2fvEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform2fv(location, count, v);
#endif
}
void glpUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform3fvEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform3fv(location, count, v);
#endif
}
void glpUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform4fvEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform4fv(location, count, v);
#endif
}
void glpUniform1i(GLuint program, GLint location, GLint x)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform1iEXT(program, location, x);
#else
glUseProgram(program);
glUniform1i(location, x);
#endif
}
void glpUniform2i(GLuint program, GLint location, GLint x, GLint y)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform2iEXT(program, location, x, y);
#else
glUseProgram(program);
glUniform2i(location, x, y);
#endif
}
void glpUniform3i(GLuint program, GLint location, GLint x, GLint y, GLint z)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform3iEXT(program, location, x, y, z);
#else
glUseProgram(program);
glUniform3i(location, x, y, z);
#endif
}
void glpUniform4i(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform4iEXT(program, location, x, y, z, w);
#else
glUseProgram(program);
glUniform4i(location, x, y, z, w);
#endif
}
void glpUniform1iv(GLuint program, GLint location, GLsizei count, const GLint* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform1ivEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform1iv(location, count, v);
#endif
}
void glpUniform2iv(GLuint program, GLint location, GLsizei count, const GLint* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform2ivEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform2iv(location, count, v);
#endif
}
void glpUniform3iv(GLuint program, GLint location, GLsizei count, const GLint* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform3ivEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform3iv(location, count, v);
#endif
}
void glpUniform4iv(GLuint program, GLint location, GLsizei count, const GLint* v)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniform4ivEXT(program, location, count, v);
#else
glUseProgram(program);
glUniform4iv(location, count, v);
#endif
}
void glpUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniformMatrix2fvEXT(program, location, count, transpose, value);
#else
glUseProgram(program);
glUniformMatrix2fv(location, count, transpose, value);
#endif
}
void glpUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniformMatrix3fvEXT(program, location, count, transpose, value);
#else
glUseProgram(program);
glUniformMatrix3fv(location, count, transpose, value);
#endif
}
void glpUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
{
#if defined(GL_EXT_separate_shader_objects) && (GL_EXT_separate_shader_objects > 0)
glProgramUniformMatrix4fvEXT(program, location, count, transpose, value);
#else
glUseProgram(program);
glUniformMatrix4fv(location, count, transpose, value);
#endif
}
void glpUniformNamed1f(GLuint program, const GLchar* name, GLfloat x)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform1f(program, location, x);
}
}
void glpUniformNamed2f(GLuint program, const GLchar* name, GLfloat x, GLfloat y)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform2f(program, location, x, y);
}
}
void glpUniformNamed3f(GLuint program, const GLchar* name, GLfloat x, GLfloat y, GLfloat z)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform3f(program, location, x, y, z);
}
}
void glpUniformNamed4f(GLuint program, const GLchar* name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform4f(program, location, x, y, z, w);
}
}
void glpUniformNamed1fv(GLuint program, const GLchar* name, GLsizei count, const GLfloat* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform1fv(program, location, count, v);
}
}
void glpUniformNamed2fv(GLuint program, const GLchar* name, GLsizei count, const GLfloat* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform2fv(program, location, count, v);
}
}
void glpUniformNamed3fv(GLuint program, const GLchar* name, GLsizei count, const GLfloat* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform3fv(program, location, count, v);
}
}
void glpUniformNamed4fv(GLuint program, const GLchar* name, GLsizei count, const GLfloat* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform4fv(program, location, count, v);
}
}
void glpUniformNamed1i(GLuint program, const GLchar* name, GLint x)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform1i(program, location, x);
}
}
void glpUniformNamed2i(GLuint program, const GLchar* name, GLint x, GLint y)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform2i(program, location, x, y);
}
}
void glpUniformNamed3i(GLuint program, const GLchar* name, GLint x, GLint y, GLint z)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform3i(program, location, x, y, z);
}
}
void glpUniformNamed4i(GLuint program, const GLchar* name, GLint x, GLint y, GLint z, GLint w)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform4i(program, location, x, y, z, w);
}
}
void glpUniformNamed1iv(GLuint program, const GLchar* name, GLsizei count, const GLint* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform1iv(program, location, count, v);
}
}
void glpUniformNamed2iv(GLuint program, const GLchar* name, GLsizei count, const GLint* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform2iv(program, location, count, v);
}
}
void glpUniformNamed3iv(GLuint program, const GLchar* name, GLsizei count, const GLint* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform3iv(program, location, count, v);
}
}
void glpUniformNamed4iv(GLuint program, const GLchar* name, GLsizei count, const GLint* v)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniform4iv(program, location, count, v);
}
}
void glpUniformNamedMatrix2fv(GLuint program, const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniformMatrix2fv(program, location, count, transpose, value);
}
}
void glpUniformNamedMatrix3fv(GLuint program, const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniformMatrix3fv(program, location, count, transpose, value);
}
}
void glpUniformNamedMatrix4fv(GLuint program, const GLchar* name, GLsizei count, GLboolean transpose, const GLfloat* value)
{
GLint location = glGetUniformLocation(program, name);
if(location != -1)
{
glpUniformMatrix4fv(program, location, count, transpose, value);
}
}