mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
metal: initial work on windowing and instance creation
This commit is contained in:
@@ -88,6 +88,7 @@ public:
|
||||
bool isCanvasFormatSupported(PixelFormat format, bool readable) const override;
|
||||
bool isImageFormatSupported(PixelFormat format, bool sRGB) const override;
|
||||
Renderer getRenderer() const override;
|
||||
bool usesGLSLES() const override;
|
||||
RendererInfo getRendererInfo() const override;
|
||||
|
||||
Shader::Language getShaderLanguageTarget() const override;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user