1 /* Copyright © 2013, Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 /* The prototypes for some OpenGL functions changed at one point from:
26 * const void* *indices
28 * const void* const coist *indices
30 * This makes it difficult for us to provide an implementation of
31 * these functions that is consistent with the locally-available gl.h
32 * since we don't know if the extra const will be present or not.
34 * To workaround this problem, we simply #define away const altogether
35 * before including gl.h.
37 * Kudos to Keith Packard for suggesting this kludge.
41 #define GL_GLEXT_PROTOTYPES
50 static void *gl_handle;
52 #define SWITCH_METRICS_OP(op) \
53 metrics_counter_stop (); \
54 metrics_set_current_op (op); \
55 metrics_counter_start ();
58 glwrap_set_gl_handle (void *handle)
60 if (gl_handle == NULL)
65 glwrap_lookup (char *name)
69 /* We don't call dlopen here to find the library in which to
70 * perform a dlsym lookup. That's because the application may
71 * be loading libGL.so or libGLESv2.so for its OpenGL symbols.
73 * So we instead watch for one of those filenames to go by in
74 * our dlopen wrapper, which will then call
75 * glwrap_set_gl_handle to give us the handle to use here.
77 * If the application hasn't called dlopen on a "libGL"
78 * library, then presumably the application is linked directly
79 * to an OpenGL implementation. In this case, we can use
80 * RTLD_NEXT to find the symbol.
82 * But just in case, we also let the user override that by
83 * specifying the FIPS_LIBGL environment variable to the path
84 * of the real libGL.so library that fips should dlopen here.
86 if (gl_handle == NULL) {
89 path = getenv ("FIPS_LIBGL");
91 gl_handle = dlopen (path, RTLD_LAZY);
93 if (gl_handle == NULL) {
94 fprintf (stderr, "Failed to dlopen FIPS_LIBGL: "
99 gl_handle = RTLD_NEXT;
103 ret = dlwrap_real_dlsym (gl_handle, name);
106 fprintf (stderr, "Error: glwrap_lookup failed to dlsym %s\n",
114 /* With a program change, we stop the counter, update the
115 * active program, then start the counter up again. */
117 glUseProgram (GLuint program)
119 SWITCH_METRICS_OP (METRICS_OP_SHADER + program);
121 GLWRAP_DEFER(glUseProgram, program);
125 glUseProgramObjectARB (GLhandleARB programObj)
127 SWITCH_METRICS_OP (METRICS_OP_SHADER + programObj);
129 GLWRAP_DEFER(glUseProgramObjectARB, programObj);
132 /* METRICS_OP_ACCUM */
134 glAccum (GLenum op, GLfloat value)
136 SWITCH_METRICS_OP (METRICS_OP_ACCUM);
138 GLWRAP_DEFER (glAccum, op, value);
142 glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
144 SWITCH_METRICS_OP (METRICS_OP_ACCUM);
146 GLWRAP_DEFER (glClearAccum, red, green, blue, alpha);
150 glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
152 SWITCH_METRICS_OP (METRICS_OP_ACCUM);
154 GLWRAP_DEFER (glClearAccumxOES, red, green, blue, alpha);
157 /* METRICS_OP_BUFFER_DATA */
159 glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
161 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
163 GLWRAP_DEFER (glBufferData, target, size, data, usage);
167 glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLvoid *data,
170 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
172 GLWRAP_DEFER (glNamedBufferDataEXT, buffer, size, data, usage);
176 glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size,
179 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
181 GLWRAP_DEFER (glBufferSubData, target, offset, size, data);
185 glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size,
188 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
190 GLWRAP_DEFER (glNamedBufferSubDataEXT, buffer, offset, size, data);
194 glMapBuffer (GLenum target, GLenum access)
198 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
200 GLWRAP_DEFER_WITH_RETURN (ret, glMapBuffer, target, access);
206 glMapBufferARB (GLenum target, GLenum access)
210 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
212 GLWRAP_DEFER_WITH_RETURN (ret, glMapBufferARB, target, access);
218 glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length,
223 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
225 GLWRAP_DEFER_WITH_RETURN (ret, glMapBufferRange, target, offset,
232 glUnmapBuffer (GLenum target)
236 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
238 GLWRAP_DEFER_WITH_RETURN (ret, glUnmapBuffer, target);
244 glUnmapNamedBufferEXT (GLuint buffer)
248 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
250 GLWRAP_DEFER_WITH_RETURN (ret, glUnmapNamedBufferEXT, buffer);
256 glUnmapBufferARB (GLenum target)
260 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
262 GLWRAP_DEFER_WITH_RETURN (ret, glUnmapBufferARB, target);
268 glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length)
270 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
272 GLWRAP_DEFER (glFlushMappedBufferRange, target, offset, length);
276 glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size)
278 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
280 GLWRAP_DEFER (glFlushMappedBufferRangeAPPLE, target, offset, size);
284 glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset,
287 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
289 GLWRAP_DEFER (glFlushMappedNamedBufferRangeEXT, buffer, offset, length);
293 glMapNamedBufferEXT (GLuint buffer, GLenum access)
297 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
299 GLWRAP_DEFER_WITH_RETURN (ret, glMapNamedBufferEXT, buffer, access);
305 glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length,
310 SWITCH_METRICS_OP (METRICS_OP_BUFFER_DATA);
312 GLWRAP_DEFER_WITH_RETURN (ret, glMapNamedBufferRangeEXT, buffer,
313 offset, length, access);
318 /* METRICS_OP_BUFFER_SUB_DATA */
320 glCopyBufferSubData (GLenum readTarget, GLenum writeTarget,
321 GLintptr readOffset, GLintptr writeOffset,
324 SWITCH_METRICS_OP (METRICS_OP_BUFFER_SUB_DATA);
326 GLWRAP_DEFER (glCopyBufferSubData, readTarget, writeTarget,
327 readOffset, writeOffset, size);
331 glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer,
332 GLintptr readOffset, GLintptr writeOffset,
335 SWITCH_METRICS_OP (METRICS_OP_BUFFER_SUB_DATA);
337 GLWRAP_DEFER (glNamedCopyBufferSubDataEXT, readBuffer,
338 writeBuffer, readOffset, writeOffset, size);
341 /* METRICS_OP_BITMAP */
343 glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig,
344 GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
346 SWITCH_METRICS_OP (METRICS_OP_BITMAP);
348 GLWRAP_DEFER (glBitmap, width, height, xorig, yorig,
349 xmove, ymove, bitmap);
353 glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig,
354 GLfixed xmove, GLfixed ymove, const GLubyte *bitmap)
356 SWITCH_METRICS_OP (METRICS_OP_BITMAP);
358 GLWRAP_DEFER (glBitmapxOES, width, height, xorig, yorig,
359 xmove, ymove, bitmap);
362 /* METRICS_OP_BLIT_FRAMEBUFFER */
364 glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
365 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
366 GLbitfield mask, GLenum filter)
368 SWITCH_METRICS_OP (METRICS_OP_BLIT_FRAMEBUFFER);
370 GLWRAP_DEFER (glBlitFramebuffer, srcX0, srcY0, srcX1, srcY1,
371 dstX0, dstY0, dstX1, dstY1, mask, filter);
375 glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
376 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
377 GLbitfield mask, GLenum filter)
379 SWITCH_METRICS_OP (METRICS_OP_BLIT_FRAMEBUFFER);
381 GLWRAP_DEFER (glBlitFramebufferEXT, srcX0, srcY0, srcX1, srcY1,
382 dstX0, dstY0, dstX1, dstY1, mask, filter);
385 /* METRICS_OP_CLEAR */
387 glClear (GLbitfield mask)
389 SWITCH_METRICS_OP (METRICS_OP_CLEAR);
391 GLWRAP_DEFER (glClear, mask);
395 glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
397 SWITCH_METRICS_OP (METRICS_OP_CLEAR);
399 GLWRAP_DEFER (glClearBufferfi, buffer, drawbuffer, depth, stencil);
403 glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value)
405 SWITCH_METRICS_OP (METRICS_OP_CLEAR);
407 GLWRAP_DEFER (glClearBufferfv, buffer, drawbuffer, value);
411 glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value)
413 SWITCH_METRICS_OP (METRICS_OP_CLEAR);
415 GLWRAP_DEFER (glClearBufferiv, buffer, drawbuffer, value);
419 glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value)
421 SWITCH_METRICS_OP (METRICS_OP_CLEAR);
423 GLWRAP_DEFER (glClearBufferuiv, buffer, drawbuffer, value);
426 /* METRICS_OP_CLEAR_BUFFER_DATA */
429 glClearBufferData (GLenum target, GLenum internalformat, GLenum format,
430 GLenum type, const void *data)
432 SWITCH_METRICS_OP (METRICS_OP_CLEAR_BUFFER_DATA);
434 GLWRAP_DEFER (glClearBufferData, target, internalformat, format,
439 glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset,
440 GLsizeiptr size, GLenum format, GLenum type,
443 SWITCH_METRICS_OP (METRICS_OP_CLEAR_BUFFER_DATA);
445 GLWRAP_DEFER (glClearBufferSubData, target, internalformat,
446 offset, size, format, type, data);
450 glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format,
451 GLenum type, const void *data)
453 SWITCH_METRICS_OP (METRICS_OP_CLEAR_BUFFER_DATA);
455 GLWRAP_DEFER (glClearNamedBufferDataEXT, buffer, internalformat,
460 glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat,
461 GLenum format, GLenum type, GLsizeiptr offset,
462 GLsizeiptr size, const void *data)
464 SWITCH_METRICS_OP (METRICS_OP_CLEAR_BUFFER_DATA);
466 GLWRAP_DEFER (glClearNamedBufferSubDataEXT, buffer,
467 internalformat, format, type, offset, size, data);
470 /* METRICS_OP_CLEAR_TEX_IMAGE */
473 /* METRICS_OP_COPY_PIXELS */
475 glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type )
477 SWITCH_METRICS_OP (METRICS_OP_COPY_PIXELS);
479 GLWRAP_DEFER (glCopyPixels, x, y, width, height, type);
482 /* METRICS_OP_COPY_TEX_IMAGE */
484 glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat,
485 GLint x, GLint y, GLsizei width, GLint border)
487 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
489 GLWRAP_DEFER (glCopyTexImage1D, target, level, internalformat,
490 x, y, width, border);
494 glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat,
495 GLint x, GLint y, GLsizei width, GLint border)
497 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
499 GLWRAP_DEFER (glCopyTexImage1DEXT, target, level, internalformat,
500 x, y, width, border);
504 glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat,
505 GLint x, GLint y, GLsizei width, GLsizei height,
508 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
510 GLWRAP_DEFER (glCopyTexImage2D, target, level, internalformat,
511 x, y, width, height, border);
515 glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat,
516 GLint x, GLint y, GLsizei width, GLsizei height,
519 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
521 GLWRAP_DEFER (glCopyTexImage2DEXT, target, level, internalformat,
522 x, y, width, height, border);
526 glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset,
527 GLint x, GLint y, GLsizei width)
529 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
531 GLWRAP_DEFER (glCopyTexSubImage1D, target, level, xoffset,
536 glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset,
537 GLint x, GLint y, GLsizei width)
539 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
541 GLWRAP_DEFER (glCopyTexSubImage1DEXT, target, level, xoffset,
546 glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset,
547 GLint yoffset, GLint x, GLint y, GLsizei width,
550 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
552 GLWRAP_DEFER (glCopyTexSubImage2D, target, level, xoffset, yoffset,
553 x, y, width, height);
557 glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset,
558 GLint yoffset, GLint x, GLint y, GLsizei width,
561 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
563 GLWRAP_DEFER (glCopyTexSubImage2DEXT, target, level, xoffset, yoffset,
564 x, y, width, height);
568 glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset,
569 GLint yoffset, GLint zoffset, GLint x, GLint y,
570 GLsizei width, GLsizei height)
572 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
574 GLWRAP_DEFER (glCopyTexSubImage3D, target, level, xoffset, yoffset,
575 zoffset, x, y, width, height);
579 glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset,
580 GLint yoffset, GLint zoffset, GLint x, GLint y,
581 GLsizei width, GLsizei height)
583 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
585 GLWRAP_DEFER (glCopyTexSubImage3DEXT, target, level, xoffset, yoffset,
586 zoffset, x, y, width, height);
590 glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level,
591 GLenum internalformat, GLint x, GLint y,
592 GLsizei width, GLint border)
594 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
596 GLWRAP_DEFER (glCopyTextureImage1DEXT, texture, target, level,
597 internalformat, x, y, width, border);
601 glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level,
602 GLenum internalformat, GLint x, GLint y, GLsizei width,
603 GLsizei height, GLint border)
605 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
607 GLWRAP_DEFER (glCopyTextureImage2DEXT, texture, target,
608 level, internalformat, x, y, width, height, border);
612 glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level,
613 GLint xoffset, GLint x, GLint y, GLsizei width)
615 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
617 GLWRAP_DEFER (glCopyTextureSubImage1DEXT, texture, target, level,
618 xoffset, x, y, width);
622 glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level,
623 GLint xoffset, GLint yoffset, GLint x, GLint y,
624 GLsizei width, GLsizei height)
626 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
628 GLWRAP_DEFER (glCopyTextureSubImage2DEXT, texture, target, level,
629 xoffset, yoffset, x, y, width, height);
633 glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level,
634 GLint xoffset, GLint yoffset, GLint zoffset,
635 GLint x, GLint y, GLsizei width, GLsizei height)
637 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
639 GLWRAP_DEFER (glCopyTextureSubImage3DEXT, texture, target, level,
640 xoffset, yoffset, zoffset, x, y, width, height);
644 glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level,
645 GLenum internalformat, GLint x, GLint y,
646 GLsizei width, GLint border)
648 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
650 GLWRAP_DEFER (glCopyMultiTexImage1DEXT, texunit, target, level,
651 internalformat, x, y, width, border);
655 glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level,
656 GLenum internalformat, GLint x, GLint y,
657 GLsizei width, GLsizei height, GLint border)
659 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
661 GLWRAP_DEFER (glCopyMultiTexImage2DEXT, texunit, target, level,
662 internalformat, x, y, width, height, border);
666 glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level,
667 GLint xoffset, GLint x, GLint y, GLsizei width)
669 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
671 GLWRAP_DEFER (glCopyMultiTexSubImage1DEXT, texunit, target, level,
672 xoffset, x, y, width);
676 glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level,
677 GLint xoffset, GLint yoffset, GLint x, GLint y,
678 GLsizei width, GLsizei height)
680 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
682 GLWRAP_DEFER (glCopyMultiTexSubImage2DEXT, texunit, target, level,
683 xoffset, yoffset, x, y, width, height);
687 glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level,
688 GLint xoffset, GLint yoffset, GLint zoffset,
689 GLint x, GLint y, GLsizei width, GLsizei height)
691 SWITCH_METRICS_OP (METRICS_OP_COPY_TEX_IMAGE);
693 GLWRAP_DEFER (glCopyMultiTexSubImage3DEXT, texunit, target, level,
694 xoffset, yoffset, zoffset, x, y, width, height);
697 /* METRICS_OP_DRAW_PIXELS */
699 glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type,
700 const GLvoid *pixels)
702 SWITCH_METRICS_OP (METRICS_OP_DRAW_PIXELS);
704 GLWRAP_DEFER (glDrawPixels, width, height, format, type, pixels);
707 /* METRICS_OP_GET_TEX_IMAGE */
710 glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target,
711 GLint lod, GLvoid *img)
713 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
715 GLWRAP_DEFER (glGetCompressedMultiTexImageEXT, texunit,
720 glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img)
722 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
724 GLWRAP_DEFER (glGetCompressedTexImage, target, level, img);
728 glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img)
730 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
732 GLWRAP_DEFER (glGetCompressedTexImageARB, target, level, img);
736 glGetCompressedTextureImageEXT (GLuint texture, GLenum target,
737 GLint lod, GLvoid *img)
739 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
741 GLWRAP_DEFER (glGetCompressedTextureImageEXT, texture,
746 glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level,
747 GLenum format, GLenum type, GLvoid *pixels)
749 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
751 GLWRAP_DEFER (glGetMultiTexImageEXT, texunit,
752 target, level, format, type, pixels);
756 glGetnCompressedTexImageARB (GLenum target, GLint lod,
757 GLsizei bufSize, GLvoid *img)
759 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
761 GLWRAP_DEFER (glGetnCompressedTexImageARB, target, lod, bufSize, img);
765 glGetnTexImageARB (GLenum target, GLint level, GLenum format,
766 GLenum type, GLsizei bufSize, GLvoid *img)
768 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
770 GLWRAP_DEFER (glGetnTexImageARB, target, level,
771 format, type, bufSize, img);
775 glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type,
778 SWITCH_METRICS_OP (METRICS_OP_GET_TEX_IMAGE);
780 GLWRAP_DEFER (glGetTexImage, target, level, format, type, pixels);
783 /* METRICS_OP_READ_PIXELS */
785 glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height,
786 GLenum format, GLenum type, GLvoid *pixels )
788 SWITCH_METRICS_OP (METRICS_OP_READ_PIXELS);
790 GLWRAP_DEFER (glReadPixels, x, y, width, height, format, type, pixels);
794 glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height,
795 GLenum format, GLenum type, GLsizei bufSize, GLvoid *data)
797 SWITCH_METRICS_OP (METRICS_OP_READ_PIXELS);
799 GLWRAP_DEFER (glReadnPixelsARB, x, y, width, height,
800 format, type, bufSize, data);
803 /* METRICS_OP_TEX_IMAGE */
805 glTexImage1D (GLenum target, GLint level, GLint internalFormat,
806 GLsizei width, GLint border, GLenum format, GLenum type,
807 const GLvoid *pixels)
809 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
811 GLWRAP_DEFER (glTexImage1D, target, level, internalFormat, width,
812 border, format, type, pixels);
816 glTexImage2D (GLenum target, GLint level, GLint internalFormat,
817 GLsizei width, GLsizei height, GLint border, GLenum format,
818 GLenum type, const GLvoid *pixels )
820 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
822 GLWRAP_DEFER (glTexImage2D, target, level, internalFormat,
823 width, height, border, format, type, pixels);
828 glTexImage2DMultisample (GLenum target, GLsizei samples,
829 GLint internalformat, GLsizei width, GLsizei height,
830 GLboolean fixedsamplelocations)
832 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
834 GLWRAP_DEFER (glTexImage2DMultisample, target, samples,
835 internalformat, width, height, fixedsamplelocations);
839 glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples,
840 GLsizei colorSamples, GLint internalFormat,
841 GLsizei width, GLsizei height,
842 GLboolean fixedSampleLocations)
844 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
846 GLWRAP_DEFER (glTexImage2DMultisampleCoverageNV, target,
847 coverageSamples, colorSamples, internalFormat,
848 width, height, fixedSampleLocations);
852 glTexImage3D (GLenum target, GLint level, GLint internalformat,
853 GLsizei width, GLsizei height, GLsizei depth, GLint border,
854 GLenum format, GLenum type, const GLvoid *pixels)
856 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
858 GLWRAP_DEFER (glTexImage3D, target, level, internalformat,
859 width, height, depth, border, format, type, pixels);
863 glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat,
864 GLsizei width, GLsizei height, GLsizei depth, GLint border,
865 GLenum format, GLenum type, const GLvoid *pixels)
867 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
869 GLWRAP_DEFER (glTexImage3DEXT, target, level, internalformat,
870 width, height, depth, border, format, type, pixels);
874 glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat,
875 GLsizei width, GLsizei height, GLsizei depth,
876 GLboolean fixedsamplelocations)
878 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
880 GLWRAP_DEFER (glTexImage3DMultisample, target, samples,
881 internalformat, width, height, depth,
882 fixedsamplelocations);
886 glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples,
887 GLsizei colorSamples, GLint internalFormat,
888 GLsizei width, GLsizei height, GLsizei depth,
889 GLboolean fixedSampleLocations)
891 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
893 GLWRAP_DEFER (glTexImage3DMultisampleCoverageNV, target,
894 coverageSamples, colorSamples, internalFormat,
895 width, height, depth, fixedSampleLocations);
899 glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat,
900 GLsizei width, GLsizei height, GLsizei depth,
901 GLsizei size4d, GLint border, GLenum format,
902 GLenum type, const GLvoid *pixels)
904 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
906 GLWRAP_DEFER (glTexImage4DSGIS, target, level,
907 internalformat, width, height, depth,
908 size4d, border, format, type, pixels);
912 glTexSubImage1D (GLenum target, GLint level, GLint xoffset,
913 GLsizei width, GLenum format, GLenum type,
914 const GLvoid *pixels)
916 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
918 GLWRAP_DEFER (glTexSubImage1D, target, level, xoffset,
919 width, format, type, pixels);
923 glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset,
924 GLsizei width, GLenum format, GLenum type,
925 const GLvoid *pixels)
927 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
929 GLWRAP_DEFER (glTexSubImage1DEXT, target, level, xoffset,
930 width, format, type, pixels);
934 glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset,
935 GLsizei width, GLsizei height, GLenum format, GLenum type,
936 const GLvoid *pixels)
938 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
940 GLWRAP_DEFER (glTexSubImage2D, target, level, xoffset, yoffset,
941 width, height, format, type, pixels);
945 glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset,
946 GLsizei width, GLsizei height, GLenum format, GLenum type,
947 const GLvoid *pixels)
949 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
951 GLWRAP_DEFER (glTexSubImage2DEXT, target, level, xoffset, yoffset,
952 width, height, format, type, pixels);
956 glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset,
957 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
958 GLenum format, GLenum type, const GLvoid *pixels)
960 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
962 GLWRAP_DEFER (glTexSubImage3D, target, level, xoffset, yoffset,
963 zoffset, width, height, depth, format, type, pixels);
967 glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset,
968 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
969 GLenum format, GLenum type, const GLvoid *pixels)
971 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
973 GLWRAP_DEFER (glTexSubImage3DEXT, target, level, xoffset, yoffset,
974 zoffset, width, height, depth, format, type, pixels);
978 glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset,
979 GLint zoffset, GLint woffset, GLsizei width,
980 GLsizei height, GLsizei depth, GLsizei size4d,
981 GLenum format, GLenum type, const GLvoid *pixels)
983 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
985 GLWRAP_DEFER (glTexSubImage4DSGIS, target, level, xoffset,
986 yoffset, zoffset, woffset, width, height,
987 depth, size4d, format, type, pixels);
991 glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level,
992 GLenum internalformat, GLsizei width,
993 GLint border, GLsizei imageSize,
996 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
998 GLWRAP_DEFER (glCompressedMultiTexImage1DEXT, texunit, target,
999 level, internalformat, width, border, imageSize, bits);
1003 glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level,
1004 GLenum internalformat, GLsizei width,
1005 GLsizei height, GLint border,
1006 GLsizei imageSize, const GLvoid *bits)
1008 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1010 GLWRAP_DEFER (glCompressedMultiTexImage2DEXT, texunit, target, level,
1011 internalformat, width, height, border, imageSize, bits);
1015 glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level,
1016 GLenum internalformat, GLsizei width,
1017 GLsizei height, GLsizei depth, GLint border,
1018 GLsizei imageSize, const GLvoid *bits)
1020 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1022 GLWRAP_DEFER (glCompressedMultiTexImage3DEXT, texunit, target,
1023 level, internalformat, width, height, depth,
1024 border, imageSize, bits);
1028 glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level,
1029 GLint xoffset, GLsizei width, GLenum format,
1030 GLsizei imageSize, const GLvoid *bits)
1032 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1034 GLWRAP_DEFER (glCompressedMultiTexSubImage1DEXT, texunit, target,
1035 level, xoffset, width, format, imageSize, bits);
1039 glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level,
1040 GLint xoffset, GLint yoffset, GLsizei width,
1041 GLsizei height, GLenum format,
1042 GLsizei imageSize, const GLvoid *bits)
1044 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1046 GLWRAP_DEFER (glCompressedMultiTexSubImage2DEXT, texunit, target, level,
1047 xoffset, yoffset, width, height, format, imageSize, bits);
1051 glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level,
1052 GLint xoffset, GLint yoffset, GLint zoffset,
1053 GLsizei width, GLsizei height, GLsizei depth,
1054 GLenum format, GLsizei imageSize,
1057 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1059 GLWRAP_DEFER (glCompressedMultiTexSubImage3DEXT, texunit, target,
1060 level, xoffset, yoffset, zoffset, width, height,
1061 depth, format, imageSize, bits);
1065 glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat,
1066 GLsizei width, GLint border, GLsizei imageSize,
1069 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1071 GLWRAP_DEFER (glCompressedTexImage1D, target, level,
1072 internalformat, width, border, imageSize, data);
1076 glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat,
1077 GLsizei width, GLint border, GLsizei imageSize,
1080 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1082 GLWRAP_DEFER (glCompressedTexImage1DARB, target, level, internalformat,
1083 width, border, imageSize, data);
1087 glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat,
1088 GLsizei width, GLsizei height, GLint border,
1089 GLsizei imageSize, const GLvoid *data)
1091 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1093 GLWRAP_DEFER (glCompressedTexImage2D, target, level, internalformat,
1094 width, height, border, imageSize, data);
1098 glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat,
1099 GLsizei width, GLsizei height, GLint border,
1100 GLsizei imageSize, const GLvoid *data)
1102 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1104 GLWRAP_DEFER (glCompressedTexImage2DARB, target, level, internalformat,
1105 width, height, border, imageSize, data);
1109 glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat,
1110 GLsizei width, GLsizei height, GLsizei depth,
1111 GLint border, GLsizei imageSize, const GLvoid *data)
1113 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1115 GLWRAP_DEFER (glCompressedTexImage3D, target, level, internalformat,
1116 width, height, depth, border, imageSize, data);
1120 glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat,
1121 GLsizei width, GLsizei height, GLsizei depth,
1122 GLint border, GLsizei imageSize, const GLvoid *data)
1124 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1126 GLWRAP_DEFER (glCompressedTexImage3DARB, target, level, internalformat,
1127 width, height, depth, border, imageSize, data);
1131 glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset,
1132 GLsizei width, GLenum format, GLsizei imageSize,
1135 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1137 GLWRAP_DEFER (glCompressedTexSubImage1D, target, level, xoffset,
1138 width, format, imageSize, data);
1142 glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset,
1143 GLsizei width, GLenum format, GLsizei imageSize,
1146 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1148 GLWRAP_DEFER (glCompressedTexSubImage1DARB, target, level, xoffset,
1149 width, format, imageSize, data);
1153 glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset,
1154 GLint yoffset, GLsizei width, GLsizei height,
1155 GLenum format, GLsizei imageSize, const GLvoid *data)
1157 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1159 GLWRAP_DEFER (glCompressedTexSubImage2D, target, level, xoffset,
1160 yoffset, width, height, format, imageSize, data);
1164 glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset,
1165 GLint yoffset, GLsizei width, GLsizei height,
1166 GLenum format, GLsizei imageSize,
1169 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1171 GLWRAP_DEFER (glCompressedTexSubImage2DARB, target, level, xoffset,
1172 yoffset, width, height, format, imageSize, data);
1176 glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset,
1177 GLint yoffset, GLint zoffset, GLsizei width,
1178 GLsizei height, GLsizei depth, GLenum format,
1179 GLsizei imageSize, const GLvoid *data)
1181 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1183 GLWRAP_DEFER (glCompressedTexSubImage3D, target, level, xoffset,
1184 yoffset, zoffset, width, height, depth, format,
1189 glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset,
1190 GLint yoffset, GLint zoffset, GLsizei width,
1191 GLsizei height, GLsizei depth, GLenum format,
1192 GLsizei imageSize, const GLvoid *data)
1194 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1196 GLWRAP_DEFER (glCompressedTexSubImage3DARB, target, level, xoffset,
1197 yoffset, zoffset, width, height, depth, format,
1202 glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level,
1203 GLenum internalformat, GLsizei width,
1204 GLint border, GLsizei imageSize,
1207 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1209 GLWRAP_DEFER (glCompressedTextureImage1DEXT, texture, target, level,
1210 internalformat, width, border, imageSize, bits);
1214 glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level,
1215 GLenum internalformat, GLsizei width,
1216 GLsizei height, GLint border,
1217 GLsizei imageSize, const GLvoid *bits)
1219 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1221 GLWRAP_DEFER (glCompressedTextureImage2DEXT, texture, target, level,
1222 internalformat, width, height, border, imageSize, bits);
1226 glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level,
1227 GLenum internalformat, GLsizei width,
1228 GLsizei height, GLsizei depth, GLint border,
1229 GLsizei imageSize, const GLvoid *bits)
1231 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1233 GLWRAP_DEFER (glCompressedTextureImage3DEXT, texture, target,
1234 level, internalformat, width, height, depth,
1235 border, imageSize, bits);
1239 glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level,
1240 GLint xoffset, GLsizei width, GLenum format,
1241 GLsizei imageSize, const GLvoid *bits)
1243 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1245 GLWRAP_DEFER (glCompressedTextureSubImage1DEXT, texture, target,
1246 level, xoffset, width, format, imageSize, bits);
1250 glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level,
1251 GLint xoffset, GLint yoffset, GLsizei width,
1252 GLsizei height, GLenum format,
1253 GLsizei imageSize, const GLvoid *bits)
1255 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1257 GLWRAP_DEFER (glCompressedTextureSubImage2DEXT, texture, target, level,
1258 xoffset, yoffset, width, height, format, imageSize, bits);
1262 glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level,
1263 GLint xoffset, GLint yoffset, GLint zoffset,
1264 GLsizei width, GLsizei height, GLsizei depth,
1265 GLenum format, GLsizei imageSize,
1268 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1270 GLWRAP_DEFER (glCompressedTextureSubImage3DEXT, texture, target,
1271 level, xoffset, yoffset, zoffset, width, height,
1272 depth, format, imageSize, bits);
1276 glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level,
1277 GLenum internalformat, GLsizei width, GLint border,
1278 GLenum format, GLenum type, const GLvoid *pixels)
1280 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1282 GLWRAP_DEFER (glMultiTexImage1DEXT, texunit, target, level,
1283 internalformat, width, border, format, type, pixels);
1287 glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level,
1288 GLenum internalformat, GLsizei width, GLsizei height,
1289 GLint border, GLenum format, GLenum type,
1290 const GLvoid *pixels)
1292 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1294 GLWRAP_DEFER (glMultiTexImage2DEXT, texunit, target, level,
1295 internalformat, width, height, border, format,
1300 glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level,
1301 GLenum internalformat, GLsizei width, GLsizei height,
1302 GLsizei depth, GLint border, GLenum format,
1303 GLenum type, const GLvoid *pixels)
1305 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1307 GLWRAP_DEFER (glMultiTexImage3DEXT, texunit, target, level,
1308 internalformat, width, height, depth, border,
1309 format, type, pixels);
1313 glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level,
1314 GLint xoffset, GLsizei width, GLenum format,
1315 GLenum type, const GLvoid *pixels)
1317 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1319 GLWRAP_DEFER (glMultiTexSubImage1DEXT, texunit, target, level,
1320 xoffset, width, format, type, pixels);
1324 glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level,
1325 GLint xoffset, GLint yoffset, GLsizei width,
1326 GLsizei height, GLenum format, GLenum type,
1327 const GLvoid *pixels)
1329 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1331 GLWRAP_DEFER (glMultiTexSubImage2DEXT, texunit, target, level, xoffset,
1332 yoffset, width, height, format, type, pixels);
1336 glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level,
1337 GLint xoffset, GLint yoffset, GLint zoffset,
1338 GLsizei width, GLsizei height, GLsizei depth,
1339 GLenum format, GLenum type, const GLvoid *pixels)
1341 SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE);
1343 GLWRAP_DEFER (glMultiTexSubImage3DEXT, texunit, target, level,
1344 xoffset, yoffset, zoffset, width, height, depth,
1345 format, type, pixels);