[Piglit] [PATCH v2 13/13] glean: use piglit_get_proc_address().
Paul Berry
stereotype441 at gmail.com
Mon Mar 12 14:41:47 PDT 2012
Previously glean got the address of GL functions by directly calling
an OS-specific function (e.g. glXGetProcAddressARB(), dlsym(), or
wglGetProcAddress()). This patch changes it to use
piglit_get_proc_address(), which uses piglit-dispatch. This will help
pave the way for adapting glean to test using GLES and
forward-compatible contexts.
---
tests/glean/glutils.cpp | 26 ++------------------------
1 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/tests/glean/glutils.cpp b/tests/glean/glutils.cpp
index 70cf0cc..23dc27a 100644
--- a/tests/glean/glutils.cpp
+++ b/tests/glean/glutils.cpp
@@ -43,6 +43,7 @@
#if defined(__AGL__)
# include <cstring>
#endif
+#include "piglit-util.h"
namespace GLEAN {
@@ -119,30 +120,7 @@ getVersion()
///////////////////////////////////////////////////////////////////////////////
void
(*getProcAddress(const char* name))() {
-#if defined(__X11__)
-# if defined(GLX_ARB_get_proc_address)
- return glXGetProcAddressARB(reinterpret_cast<const GLubyte*>(name));
-# else
- // XXX This isn't guaranteed to work, but it may be the best option
- // we have at the moment.
- void* libHandle = dlopen("libGL.so", RTLD_LAZY);
- if (libHandle) {
- void* funcPointer = dlsym(libHandle, name);
- dlclose(libHandle);
- return funcPointer;
- } else
- return 0;
-# endif
-#elif defined(__WIN__)
- // Gotta be a little more explicit about the cast to please MSVC.
- typedef void (__cdecl* VOID_FUNC_VOID) ();
- return reinterpret_cast<VOID_FUNC_VOID>(wglGetProcAddress(name));
-#elif defined(__BEWIN__)
-# error "Need GetProcAddress (or equivalent) for BeOS"
- return 0;
-#elif defined(__AGL__)
- return reinterpret_cast<void (*)()>(dlsym(RTLD_DEFAULT, name));
-#endif
+ return piglit_get_proc_address(name);
} // getProcAddress
///////////////////////////////////////////////////////////////////////////////
--
1.7.7.6
More information about the Piglit
mailing list