X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glwrap.c;h=39a784fb2088ce592e08fb54fb6659f3c9419884;hb=1063166ac2d706f8bbd325ecfd0580a0d1b04b21;hp=94966f5142487e402bb646c0d576c0e027c5bb63;hpb=7980e4108be1dff9b074aa91b97c8d787df41d83;p=fips diff --git a/glwrap.c b/glwrap.c index 94966f5..39a784f 100644 --- a/glwrap.c +++ b/glwrap.c @@ -45,19 +45,34 @@ #include "glwrap.h" -#include "metrics.h" +#include "context.h" + +/* As of glext.h version 20131008 some types changed. + * + * I have no idea why some internalFormats changed from GLenum to + * GLint while others changed from GLint to GLenum. + * + * But, in order to compile with either version, we track these. + */ +#if GL_GLEXT_VERSION >= 20131008 +#define GLint_or_enum GLenum +#define GLenum_or_int GLint +#else +#define GLint_or_enum GLint +#define GLenum_or_int GLenum +#endif static void *gl_handle; /* Switch metrics operation persistently, (until next SWITCH) */ #define SWITCH_METRICS_OP(op) \ - metrics_counter_stop (); \ - metrics_set_current_op (op); \ - metrics_counter_start (); + context_counter_stop (); \ + context_set_current_op (op); \ + context_counter_start (); /* Switch metrics operation temporarily, see RESTORE_METRICS_OP */ #define SAVE_THEN_SWITCH_METRICS_OP(op) \ - metrics_op_t save = metrics_get_current_op (); \ + metrics_op_t save = context_get_current_op (); \ SWITCH_METRICS_OP (op); /* Switch back to metrics operation saved by SAVE_THEN_SWITCH_METRICS_OP */ @@ -97,6 +112,8 @@ glwrap_lookup (char *name) const char *path; path = getenv ("FIPS_LIBGL"); + if (! path) + path = getenv ("GLAZE_LIBGL"); if (path) { gl_handle = dlopen (path, RTLD_LAZY); @@ -113,7 +130,7 @@ glwrap_lookup (char *name) ret = dlwrap_real_dlsym (gl_handle, name); if (ret == NULL) { - fprintf (stderr, "Error: glwrap_lookup failed to dlsym %s\n", + fprintf (stderr, "fips: Error: glwrap_lookup failed to dlsym %s\n", name); exit (1); } @@ -970,7 +987,8 @@ glTexImage2D (GLenum target, GLint level, GLint internalFormat, void glTexImage2DMultisample (GLenum target, GLsizei samples, - GLint internalformat, GLsizei width, GLsizei height, + GLint_or_enum internalformat, + GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { SAVE_THEN_SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE); @@ -1023,7 +1041,8 @@ glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, } void -glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, +glTexImage3DMultisample (GLenum target, GLsizei samples, + GLint_or_enum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { @@ -1494,7 +1513,8 @@ glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, void glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, - GLenum internalformat, GLsizei width, GLint border, + GLenum_or_int internalformat, + GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { SAVE_THEN_SWITCH_METRICS_OP (METRICS_OP_TEX_IMAGE); @@ -1507,7 +1527,8 @@ glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, void glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, - GLenum internalformat, GLsizei width, GLsizei height, + GLenum_or_int internalformat, + GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { @@ -1522,7 +1543,8 @@ glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, void glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, - GLenum internalformat, GLsizei width, GLsizei height, + GLenum_or_int internalformat, + GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) {