alloc an extra byte in _mesa_ShaderSourceARB() to silence a valgrind warning
[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 APIENTRY
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 APIENTRY
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 GET_CURRENT_CONTEXT(ctx);
114 if (ctx->Driver.IsProgram(ctx, obj)) {
115 ctx->Driver.DeleteProgram2(ctx, obj);
116 }
117 else if (ctx->Driver.IsShader(ctx, obj)) {
118 ctx->Driver.DeleteShader(ctx, obj);
119 }
120 else {
121 /* error? */
122 }
123 }
124
125
126 void GLAPIENTRY
127 _mesa_DeleteProgram(GLuint name)
128 {
129 GET_CURRENT_CONTEXT(ctx);
130 ctx->Driver.DeleteProgram2(ctx, name);
131 }
132
133
134 void GLAPIENTRY
135 _mesa_DeleteShader(GLuint name)
136 {
137 GET_CURRENT_CONTEXT(ctx);
138 ctx->Driver.DeleteShader(ctx, name);
139 }
140
141
142 void GLAPIENTRY
143 _mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
144 {
145 GET_CURRENT_CONTEXT(ctx);
146 ctx->Driver.DetachShader(ctx, program, shader);
147 }
148
149
150 void GLAPIENTRY
151 _mesa_DetachShader(GLuint program, GLuint shader)
152 {
153 GET_CURRENT_CONTEXT(ctx);
154 ctx->Driver.DetachShader(ctx, program, shader);
155 }
156
157
158 void GLAPIENTRY
159 _mesa_GetActiveAttribARB(GLhandleARB program, GLuint index,
160 GLsizei maxLength, GLsizei * length, GLint * size,
161 GLenum * type, GLcharARB * name)
162 {
163 GET_CURRENT_CONTEXT(ctx);
164 ctx->Driver.GetActiveAttrib(ctx, program, index, maxLength, length, size,
165 type, name);
166 }
167
168
169 void GLAPIENTRY
170 _mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
171 GLsizei maxLength, GLsizei * length, GLint * size,
172 GLenum * type, GLcharARB * name)
173 {
174 GET_CURRENT_CONTEXT(ctx);
175 ctx->Driver.GetActiveUniform(ctx, program, index, maxLength, length, size,
176 type, name);
177 }
178
179
180 void GLAPIENTRY
181 _mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
182 GLsizei * count, GLhandleARB * obj)
183 {
184 GET_CURRENT_CONTEXT(ctx);
185 ctx->Driver.GetAttachedShaders(ctx, container, maxCount, count, obj);
186 }
187
188
189 void GLAPIENTRY
190 _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
191 GLsizei *count, GLuint *obj)
192 {
193 GET_CURRENT_CONTEXT(ctx);
194 ctx->Driver.GetAttachedShaders(ctx, program, maxCount, count, obj);
195 }
196
197
198 GLint GLAPIENTRY
199 _mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
200 {
201 GET_CURRENT_CONTEXT(ctx);
202 return ctx->Driver.GetAttribLocation(ctx, program, name);
203 }
204
205
206 void GLAPIENTRY
207 _mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length,
208 GLcharARB * infoLog)
209 {
210 GET_CURRENT_CONTEXT(ctx);
211 /* Implement in terms of GetProgramInfoLog, GetShaderInfoLog */
212 if (ctx->Driver.IsProgram(ctx, object)) {
213 ctx->Driver.GetProgramInfoLog(ctx, object, maxLength, length, infoLog);
214 }
215 else if (ctx->Driver.IsShader(ctx, object)) {
216 ctx->Driver.GetShaderInfoLog(ctx, object, maxLength, length, infoLog);
217 }
218 else {
219 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB");
220 }
221 }
222
223
224 void GLAPIENTRY
225 _mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params)
226 {
227 GET_CURRENT_CONTEXT(ctx);
228 /* Implement in terms of GetProgramiv, GetShaderiv */
229 if (ctx->Driver.IsProgram(ctx, object)) {
230 ctx->Driver.GetProgramiv(ctx, object, pname, params);
231 }
232 else if (ctx->Driver.IsShader(ctx, object)) {
233 ctx->Driver.GetShaderiv(ctx, object, pname, params);
234 }
235 else {
236 _mesa_error(ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
237 }
238 }
239
240
241 void GLAPIENTRY
242 _mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname,
243 GLfloat *params)
244 {
245 GLint iparams[1]; /* XXX is one element enough? */
246 _mesa_GetObjectParameterivARB(object, pname, iparams);
247 params[0] = (GLfloat) iparams[0];
248 }
249
250
251 void GLAPIENTRY
252 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
253 {
254 GET_CURRENT_CONTEXT(ctx);
255 ctx->Driver.GetProgramiv(ctx, program, pname, params);
256 }
257
258
259 void GLAPIENTRY
260 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
261 {
262 GET_CURRENT_CONTEXT(ctx);
263 ctx->Driver.GetShaderiv(ctx, shader, pname, params);
264 }
265
266
267 void GLAPIENTRY
268 _mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
269 GLsizei *length, GLchar *infoLog)
270 {
271 GET_CURRENT_CONTEXT(ctx);
272 ctx->Driver.GetProgramInfoLog(ctx, program, bufSize, length, infoLog);
273 }
274
275
276 void GLAPIENTRY
277 _mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
278 GLsizei *length, GLchar *infoLog)
279 {
280 GET_CURRENT_CONTEXT(ctx);
281 ctx->Driver.GetShaderInfoLog(ctx, shader, bufSize, length, infoLog);
282 }
283
284
285 void GLAPIENTRY
286 _mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
287 GLsizei *length, GLcharARB *sourceOut)
288 {
289 GET_CURRENT_CONTEXT(ctx);
290 ctx->Driver.GetShaderSource(ctx, shader, maxLength, length, sourceOut);
291 }
292
293
294 void GLAPIENTRY
295 _mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat * params)
296 {
297 GET_CURRENT_CONTEXT(ctx);
298 ctx->Driver.GetUniformfv(ctx, program, location, params);
299 }
300
301
302 void GLAPIENTRY
303 _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
304 {
305 GET_CURRENT_CONTEXT(ctx);
306 GLfloat fparams[16]; /* XXX is 16 enough? */
307 GLuint i;
308 ctx->Driver.GetUniformfv(ctx, program, location, fparams);
309 for (i = 0; i < 16; i++)
310 params[i] = (GLint) fparams[i]; /* XXX correct? */
311 }
312
313
314
315 #if 0
316 GLint APIENTRY
317 _mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
318 {
319 GET_CURRENT_CONTEXT(ctx);
320 return ctx->Driver.GetUniformLocation(ctx, program, name);
321 }
322 #endif
323
324
325 GLhandleARB GLAPIENTRY
326 _mesa_GetHandleARB(GLenum pname)
327 {
328 GET_CURRENT_CONTEXT(ctx);
329 return ctx->Driver.GetHandle(ctx, pname);
330 }
331
332
333 GLint APIENTRY
334 _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
335 {
336 GET_CURRENT_CONTEXT(ctx);
337 return ctx->Driver.GetUniformLocation(ctx, programObj, name);
338 }
339
340
341 GLboolean GLAPIENTRY
342 _mesa_IsProgram(GLuint name)
343 {
344 GET_CURRENT_CONTEXT(ctx);
345 return ctx->Driver.IsProgram(ctx, name);
346 }
347
348
349 GLboolean GLAPIENTRY
350 _mesa_IsShader(GLuint name)
351 {
352 GET_CURRENT_CONTEXT(ctx);
353 return ctx->Driver.IsShader(ctx, name);
354 }
355
356
357 void GLAPIENTRY
358 _mesa_LinkProgramARB(GLhandleARB programObj)
359 {
360 GET_CURRENT_CONTEXT(ctx);
361 ctx->Driver.LinkProgram(ctx, programObj);
362 }
363
364
365 /**
366 * Called via glShaderSource() and glShaderSourceARB() API functions.
367 * Basically, concatenate the source code strings into one long string
368 * and pass it to ctx->Driver.ShaderSource().
369 */
370 void GLAPIENTRY
371 _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
372 const GLcharARB ** string, const GLint * length)
373 {
374 GET_CURRENT_CONTEXT(ctx);
375 GLint *offsets;
376 GLsizei i, totalLength;
377 GLcharARB *source;
378
379 if (string == NULL) {
380 _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
381 return;
382 }
383
384 /*
385 * This array holds offsets of where the appropriate string ends, thus the
386 * last element will be set to the total length of the source code.
387 */
388 offsets = (GLint *) _mesa_malloc(count * sizeof(GLint));
389 if (offsets == NULL) {
390 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
391 return;
392 }
393
394 for (i = 0; i < count; i++) {
395 if (string[i] == NULL) {
396 _mesa_free((GLvoid *) offsets);
397 _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB(null string)");
398 return;
399 }
400 if (length == NULL || length[i] < 0)
401 offsets[i] = _mesa_strlen(string[i]);
402 else
403 offsets[i] = length[i];
404 /* accumulate string lengths */
405 if (i > 0)
406 offsets[i] += offsets[i - 1];
407 }
408
409 /* Total length of source string is sum off all strings plus two.
410 * One extra byte for terminating zero, another extra byte to silence
411 * valgrind warnings in the parser/grammer code.
412 */
413 totalLength = offsets[count - 1] + 2;
414 source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB));
415 if (source == NULL) {
416 _mesa_free((GLvoid *) offsets);
417 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
418 return;
419 }
420
421 for (i = 0; i < count; i++) {
422 GLint start = (i > 0) ? offsets[i - 1] : 0;
423 _mesa_memcpy(source + start, string[i],
424 (offsets[i] - start) * sizeof(GLcharARB));
425 }
426 source[totalLength - 1] = '\0';
427 source[totalLength - 2] = '\0';
428
429 ctx->Driver.ShaderSource(ctx, shaderObj, source);
430
431 _mesa_free(offsets);
432 }
433
434
435 void GLAPIENTRY
436 _mesa_Uniform1fARB(GLint location, GLfloat v0)
437 {
438 GET_CURRENT_CONTEXT(ctx);
439 ctx->Driver.Uniform(ctx, location, 1, &v0, GL_FLOAT);
440 }
441
442 void GLAPIENTRY
443 _mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1)
444 {
445 GET_CURRENT_CONTEXT(ctx);
446 GLfloat v[2];
447 v[0] = v0;
448 v[1] = v1;
449 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC2);
450 }
451
452 void GLAPIENTRY
453 _mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
454 {
455 GET_CURRENT_CONTEXT(ctx);
456 GLfloat v[3];
457 v[0] = v0;
458 v[1] = v1;
459 v[2] = v2;
460 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC3);
461 }
462
463 void GLAPIENTRY
464 _mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
465 GLfloat v3)
466 {
467 GET_CURRENT_CONTEXT(ctx);
468 GLfloat v[4];
469 v[0] = v0;
470 v[1] = v1;
471 v[2] = v2;
472 v[3] = v3;
473 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC4);
474 }
475
476 void GLAPIENTRY
477 _mesa_Uniform1iARB(GLint location, GLint v0)
478 {
479 GET_CURRENT_CONTEXT(ctx);
480 ctx->Driver.Uniform(ctx, location, 1, &v0, GL_INT);
481 }
482
483 void GLAPIENTRY
484 _mesa_Uniform2iARB(GLint location, GLint v0, GLint v1)
485 {
486 GET_CURRENT_CONTEXT(ctx);
487 GLint v[2];
488 v[0] = v0;
489 v[1] = v1;
490 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC2);
491 }
492
493 void GLAPIENTRY
494 _mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2)
495 {
496 GET_CURRENT_CONTEXT(ctx);
497 GLint v[3];
498 v[0] = v0;
499 v[1] = v1;
500 v[2] = v2;
501 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC3);
502 }
503
504 void GLAPIENTRY
505 _mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
506 {
507 GET_CURRENT_CONTEXT(ctx);
508 GLint v[4];
509 v[0] = v0;
510 v[1] = v1;
511 v[2] = v2;
512 v[3] = v3;
513 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC4);
514 }
515
516 void GLAPIENTRY
517 _mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value)
518 {
519 GET_CURRENT_CONTEXT(ctx);
520 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT);
521 }
522
523 void GLAPIENTRY
524 _mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value)
525 {
526 GET_CURRENT_CONTEXT(ctx);
527 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC2);
528 }
529
530 void GLAPIENTRY
531 _mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value)
532 {
533 GET_CURRENT_CONTEXT(ctx);
534 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC3);
535 }
536
537 void GLAPIENTRY
538 _mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value)
539 {
540 GET_CURRENT_CONTEXT(ctx);
541 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC4);
542 }
543
544 void GLAPIENTRY
545 _mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value)
546 {
547 GET_CURRENT_CONTEXT(ctx);
548 ctx->Driver.Uniform(ctx, location, count, value, GL_INT);
549 }
550
551 void GLAPIENTRY
552 _mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value)
553 {
554 GET_CURRENT_CONTEXT(ctx);
555 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC2);
556 }
557
558 void GLAPIENTRY
559 _mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value)
560 {
561 GET_CURRENT_CONTEXT(ctx);
562 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC3);
563 }
564
565 void GLAPIENTRY
566 _mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value)
567 {
568 GET_CURRENT_CONTEXT(ctx);
569 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC4);
570 }
571
572
573 void GLAPIENTRY
574 _mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
575 const GLfloat * value)
576 {
577 GET_CURRENT_CONTEXT(ctx);
578 ctx->Driver.UniformMatrix(ctx, 2, 2, GL_FLOAT_MAT2,
579 location, count, transpose, value);
580 }
581
582 void GLAPIENTRY
583 _mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
584 const GLfloat * value)
585 {
586 GET_CURRENT_CONTEXT(ctx);
587 ctx->Driver.UniformMatrix(ctx, 3, 3, GL_FLOAT_MAT3,
588 location, count, transpose, value);
589 }
590
591 void GLAPIENTRY
592 _mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
593 const GLfloat * value)
594 {
595 GET_CURRENT_CONTEXT(ctx);
596 ctx->Driver.UniformMatrix(ctx, 4, 4, GL_FLOAT_MAT4,
597 location, count, transpose, value);
598 }
599
600
601 /**
602 * Non-square UniformMatrix are OpenGL 2.1
603 */
604 void GLAPIENTRY
605 _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
606 const GLfloat *value)
607 {
608 GET_CURRENT_CONTEXT(ctx);
609 ctx->Driver.UniformMatrix(ctx, 2, 3, GL_FLOAT_MAT2x3,
610 location, count, transpose, value);
611 }
612
613 void GLAPIENTRY
614 _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
615 const GLfloat *value)
616 {
617 GET_CURRENT_CONTEXT(ctx);
618 ctx->Driver.UniformMatrix(ctx, 3, 2, GL_FLOAT_MAT3x2,
619 location, count, transpose, value);
620 }
621
622 void GLAPIENTRY
623 _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
624 const GLfloat *value)
625 {
626 GET_CURRENT_CONTEXT(ctx);
627 ctx->Driver.UniformMatrix(ctx, 2, 4, GL_FLOAT_MAT2x4,
628 location, count, transpose, value);
629 }
630
631 void GLAPIENTRY
632 _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
633 const GLfloat *value)
634 {
635 GET_CURRENT_CONTEXT(ctx);
636 ctx->Driver.UniformMatrix(ctx, 4, 2, GL_FLOAT_MAT4x2,
637 location, count, transpose, value);
638 }
639
640 void GLAPIENTRY
641 _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
642 const GLfloat *value)
643 {
644 GET_CURRENT_CONTEXT(ctx);
645 ctx->Driver.UniformMatrix(ctx, 3, 4, GL_FLOAT_MAT3x4,
646 location, count, transpose, value);
647 }
648
649 void GLAPIENTRY
650 _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
651 const GLfloat *value)
652 {
653 GET_CURRENT_CONTEXT(ctx);
654 ctx->Driver.UniformMatrix(ctx, 4, 3, GL_FLOAT_MAT4x3,
655 location, count, transpose, value);
656 }
657
658
659 void GLAPIENTRY
660 _mesa_UseProgramObjectARB(GLhandleARB program)
661 {
662 GET_CURRENT_CONTEXT(ctx);
663 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
664 ctx->Driver.UseProgram(ctx, program);
665 }
666
667
668 void GLAPIENTRY
669 _mesa_ValidateProgramARB(GLhandleARB program)
670 {
671 GET_CURRENT_CONTEXT(ctx);
672 ctx->Driver.ValidateProgram(ctx, program);
673 }
674