[Piglit] [PATCH 1/2] piglit-dispatch: fix get_core_proc_address() for Windows

Brian Paul brianp at vmware.com
Wed Jun 25 10:50:50 PDT 2014


Even for functions such as glGetStringi() which are in OpenGL 3.0, we
call get_core_proc_address() with gl_10x_version = 10 (seems to be a
larger problem in the dispatch code generation).  That means we try
GetProcAddress("OPENGL32.DLL") and fail.  Now, if GetProcAddress()
fails, try get_ext_proc_address() too.
---
 tests/util/piglit-dispatch-init.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-dispatch-init.c b/tests/util/piglit-dispatch-init.c
index 22318a3..456f75b 100644
--- a/tests/util/piglit-dispatch-init.c
+++ b/tests/util/piglit-dispatch-init.c
@@ -94,8 +94,16 @@ get_core_proc_address(const char *function_name, int gl_10x_version)
 	if (gl_10x_version > 11) {
 		return get_ext_proc_address(function_name);
 	} else {
-		return (piglit_dispatch_function_ptr)
+		piglit_dispatch_function_ptr p;
+		/* Try GetProcAddress() first.
+		 * If that fails, try wglGetProcAddress().
+		 */
+		p = (piglit_dispatch_function_ptr)
 			GetProcAddress(LoadLibraryA("OPENGL32"), function_name);
+		if (!p)
+			p = get_ext_proc_address(function_name);
+		return p;
+
 	}
 }
 
-- 
1.7.10.4



More information about the Piglit mailing list