Fix a number of MINGW32 issues
[mesa.git] / src / mesa / main / shaders.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5.3
4 *
5 * Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #include "glheader.h"
27 #include "context.h"
28 #include "shaders.h"
29
30
31 /**
32 * These are basically just wrappers/adaptors for calling the
33 * ctx->Driver.foobar() GLSL-related functions.
34 *
35 * Things are biased toward the OpenGL 2.0 functions rather than the
36 * ARB extensions (i.e. the ARB functions are layered on the 2.0 functions).
37 *
38 * The general idea here is to allow enough modularity such that a
39 * completely different GLSL implemenation can be plugged in and co-exist
40 * with Mesa's native GLSL code.
41 */
42
43
44
45 void GLAPIENTRY
46 _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
47 {
48 GET_CURRENT_CONTEXT(ctx);
49 ctx->Driver.AttachShader(ctx, program, shader);
50 }
51
52
53 void GLAPIENTRY
54 _mesa_AttachShader(GLuint program, GLuint shader)
55 {
56 GET_CURRENT_CONTEXT(ctx);
57 ctx->Driver.AttachShader(ctx, program, shader);
58 }
59
60
61 void GLAPIENTRY
62 _mesa_BindAttribLocationARB(GLhandleARB program, GLuint index,
63 const GLcharARB *name)
64 {
65 GET_CURRENT_CONTEXT(ctx);
66 ctx->Driver.BindAttribLocation(ctx, program, index, name);
67 }
68
69
70 void GLAPIENTRY
71 _mesa_CompileShaderARB(GLhandleARB shaderObj)
72 {
73 GET_CURRENT_CONTEXT(ctx);
74 ctx->Driver.CompileShader(ctx, shaderObj);
75 }
76
77
78 GLuint GLAPIENTRY
79 _mesa_CreateShader(GLenum type)
80 {
81 GET_CURRENT_CONTEXT(ctx);
82 return ctx->Driver.CreateShader(ctx, type);
83 }
84
85
86 GLhandleARB GLAPIENTRY
87 _mesa_CreateShaderObjectARB(GLenum type)
88 {
89 GET_CURRENT_CONTEXT(ctx);
90 return ctx->Driver.CreateShader(ctx, type);
91 }
92
93
94 GLuint GLAPIENTRY
95 _mesa_CreateProgram(void)
96 {
97 GET_CURRENT_CONTEXT(ctx);
98 return ctx->Driver.CreateProgram(ctx);
99 }
100
101
102 GLhandleARB GLAPIENTRY
103 _mesa_CreateProgramObjectARB(void)
104 {
105 GET_CURRENT_CONTEXT(ctx);
106 return ctx->Driver.CreateProgram(ctx);
107 }
108
109
110 void GLAPIENTRY
111 _mesa_DeleteObjectARB(GLhandleARB obj)
112 {
113 if (obj) {
114 GET_CURRENT_CONTEXT(ctx);
115 if (ctx->Driver.IsProgram(ctx, obj)) {
116 ctx->Driver.DeleteProgram2(ctx, obj);
117 }
118 else if (ctx->Driver.IsShader(ctx, obj)) {
119 ctx->Driver.DeleteShader(ctx, obj);
120 }
121 else {
122 /* error? */
123 }
124 }
125 }
126
127
128 void GLAPIENTRY
129 _mesa_DeleteProgram(GLuint name)
130 {
131 if (name) {
132 GET_CURRENT_CONTEXT(ctx);
133 ctx->Driver.DeleteProgram2(ctx, name);
134 }
135 }
136
137
138 void GLAPIENTRY
139 _mesa_DeleteShader(GLuint name)
140 {
141 if (name) {
142 GET_CURRENT_CONTEXT(ctx);
143 ctx->Driver.DeleteShader(ctx, name);
144 }
145 }
146
147
148 void GLAPIENTRY
149 _mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
150 {
151 GET_CURRENT_CONTEXT(ctx);
152 ctx->Driver.DetachShader(ctx, program, shader);
153 }
154
155
156 void GLAPIENTRY
157 _mesa_DetachShader(GLuint program, GLuint shader)
158 {
159 GET_CURRENT_CONTEXT(ctx);
160 ctx->Driver.DetachShader(ctx, program, shader);
161 }
162
163
164 void GLAPIENTRY
165 _mesa_GetActiveAttribARB(GLhandleARB program, GLuint index,
166 GLsizei maxLength, GLsizei * length, GLint * size,
167 GLenum * type, GLcharARB * name)
168 {
169 GET_CURRENT_CONTEXT(ctx);
170 ctx->Driver.GetActiveAttrib(ctx, program, index, maxLength, length, size,
171 type, name);
172 }
173
174
175 void GLAPIENTRY
176 _mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
177 GLsizei maxLength, GLsizei * length, GLint * size,
178 GLenum * type, GLcharARB * name)
179 {
180 GET_CURRENT_CONTEXT(ctx);
181 ctx->Driver.GetActiveUniform(ctx, program, index, maxLength, length, size,
182 type, name);
183 }
184
185
186 void GLAPIENTRY
187 _mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
188 GLsizei * count, GLhandleARB * obj)
189 {
190 GET_CURRENT_CONTEXT(ctx);
191 ctx->Driver.GetAttachedShaders(ctx, container, maxCount, count, obj);
192 }
193
194
195 void GLAPIENTRY
196 _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
197 GLsizei *count, GLuint *obj)
198 {
199 GET_CURRENT_CONTEXT(ctx);
200 ctx->Driver.GetAttachedShaders(ctx, program, maxCount, count, obj);
201 }
202
203
204 GLint GLAPIENTRY
205 _mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
206 {
207 GET_CURRENT_CONTEXT(ctx);
208 return ctx->Driver.GetAttribLocation(ctx, program, name);
209 }
210
211
212 void GLAPIENTRY
213 _mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length,
214 GLcharARB * infoLog)
215 {
216 GET_CURRENT_CONTEXT(ctx);
217 /* Implement in terms of GetProgramInfoLog, GetShaderInfoLog */
218 if (ctx->Driver.IsProgram(ctx, object)) {
219 ctx->Driver.GetProgramInfoLog(ctx, object, maxLength, length, infoLog);
220 }
221 else if (ctx->Driver.IsShader(ctx, object)) {
222 ctx->Driver.GetShaderInfoLog(ctx, object, maxLength, length, infoLog);
223 }
224 else {
225 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB");
226 }
227 }
228
229
230 void GLAPIENTRY
231 _mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params)
232 {
233 GET_CURRENT_CONTEXT(ctx);
234 /* Implement in terms of GetProgramiv, GetShaderiv */
235 if (ctx->Driver.IsProgram(ctx, object)) {
236 ctx->Driver.GetProgramiv(ctx, object, pname, params);
237 }
238 else if (ctx->Driver.IsShader(ctx, object)) {
239 ctx->Driver.GetShaderiv(ctx, object, pname, params);
240 }
241 else {
242 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
243 }
244 }
245
246
247 void GLAPIENTRY
248 _mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname,
249 GLfloat *params)
250 {
251 GLint iparams[1]; /* XXX is one element enough? */
252 _mesa_GetObjectParameterivARB(object, pname, iparams);
253 params[0] = (GLfloat) iparams[0];
254 }
255
256
257 void GLAPIENTRY
258 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
259 {
260 GET_CURRENT_CONTEXT(ctx);
261 ctx->Driver.GetProgramiv(ctx, program, pname, params);
262 }
263
264
265 void GLAPIENTRY
266 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
267 {
268 GET_CURRENT_CONTEXT(ctx);
269 ctx->Driver.GetShaderiv(ctx, shader, pname, params);
270 }
271
272
273 void GLAPIENTRY
274 _mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
275 GLsizei *length, GLchar *infoLog)
276 {
277 GET_CURRENT_CONTEXT(ctx);
278 ctx->Driver.GetProgramInfoLog(ctx, program, bufSize, length, infoLog);
279 }
280
281
282 void GLAPIENTRY
283 _mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
284 GLsizei *length, GLchar *infoLog)
285 {
286 GET_CURRENT_CONTEXT(ctx);
287 ctx->Driver.GetShaderInfoLog(ctx, shader, bufSize, length, infoLog);
288 }
289
290
291 void GLAPIENTRY
292 _mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
293 GLsizei *length, GLcharARB *sourceOut)
294 {
295 GET_CURRENT_CONTEXT(ctx);
296 ctx->Driver.GetShaderSource(ctx, shader, maxLength, length, sourceOut);
297 }
298
299
300 void GLAPIENTRY
301 _mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat * params)
302 {
303 GET_CURRENT_CONTEXT(ctx);
304 ctx->Driver.GetUniformfv(ctx, program, location, params);
305 }
306
307
308 void GLAPIENTRY
309 _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
310 {
311 GET_CURRENT_CONTEXT(ctx);
312 GLfloat fparams[16]; /* XXX is 16 enough? */
313 GLuint i;
314 ctx->Driver.GetUniformfv(ctx, program, location, fparams);
315 for (i = 0; i < 16; i++)
316 params[i] = (GLint) fparams[i]; /* XXX correct? */
317 }
318
319
320
321 #if 0
322 GLint GLAPIENTRY
323 _mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
324 {
325 GET_CURRENT_CONTEXT(ctx);
326 return ctx->Driver.GetUniformLocation(ctx, program, name);
327 }
328 #endif
329
330
331 GLhandleARB GLAPIENTRY
332 _mesa_GetHandleARB(GLenum pname)
333 {
334 GET_CURRENT_CONTEXT(ctx);
335 return ctx->Driver.GetHandle(ctx, pname);
336 }
337
338
339 GLint GLAPIENTRY
340 _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
341 {
342 GET_CURRENT_CONTEXT(ctx);
343 return ctx->Driver.GetUniformLocation(ctx, programObj, name);
344 }
345
346
347 GLboolean GLAPIENTRY
348 _mesa_IsProgram(GLuint name)
349 {
350 GET_CURRENT_CONTEXT(ctx);
351 return ctx->Driver.IsProgram(ctx, name);
352 }
353
354
355 GLboolean GLAPIENTRY
356 _mesa_IsShader(GLuint name)
357 {
358 GET_CURRENT_CONTEXT(ctx);
359 return ctx->Driver.IsShader(ctx, name);
360 }
361
362
363 void GLAPIENTRY
364 _mesa_LinkProgramARB(GLhandleARB programObj)
365 {
366 GET_CURRENT_CONTEXT(ctx);
367 ctx->Driver.LinkProgram(ctx, programObj);
368 }
369
370
371 /**
372 * Called via glShaderSource() and glShaderSourceARB() API functions.
373 * Basically, concatenate the source code strings into one long string
374 * and pass it to ctx->Driver.ShaderSource().
375 */
376 void GLAPIENTRY
377 _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
378 const GLcharARB ** string, const GLint * length)
379 {
380 GET_CURRENT_CONTEXT(ctx);
381 GLint *offsets;
382 GLsizei i, totalLength;
383 GLcharARB *source;
384
385 if (string == NULL) {
386 _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
387 return;
388 }
389
390 /*
391 * This array holds offsets of where the appropriate string ends, thus the
392 * last element will be set to the total length of the source code.
393 */
394 offsets = (GLint *) _mesa_malloc(count * sizeof(GLint));
395 if (offsets == NULL) {
396 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
397 return;
398 }
399
400 for (i = 0; i < count; i++) {
401 if (string[i] == NULL) {
402 _mesa_free((GLvoid *) offsets);
403 _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB(null string)");
404 return;
405 }
406 if (length == NULL || length[i] < 0)
407 offsets[i] = _mesa_strlen(string[i]);
408 else
409 offsets[i] = length[i];
410 /* accumulate string lengths */
411 if (i > 0)
412 offsets[i] += offsets[i - 1];
413 }
414
415 /* Total length of source string is sum off all strings plus two.
416 * One extra byte for terminating zero, another extra byte to silence
417 * valgrind warnings in the parser/grammer code.
418 */
419 totalLength = offsets[count - 1] + 2;
420 source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB));
421 if (source == NULL) {
422 _mesa_free((GLvoid *) offsets);
423 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
424 return;
425 }
426
427 for (i = 0; i < count; i++) {
428 GLint start = (i > 0) ? offsets[i - 1] : 0;
429 _mesa_memcpy(source + start, string[i],
430 (offsets[i] - start) * sizeof(GLcharARB));
431 }
432 source[totalLength - 1] = '\0';
433 source[totalLength - 2] = '\0';
434
435 ctx->Driver.ShaderSource(ctx, shaderObj, source);
436
437 _mesa_free(offsets);
438 }
439
440
441 void GLAPIENTRY
442 _mesa_Uniform1fARB(GLint location, GLfloat v0)
443 {
444 GET_CURRENT_CONTEXT(ctx);
445 ctx->Driver.Uniform(ctx, location, 1, &v0, GL_FLOAT);
446 }
447
448 void GLAPIENTRY
449 _mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1)
450 {
451 GET_CURRENT_CONTEXT(ctx);
452 GLfloat v[2];
453 v[0] = v0;
454 v[1] = v1;
455 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC2);
456 }
457
458 void GLAPIENTRY
459 _mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
460 {
461 GET_CURRENT_CONTEXT(ctx);
462 GLfloat v[3];
463 v[0] = v0;
464 v[1] = v1;
465 v[2] = v2;
466 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC3);
467 }
468
469 void GLAPIENTRY
470 _mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
471 GLfloat v3)
472 {
473 GET_CURRENT_CONTEXT(ctx);
474 GLfloat v[4];
475 v[0] = v0;
476 v[1] = v1;
477 v[2] = v2;
478 v[3] = v3;
479 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC4);
480 }
481
482 void GLAPIENTRY
483 _mesa_Uniform1iARB(GLint location, GLint v0)
484 {
485 GET_CURRENT_CONTEXT(ctx);
486 ctx->Driver.Uniform(ctx, location, 1, &v0, GL_INT);
487 }
488
489 void GLAPIENTRY
490 _mesa_Uniform2iARB(GLint location, GLint v0, GLint v1)
491 {
492 GET_CURRENT_CONTEXT(ctx);
493 GLint v[2];
494 v[0] = v0;
495 v[1] = v1;
496 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC2);
497 }
498
499 void GLAPIENTRY
500 _mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2)
501 {
502 GET_CURRENT_CONTEXT(ctx);
503 GLint v[3];
504 v[0] = v0;
505 v[1] = v1;
506 v[2] = v2;
507 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC3);
508 }
509
510 void GLAPIENTRY
511 _mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
512 {
513 GET_CURRENT_CONTEXT(ctx);
514 GLint v[4];
515 v[0] = v0;
516 v[1] = v1;
517 v[2] = v2;
518 v[3] = v3;
519 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC4);
520 }
521
522 void GLAPIENTRY
523 _mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value)
524 {
525 GET_CURRENT_CONTEXT(ctx);
526 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT);
527 }
528
529 void GLAPIENTRY
530 _mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value)
531 {
532 GET_CURRENT_CONTEXT(ctx);
533 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC2);
534 }
535
536 void GLAPIENTRY
537 _mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value)
538 {
539 GET_CURRENT_CONTEXT(ctx);
540 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC3);
541 }
542
543 void GLAPIENTRY
544 _mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value)
545 {
546 GET_CURRENT_CONTEXT(ctx);
547 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC4);
548 }
549
550 void GLAPIENTRY
551 _mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value)
552 {
553 GET_CURRENT_CONTEXT(ctx);
554 ctx->Driver.Uniform(ctx, location, count, value, GL_INT);
555 }
556
557 void GLAPIENTRY
558 _mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value)
559 {
560 GET_CURRENT_CONTEXT(ctx);
561 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC2);
562 }
563
564 void GLAPIENTRY
565 _mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value)
566 {
567 GET_CURRENT_CONTEXT(ctx);
568 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC3);
569 }
570
571 void GLAPIENTRY
572 _mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value)
573 {
574 GET_CURRENT_CONTEXT(ctx);
575 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC4);
576 }
577
578
579 void GLAPIENTRY
580 _mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
581 const GLfloat * value)
582 {
583 GET_CURRENT_CONTEXT(ctx);
584 ctx->Driver.UniformMatrix(ctx, 2, 2, GL_FLOAT_MAT2,
585 location, count, transpose, value);
586 }
587
588 void GLAPIENTRY
589 _mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
590 const GLfloat * value)
591 {
592 GET_CURRENT_CONTEXT(ctx);
593 ctx->Driver.UniformMatrix(ctx, 3, 3, GL_FLOAT_MAT3,
594 location, count, transpose, value);
595 }
596
597 void GLAPIENTRY
598 _mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
599 const GLfloat * value)
600 {
601 GET_CURRENT_CONTEXT(ctx);
602 ctx->Driver.UniformMatrix(ctx, 4, 4, GL_FLOAT_MAT4,
603 location, count, transpose, value);
604 }
605
606
607 /**
608 * Non-square UniformMatrix are OpenGL 2.1
609 */
610 void GLAPIENTRY
611 _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
612 const GLfloat *value)
613 {
614 GET_CURRENT_CONTEXT(ctx);
615 ctx->Driver.UniformMatrix(ctx, 2, 3, GL_FLOAT_MAT2x3,
616 location, count, transpose, value);
617 }
618
619 void GLAPIENTRY
620 _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
621 const GLfloat *value)
622 {
623 GET_CURRENT_CONTEXT(ctx);
624 ctx->Driver.UniformMatrix(ctx, 3, 2, GL_FLOAT_MAT3x2,
625 location, count, transpose, value);
626 }
627
628 void GLAPIENTRY
629 _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
630 const GLfloat *value)
631 {
632 GET_CURRENT_CONTEXT(ctx);
633 ctx->Driver.UniformMatrix(ctx, 2, 4, GL_FLOAT_MAT2x4,
634 location, count, transpose, value);
635 }
636
637 void GLAPIENTRY
638 _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
639 const GLfloat *value)
640 {
641 GET_CURRENT_CONTEXT(ctx);
642 ctx->Driver.UniformMatrix(ctx, 4, 2, GL_FLOAT_MAT4x2,
643 location, count, transpose, value);
644 }
645
646 void GLAPIENTRY
647 _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
648 const GLfloat *value)
649 {
650 GET_CURRENT_CONTEXT(ctx);
651 ctx->Driver.UniformMatrix(ctx, 3, 4, GL_FLOAT_MAT3x4,
652 location, count, transpose, value);
653 }
654
655 void GLAPIENTRY
656 _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
657 const GLfloat *value)
658 {
659 GET_CURRENT_CONTEXT(ctx);
660 ctx->Driver.UniformMatrix(ctx, 4, 3, GL_FLOAT_MAT4x3,
661 location, count, transpose, value);
662 }
663
664
665 void GLAPIENTRY
666 _mesa_UseProgramObjectARB(GLhandleARB program)
667 {
668 GET_CURRENT_CONTEXT(ctx);
669 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
670 ctx->Driver.UseProgram(ctx, program);
671 }
672
673
674 void GLAPIENTRY
675 _mesa_ValidateProgramARB(GLhandleARB program)
676 {
677 GET_CURRENT_CONTEXT(ctx);
678 ctx->Driver.ValidateProgram(ctx, program);
679 }
680