<div dir="ltr">On 5 June 2013 16:14, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Notably, waffle has EGL bits which this stuff doesn't. We can't<br>
globally enable this and remove the old platform-specific<br>
dlsym/getprocaddress code, because waffle isn't always built against<br>
yet, and even when we're building against it, it's not used in some of<br>
the EGL/GLX tests (yet, at least).<br>
---<br>
tests/util/piglit-dispatch.c | 62 ++++++++++++++++++++++++++++++++++++++++<br>
tests/util/piglit-framework-gl.c | 2 +-<br>
tests/util/piglit-framework-gl.h | 1 +<br>
3 files changed, 64 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c<br>
index 4b7f4fa..3ce89f7 100644<br>
--- a/tests/util/piglit-dispatch.c<br>
+++ b/tests/util/piglit-dispatch.c<br>
@@ -23,6 +23,12 @@<br>
#include "piglit-dispatch.h"<br>
#include "piglit-util-gl-common.h"<br>
<br>
+#if defined(PIGLIT_USE_WAFFLE)<br>
+#include <waffle.h><br>
+#include "piglit-util-waffle.h"<br>
+#include "piglit-framework-gl.h"<br>
+#endif<br>
+<br>
#ifdef _WIN32<br>
#define inline __inline<br>
#endif<br>
@@ -82,6 +88,43 @@ check_initialized()<br>
exit(1);<br>
}<br>
<br>
+#ifdef PIGLIT_USE_WAFFLE<br>
+static enum waffle_enum piglit_waffle_dl = WAFFLE_DL_OPENGL;<br>
+<br>
+/**<br>
+ * Generated code calls this function to retrieve the address of a<br>
+ * core function.<br>
+ */<br>
+static piglit_dispatch_function_ptr<br>
+get_wfl_core_proc(const char *name, int gl_10x_version)<br>
+{<br>
+ piglit_dispatch_function_ptr func;<br>
+<br>
+ func = (piglit_dispatch_function_ptr)waffle_dl_sym(piglit_waffle_dl,<br>
+ name);<br>
+ if (!func)<br>
+ wfl_log_error(__FUNCTION__);<br>
+<br>
+ return func;<br>
+}<br>
+<br>
+/**<br>
+ * Generated code calls this function to retrieve the address of a<br>
+ * core function.<br>
+ */<br>
+static piglit_dispatch_function_ptr<br>
+get_wfl_ext_proc(const char *name)<br>
+{<br>
+ piglit_dispatch_function_ptr func;<br>
+<br>
+ func = (piglit_dispatch_function_ptr)waffle_get_proc_address(name);<br>
+ if (!func)<br>
+ wfl_log_error(__FUNCTION__);<br>
+<br>
+ return func;<br>
+}<br>
+#endif<br>
+<br>
/**<br>
* Generated code calls this function to retrieve the address of a<br>
* core function.<br>
@@ -171,6 +214,25 @@ piglit_dispatch_init(piglit_dispatch_api api,<br>
unsupported = unsupported_proc;<br>
get_proc_address_failure = failure_proc;<br>
<br>
+#ifdef PIGLIT_USE_WAFFLE<br>
+ switch (api) {<br>
+ case PIGLIT_DISPATCH_GL:<br>
+ piglit_waffle_dl = WAFFLE_DL_OPENGL;<br>
+ break;<br>
+ case PIGLIT_DISPATCH_ES1:<br>
+ piglit_waffle_dl = WAFFLE_DL_OPENGL_ES1;<br>
+ break;<br>
+ case PIGLIT_DISPATCH_ES2:<br>
+ piglit_waffle_dl = WAFFLE_DL_OPENGL_ES2;<br>
+ break;<br>
+ }<br>
+<br>
+ if (gl_fw) {<br>
+ get_core_proc_address = get_wfl_core_proc;<br>
+ get_ext_proc_address = get_wfl_ext_proc;<br>
+ }<br>
+#endif<br>
+<br></blockquote><div><br></div><div>Can we update the comment above this function to say that get_core_proc_address and get_ext_proc_address are ignored when Waffle is in use?<br><br>With that, this patch is:<br><br></div>
<div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/* No need to reset the dispatch pointers the first time */<br>
if (is_initialized) {<br>
reset_dispatch_pointers();<br>
diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c<br>
index 441e271..077d370 100644<br>
--- a/tests/util/piglit-framework-gl.c<br>
+++ b/tests/util/piglit-framework-gl.c<br>
@@ -30,7 +30,7 @@<br>
#include "piglit-util-gl-common.h"<br>
#include "piglit-framework-gl/piglit_gl_framework.h"<br>
<br>
-static struct piglit_gl_framework *gl_fw;<br>
+struct piglit_gl_framework *gl_fw;<br>
<br>
bool piglit_use_fbo = false;<br>
int piglit_automatic = 0;<br>
diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h<br>
index 4406c1b..5e1723b 100644<br>
--- a/tests/util/piglit-framework-gl.h<br>
+++ b/tests/util/piglit-framework-gl.h<br>
@@ -234,6 +234,7 @@ extern int piglit_width;<br>
extern int piglit_height;<br>
extern bool piglit_use_fbo;<br>
extern unsigned int piglit_winsys_fbo;<br>
+extern struct piglit_gl_framework *gl_fw;<br>
<br>
void piglit_swap_buffers(void);<br>
void piglit_present_results();<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.rc0<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>