OS X fixes

This commit is contained in:
Jack Andersen 2015-11-17 10:33:12 -10:00
parent 9e1441c323
commit 742e062cf2
1 changed files with 20 additions and 0 deletions

View File

@ -162,6 +162,7 @@ class GraphicsContextCocoaGL : public GraphicsContextCocoa
IGraphicsCommandQueue* m_commandQueue = nullptr; IGraphicsCommandQueue* m_commandQueue = nullptr;
IGraphicsDataFactory* m_dataFactory = nullptr; IGraphicsDataFactory* m_dataFactory = nullptr;
NSOpenGLContext* m_mainCtx = nullptr;
NSOpenGLContext* m_loadCtx = nullptr; NSOpenGLContext* m_loadCtx = nullptr;
public: public:
@ -235,6 +236,20 @@ public:
return m_dataFactory; return m_dataFactory;
} }
IGraphicsDataFactory* getMainContextDataFactory()
{
if (!m_mainCtx)
{
NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_TABLE[m_pf]];
m_mainCtx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:[m_nsContext openGLContext]];
[nspf release];
if (!m_mainCtx)
Log.report(LogVisor::FatalError, "unable to make main NSOpenGLContext");
[m_mainCtx makeCurrentContext];
}
return m_dataFactory;
}
IGraphicsDataFactory* getLoadContextDataFactory() IGraphicsDataFactory* getLoadContextDataFactory()
{ {
if (!m_loadCtx) if (!m_loadCtx)
@ -1125,6 +1140,11 @@ public:
return m_gfxCtx->getDataFactory(); return m_gfxCtx->getDataFactory();
} }
IGraphicsDataFactory* getMainContextDataFactory()
{
return m_gfxCtx->getMainContextDataFactory();
}
IGraphicsDataFactory* getLoadContextDataFactory() IGraphicsDataFactory* getLoadContextDataFactory()
{ {
return m_gfxCtx->getLoadContextDataFactory(); return m_gfxCtx->getLoadContextDataFactory();