Make Metal default graphics API for macOS

This commit is contained in:
Jack Andersen 2017-11-21 12:18:23 -10:00
parent 49d76b84be
commit e0cabf9e1c
1 changed files with 11 additions and 5 deletions

View File

@ -92,15 +92,21 @@ public:
/* Determine which graphics API to use */ /* Determine which graphics API to use */
#if BOO_HAS_METAL #if BOO_HAS_METAL
bool useGL = false;
for (const SystemString& arg : args) for (const SystemString& arg : args)
if (!arg.compare("--metal")) if (!arg.compare("--gl"))
{ {
m_metalCtx.m_dev = MTLCreateSystemDefaultDevice(); useGL = true;
m_metalCtx.m_q = [m_metalCtx.m_dev newCommandQueue];
Log.report(logvisor::Info, "using Metal renderer");
break; break;
} }
if (!m_metalCtx.m_dev) if (!useGL)
m_metalCtx.m_dev = MTLCreateSystemDefaultDevice();
if (m_metalCtx.m_dev)
{
m_metalCtx.m_q = [m_metalCtx.m_dev newCommandQueue];
Log.report(logvisor::Info, "using Metal renderer");
}
else
Log.report(logvisor::Info, "using OpenGL renderer"); Log.report(logvisor::Info, "using OpenGL renderer");
#else #else
Log.report(logvisor::Info, "using OpenGL renderer"); Log.report(logvisor::Info, "using OpenGL renderer");