/** * Initialize the dispatch mechanism. * * \param api is the API under test. This determines whether * deprecated functionality is supported (since deprecated functions * cannot be used in forward compatible contexts). It also affects * which GL version is queried for (since, for example a function * might be supported in GLES as of version 2.0, but in OpenGL only as * of version 2.1). Not yet implemented. * * \param get_core_proc and get_ext_proc are the functions to call to * retrieve the address of a core GL function or an extension * function. Note that for OpenGL, these can both map to the same * function (e.g. glXGetProcAddressARB). However, in GLES, core * functions are not allowed to be queried using the GetProcAddress * mechanism, so get_core_proc will need to be implemented by looking * up a symbol in a shared library (e.g. using dlsym()). * * \param unsupported_proc is the function to call if a test attempts * to use unsupported GL functionality. It is passed the name of the * function that the test attempted to use. * * \param failure_proc is the function to call if a call to * get_core_proc() or get_ext_proc() unexpectedly returned NULL. It * is passed the name of the function that was passed to * get_core_proc() or get_ext_proc(). */ void piglit_dispatch_init(piglit_dispatch_api api, piglit_get_core_proc_address_function_ptr get_core_proc, piglit_get_ext_proc_address_function_ptr get_ext_proc, piglit_error_function_ptr unsupported_proc, piglit_error_function_ptr failure_proc) { (void) api; /* Not yet implemented--assume GL. */ get_core_proc_address = get_core_proc; get_ext_proc_address = get_ext_proc; unsupported = unsupported_proc; get_proc_address_failure = failure_proc; /* No need to reset the dispatch pointers the first time */ if (is_initialized) { reset_dispatch_pointers(); } is_initialized = true; /* Store the GL version and extension string for use by * check_version() and check_extension(). Note: the * following two calls are safe because the only GL function * they call is glGetString(), and the stub function for * glGetString does not need to call check_version() or * check_extension(). */ gl_version = piglit_get_gl_version(); gl_extensions = (const char *) glGetString(GL_EXTENSIONS); }
/** * Initialize the dispatch mechanism. * * \param api is the API under test. This determines whether * deprecated functionality is supported (since deprecated functions * cannot be used in forward compatible contexts). It also affects * which GL version is queried for (since, for example a function * might be supported in GLES as of version 2.0, but in OpenGL only as * of version 2.1). Not yet implemented. * * \param get_core_proc and get_ext_proc are the functions to call to * retrieve the address of a core GL function or an extension * function. Note that for OpenGL, these can both map to the same * function (e.g. glXGetProcAddressARB). However, in GLES, core * functions are not allowed to be queried using the GetProcAddress * mechanism, so get_core_proc will need to be implemented by looking * up a symbol in a shared library (e.g. using dlsym()). When Waffle * is in use, these are ignored and replaced with the Waffle functions * that do the appropriate lookup according to the platform. One day * we'll drop non-waffle support and remove this part of the * interface. * * \param unsupported_proc is the function to call if a test attempts * to use unsupported GL functionality. It is passed the name of the * function that the test attempted to use. * * \param failure_proc is the function to call if a call to * get_core_proc() or get_ext_proc() unexpectedly returned NULL. It * is passed the name of the function that was passed to * get_core_proc() or get_ext_proc(). */ void piglit_dispatch_init(piglit_dispatch_api api, piglit_get_core_proc_address_function_ptr get_core_proc, piglit_get_ext_proc_address_function_ptr get_ext_proc, piglit_error_function_ptr unsupported_proc, piglit_error_function_ptr failure_proc) { dispatch_api = api; get_core_proc_address = get_core_proc; get_ext_proc_address = get_ext_proc; unsupported = unsupported_proc; get_proc_address_failure = failure_proc; #ifdef PIGLIT_USE_WAFFLE switch (api) { case PIGLIT_DISPATCH_GL: piglit_waffle_dl = WAFFLE_DL_OPENGL; break; case PIGLIT_DISPATCH_ES1: piglit_waffle_dl = WAFFLE_DL_OPENGL_ES1; break; case PIGLIT_DISPATCH_ES2: piglit_waffle_dl = WAFFLE_DL_OPENGL_ES2; break; } if (gl_fw) { get_core_proc_address = get_wfl_core_proc; get_ext_proc_address = get_wfl_ext_proc; } #endif /* No need to reset the dispatch pointers the first time */ if (is_initialized) { reset_dispatch_pointers(); } is_initialized = true; /* Store the GL version and extension string for use by * check_version() and check_extension(). Note: the * following two calls are safe because the only GL function * they call is glGetString(), and the stub function for * glGetString does not need to call check_version() or * check_extension(). */ gl_version = piglit_get_gl_version(); }