metal: initial work on windowing and instance creation

This commit is contained in:
Alex Szpakowski
2020-01-30 20:35:33 -04:00
parent 74cf9b8236
commit d687b4c099
9 changed files with 243 additions and 81 deletions
+40
View File
@@ -133,6 +133,22 @@ static MTLBlendFactor getMTLBlendFactor(BlendFactor factor)
return MTLBlendFactorZero;
}
love::graphics::Graphics *createInstance()
{
love::graphics::Graphics *instance = nullptr;
try
{
instance = new Graphics();
}
catch (love::Exception &e)
{
printf("Cannot create Metal renderer: %s\n", e.what());
}
return instance;
}
Graphics::Graphics()
: device(nil)
, commandQueue(nil)
@@ -935,6 +951,30 @@ void Graphics::setBlendState(const BlendState &blend)
}
}
Graphics::Renderer Graphics::getRenderer() const
{
return RENDERER_METAL;
}
bool Graphics::usesGLSLES() const
{
#ifdef LOVE_IOS
return true;
#else
return false;
#endif
}
Graphics::RendererInfo Graphics::getRendererInfo() const
{
RendererInfo info;
info.name = "Metal";
info.version = "1"; // TODO
info.vendor = ""; // TODO
info.device = device.name.UTF8String;
return info;
}
} // metal
} // graphics
} // love