Merge branch 'mesa_7_5_branch'
[mesa.git] / src / mesa / main / shaders.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.3
4 *
5 * Copyright (C) 2004-2008 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 if (pname == GL_OBJECT_TYPE_ARB) {
237 *params = GL_PROGRAM_OBJECT_ARB;
238 }
239 else {
240 ctx->Driver.GetProgramiv(ctx, object, pname, params);
241 }
242 }
243 else if (ctx->Driver.IsShader(ctx, object)) {
244 if (pname == GL_OBJECT_TYPE_ARB) {
245 *params = GL_SHADER_OBJECT_ARB;
246 }
247 else {
248 ctx->Driver.GetShaderiv(ctx, object, pname, params);
249 }
250 }
251 else {
252 _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB");
253 }
254 }
255
256
257 void GLAPIENTRY
258 _mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname,
259 GLfloat *params)
260 {
261 GLint iparams[1]; /* XXX is one element enough? */
262 _mesa_GetObjectParameterivARB(object, pname, iparams);
263 params[0] = (GLfloat) iparams[0];
264 }
265
266
267 void GLAPIENTRY
268 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
269 {
270 GET_CURRENT_CONTEXT(ctx);
271 ctx->Driver.GetProgramiv(ctx, program, pname, params);
272 }
273
274
275 void GLAPIENTRY
276 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
277 {
278 GET_CURRENT_CONTEXT(ctx);
279 ctx->Driver.GetShaderiv(ctx, shader, pname, params);
280 }
281
282
283 void GLAPIENTRY
284 _mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
285 GLsizei *length, GLchar *infoLog)
286 {
287 GET_CURRENT_CONTEXT(ctx);
288 ctx->Driver.GetProgramInfoLog(ctx, program, bufSize, length, infoLog);
289 }
290
291
292 void GLAPIENTRY
293 _mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
294 GLsizei *length, GLchar *infoLog)
295 {
296 GET_CURRENT_CONTEXT(ctx);
297 ctx->Driver.GetShaderInfoLog(ctx, shader, bufSize, length, infoLog);
298 }
299
300
301 void GLAPIENTRY
302 _mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
303 GLsizei *length, GLcharARB *sourceOut)
304 {
305 GET_CURRENT_CONTEXT(ctx);
306 ctx->Driver.GetShaderSource(ctx, shader, maxLength, length, sourceOut);
307 }
308
309
310 void GLAPIENTRY
311 _mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat * params)
312 {
313 GET_CURRENT_CONTEXT(ctx);
314 ctx->Driver.GetUniformfv(ctx, program, location, params);
315 }
316
317
318 void GLAPIENTRY
319 _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
320 {
321 GET_CURRENT_CONTEXT(ctx);
322 ctx->Driver.GetUniformiv(ctx, program, location, params);
323 }
324
325
326
327 #if 0
328 GLint GLAPIENTRY
329 _mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
330 {
331 GET_CURRENT_CONTEXT(ctx);
332 return ctx->Driver.GetUniformLocation(ctx, program, name);
333 }
334 #endif
335
336
337 GLhandleARB GLAPIENTRY
338 _mesa_GetHandleARB(GLenum pname)
339 {
340 GET_CURRENT_CONTEXT(ctx);
341 return ctx->Driver.GetHandle(ctx, pname);
342 }
343
344
345 GLint GLAPIENTRY
346 _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
347 {
348 GET_CURRENT_CONTEXT(ctx);
349 return ctx->Driver.GetUniformLocation(ctx, programObj, name);
350 }
351
352
353 GLboolean GLAPIENTRY
354 _mesa_IsProgram(GLuint name)
355 {
356 GET_CURRENT_CONTEXT(ctx);
357 return ctx->Driver.IsProgram(ctx, name);
358 }
359
360
361 GLboolean GLAPIENTRY
362 _mesa_IsShader(GLuint name)
363 {
364 GET_CURRENT_CONTEXT(ctx);
365 return ctx->Driver.IsShader(ctx, name);
366 }
367
368
369 void GLAPIENTRY
370 _mesa_LinkProgramARB(GLhandleARB programObj)
371 {
372 GET_CURRENT_CONTEXT(ctx);
373 ctx->Driver.LinkProgram(ctx, programObj);
374 }
375
376
377
378 /**
379 * Read shader source code from a file.
380 * Useful for debugging to override an app's shader.
381 */
382 static GLcharARB *
383 _mesa_read_shader(const char *fname)
384 {
385 const int max = 50*1000;
386 FILE *f = fopen(fname, "r");
387 GLcharARB *buffer, *shader;
388 int len;
389
390 if (!f) {
391 _mesa_fprintf(stderr, "Unable to open shader file %s\n", fname);
392 return NULL;
393 }
394
395 buffer = (char *) malloc(max);
396 len = fread(buffer, 1, max, f);
397 buffer[len] = 0;
398
399 fclose(f);
400
401 shader = _mesa_strdup(buffer);
402 free(buffer);
403
404 if (0) {
405 _mesa_fprintf(stderr, "Read shader %s:\n", fname);
406 _mesa_fprintf(stderr, "%s\n", shader);
407 }
408
409 return shader;
410 }
411
412
413
414 /**
415 * Called via glShaderSource() and glShaderSourceARB() API functions.
416 * Basically, concatenate the source code strings into one long string
417 * and pass it to ctx->Driver.ShaderSource().
418 */
419 void GLAPIENTRY
420 _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
421 const GLcharARB ** string, const GLint * length)
422 {
423 GET_CURRENT_CONTEXT(ctx);
424 GLint *offsets;
425 GLsizei i, totalLength;
426 GLcharARB *source;
427
428 if (!shaderObj || string == NULL) {
429 _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
430 return;
431 }
432
433 /*
434 * This array holds offsets of where the appropriate string ends, thus the
435 * last element will be set to the total length of the source code.
436 */
437 offsets = (GLint *) _mesa_malloc(count * sizeof(GLint));
438 if (offsets == NULL) {
439 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
440 return;
441 }
442
443 for (i = 0; i < count; i++) {
444 if (string[i] == NULL) {
445 _mesa_free((GLvoid *) offsets);
446 _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");
447 return;
448 }
449 if (length == NULL || length[i] < 0)
450 offsets[i] = _mesa_strlen(string[i]);
451 else
452 offsets[i] = length[i];
453 /* accumulate string lengths */
454 if (i > 0)
455 offsets[i] += offsets[i - 1];
456 }
457
458 /* Total length of source string is sum off all strings plus two.
459 * One extra byte for terminating zero, another extra byte to silence
460 * valgrind warnings in the parser/grammer code.
461 */
462 totalLength = offsets[count - 1] + 2;
463 source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB));
464 if (source == NULL) {
465 _mesa_free((GLvoid *) offsets);
466 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
467 return;
468 }
469
470 for (i = 0; i < count; i++) {
471 GLint start = (i > 0) ? offsets[i - 1] : 0;
472 _mesa_memcpy(source + start, string[i],
473 (offsets[i] - start) * sizeof(GLcharARB));
474 }
475 source[totalLength - 1] = '\0';
476 source[totalLength - 2] = '\0';
477
478 #if 0
479 if (0) {
480 GLcharARB *newSource;
481
482 newSource = _mesa_read_shader("newshader.frag");
483 if (newSource) {
484 _mesa_free(source);
485 source = newSource;
486 }
487 }
488 #else
489 (void) _mesa_read_shader;
490 #endif
491
492 ctx->Driver.ShaderSource(ctx, shaderObj, source);
493
494 _mesa_free(offsets);
495 }
496
497
498 void GLAPIENTRY
499 _mesa_Uniform1fARB(GLint location, GLfloat v0)
500 {
501 GET_CURRENT_CONTEXT(ctx);
502 ctx->Driver.Uniform(ctx, location, 1, &v0, GL_FLOAT);
503 }
504
505 void GLAPIENTRY
506 _mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1)
507 {
508 GET_CURRENT_CONTEXT(ctx);
509 GLfloat v[2];
510 v[0] = v0;
511 v[1] = v1;
512 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC2);
513 }
514
515 void GLAPIENTRY
516 _mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
517 {
518 GET_CURRENT_CONTEXT(ctx);
519 GLfloat v[3];
520 v[0] = v0;
521 v[1] = v1;
522 v[2] = v2;
523 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC3);
524 }
525
526 void GLAPIENTRY
527 _mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2,
528 GLfloat v3)
529 {
530 GET_CURRENT_CONTEXT(ctx);
531 GLfloat v[4];
532 v[0] = v0;
533 v[1] = v1;
534 v[2] = v2;
535 v[3] = v3;
536 ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC4);
537 }
538
539 void GLAPIENTRY
540 _mesa_Uniform1iARB(GLint location, GLint v0)
541 {
542 GET_CURRENT_CONTEXT(ctx);
543 ctx->Driver.Uniform(ctx, location, 1, &v0, GL_INT);
544 }
545
546 void GLAPIENTRY
547 _mesa_Uniform2iARB(GLint location, GLint v0, GLint v1)
548 {
549 GET_CURRENT_CONTEXT(ctx);
550 GLint v[2];
551 v[0] = v0;
552 v[1] = v1;
553 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC2);
554 }
555
556 void GLAPIENTRY
557 _mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2)
558 {
559 GET_CURRENT_CONTEXT(ctx);
560 GLint v[3];
561 v[0] = v0;
562 v[1] = v1;
563 v[2] = v2;
564 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC3);
565 }
566
567 void GLAPIENTRY
568 _mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
569 {
570 GET_CURRENT_CONTEXT(ctx);
571 GLint v[4];
572 v[0] = v0;
573 v[1] = v1;
574 v[2] = v2;
575 v[3] = v3;
576 ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC4);
577 }
578
579 void GLAPIENTRY
580 _mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value)
581 {
582 GET_CURRENT_CONTEXT(ctx);
583 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT);
584 }
585
586 void GLAPIENTRY
587 _mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value)
588 {
589 GET_CURRENT_CONTEXT(ctx);
590 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC2);
591 }
592
593 void GLAPIENTRY
594 _mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value)
595 {
596 GET_CURRENT_CONTEXT(ctx);
597 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC3);
598 }
599
600 void GLAPIENTRY
601 _mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value)
602 {
603 GET_CURRENT_CONTEXT(ctx);
604 ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC4);
605 }
606
607 void GLAPIENTRY
608 _mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value)
609 {
610 GET_CURRENT_CONTEXT(ctx);
611 ctx->Driver.Uniform(ctx, location, count, value, GL_INT);
612 }
613
614 void GLAPIENTRY
615 _mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value)
616 {
617 GET_CURRENT_CONTEXT(ctx);
618 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC2);
619 }
620
621 void GLAPIENTRY
622 _mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value)
623 {
624 GET_CURRENT_CONTEXT(ctx);
625 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC3);
626 }
627
628 void GLAPIENTRY
629 _mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value)
630 {
631 GET_CURRENT_CONTEXT(ctx);
632 ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC4);
633 }
634
635
636 void GLAPIENTRY
637 _mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose,
638 const GLfloat * value)
639 {
640 GET_CURRENT_CONTEXT(ctx);
641 ctx->Driver.UniformMatrix(ctx, 2, 2, location, count, transpose, value);
642 }
643
644 void GLAPIENTRY
645 _mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose,
646 const GLfloat * value)
647 {
648 GET_CURRENT_CONTEXT(ctx);
649 ctx->Driver.UniformMatrix(ctx, 3, 3, location, count, transpose, value);
650 }
651
652 void GLAPIENTRY
653 _mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose,
654 const GLfloat * value)
655 {
656 GET_CURRENT_CONTEXT(ctx);
657 ctx->Driver.UniformMatrix(ctx, 4, 4, location, count, transpose, value);
658 }
659
660
661 /**
662 * Non-square UniformMatrix are OpenGL 2.1
663 */
664 void GLAPIENTRY
665 _mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose,
666 const GLfloat *value)
667 {
668 GET_CURRENT_CONTEXT(ctx);
669 ctx->Driver.UniformMatrix(ctx, 2, 3, location, count, transpose, value);
670 }
671
672 void GLAPIENTRY
673 _mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose,
674 const GLfloat *value)
675 {
676 GET_CURRENT_CONTEXT(ctx);
677 ctx->Driver.UniformMatrix(ctx, 3, 2, location, count, transpose, value);
678 }
679
680 void GLAPIENTRY
681 _mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose,
682 const GLfloat *value)
683 {
684 GET_CURRENT_CONTEXT(ctx);
685 ctx->Driver.UniformMatrix(ctx, 2, 4, location, count, transpose, value);
686 }
687
688 void GLAPIENTRY
689 _mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose,
690 const GLfloat *value)
691 {
692 GET_CURRENT_CONTEXT(ctx);
693 ctx->Driver.UniformMatrix(ctx, 4, 2, location, count, transpose, value);
694 }
695
696 void GLAPIENTRY
697 _mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose,
698 const GLfloat *value)
699 {
700 GET_CURRENT_CONTEXT(ctx);
701 ctx->Driver.UniformMatrix(ctx, 3, 4, location, count, transpose, value);
702 }
703
704 void GLAPIENTRY
705 _mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
706 const GLfloat *value)
707 {
708 GET_CURRENT_CONTEXT(ctx);
709 ctx->Driver.UniformMatrix(ctx, 4, 3, location, count, transpose, value);
710 }
711
712
713 void GLAPIENTRY
714 _mesa_UseProgramObjectARB(GLhandleARB program)
715 {
716 GET_CURRENT_CONTEXT(ctx);
717 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
718 ctx->Driver.UseProgram(ctx, program);
719 }
720
721
722 void GLAPIENTRY
723 _mesa_ValidateProgramARB(GLhandleARB program)
724 {
725 GET_CURRENT_CONTEXT(ctx);
726 ctx->Driver.ValidateProgram(ctx, program);
727 }
728