diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 7f5e5fdcf4..284f709c02 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -328,14 +328,6 @@ int main(int argc, const char* argv[]) if (testFilenames.empty()) return printUsage(argv[0], argc <= 1 ? NULL : "No executables specified"); - HeadlessHost *headlessHost = getHost(gpuCore); - headlessHost->SetGraphicsCore(gpuCore); - host = headlessHost; - - std::string error_string; - GraphicsContext *graphicsContext = nullptr; - bool glWorking = host->InitGraphics(&error_string, &graphicsContext); - LogManager::Init(&g_Config.bEnableLogging); LogManager *logman = LogManager::GetInstance(); @@ -348,6 +340,14 @@ int main(int argc, const char* argv[]) } logman->AddListener(printfLogger); + HeadlessHost *headlessHost = getHost(gpuCore); + headlessHost->SetGraphicsCore(gpuCore); + host = headlessHost; + + std::string error_string; + GraphicsContext *graphicsContext = nullptr; + bool glWorking = host->InitGraphics(&error_string, &graphicsContext); + CoreParameter coreParameter; coreParameter.cpuCore = cpuCore; coreParameter.gpuCore = glWorking ? gpuCore : GPUCORE_NULL;