Refactor demo API test initialisation order

* Instead of only doing a very lightweight check to see if the API is available
  up-front, we now share the API initialisation among all API tests far enough
  to determine availability of extensions, features, etc. Then we can precisely
  determine which tests are available and which aren't before running.
This commit is contained in:
baldurk
2019-05-23 13:18:37 +01:00
parent efb8788c52
commit ec8564642a
91 changed files with 932 additions and 775 deletions
+21 -20
View File
@@ -29,10 +29,28 @@
#include "../linux/linux_window.h"
bool OpenGLGraphicsTest::Init(int argc, char **argv)
void OpenGLGraphicsTest::Prepare(int argc, char **argv)
{
// parse parameters here to override parameters
GraphicsTest::Init(argc, argv);
GraphicsTest::Prepare(argc, argv);
static bool prepared = false;
static void *libGL = NULL;
if(!prepared)
{
prepared = true;
libGL = dlopen("libGL.so", RTLD_GLOBAL | RTLD_NOW);
}
if(!libGL)
Avail = "libGL.so is not available";
}
bool OpenGLGraphicsTest::Init()
{
if(!GraphicsTest::Init())
return false;
X11Window::Init();
@@ -65,23 +83,6 @@ bool OpenGLGraphicsTest::Init(int argc, char **argv)
return true;
}
bool OpenGLGraphicsTest::IsSupported()
{
static bool checked = false, result = false;
if(checked)
return result;
checked = true;
void *GL = dlopen("libGL.so", RTLD_GLOBAL | RTLD_NOW);
if(GL)
result = true;
return result;
}
GraphicsWindow *OpenGLGraphicsTest::MakeWindow(int width, int height, const char *title)
{
return new X11Window(width, height, title);