synchronize macOS with latest changes

This commit is contained in:
Jack Andersen 2018-05-26 11:29:19 -10:00
parent b814cb503a
commit 19014e0ba7
4 changed files with 33 additions and 36 deletions

View File

@ -19,7 +19,7 @@ public:
friend class MetalDataFactoryImpl;
MetalDataFactory& m_parent;
ObjToken<BaseGraphicsData> m_data;
Context(MetalDataFactory& parent);
Context(MetalDataFactory& parent __BooTraceArgs);
~Context();
public:
Platform platform() const { return Platform::Metal; }

View File

@ -629,6 +629,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
m_5msFrames = actualSampleRate * 5 / 1000;
ChannelMap& chMapOut = m_mixInfo.m_channelMap;
chMapOut.m_channelCount = 0;
if (chCount > 2)
{
AudioChannelLayout layout;

View File

@ -116,7 +116,7 @@ class MetalDataFactoryImpl : public MetalDataFactory, public GraphicsDataFactory
m_gammaBinding = ctx.newShaderDataBinding(m_gammaShader, m_gammaVFMT, m_gammaVBO.get(), {}, {},
0, nullptr, nullptr, 2, texs, nullptr, nullptr);
return true;
});
} BooTrace);
}
public:
@ -139,8 +139,8 @@ public:
Platform platform() const { return Platform::Metal; }
const char* platformName() const { return "Metal"; }
void commitTransaction(const std::function<bool(IGraphicsDataFactory::Context& ctx)>&);
ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count);
void commitTransaction(const std::function<bool(IGraphicsDataFactory::Context& ctx)>& __BooTraceArgs);
ObjToken<IGraphicsBufferD> newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs);
void _unregisterShareableShader(uint64_t srcKey, uint64_t binKey) { m_sharedShaders.erase(srcKey); }
static bool CheckForMetalCompiler()
@ -1576,8 +1576,8 @@ struct MetalCommandQueue : IGraphicsCommandQueue
}
};
MetalDataFactory::Context::Context(MetalDataFactory& parent)
: m_parent(parent), m_data(new BaseGraphicsData(static_cast<MetalDataFactoryImpl&>(parent))) {}
MetalDataFactory::Context::Context(MetalDataFactory& parent __BooTraceArgs)
: m_parent(parent), m_data(new BaseGraphicsData(static_cast<MetalDataFactoryImpl&>(parent) __BooTraceArgsUse)) {}
MetalDataFactory::Context::~Context() {}
@ -1819,28 +1819,28 @@ MetalDataFactory::Context::newShaderDataBinding(const ObjToken<IShaderPipeline>&
}
}
void MetalDataFactoryImpl::commitTransaction(const FactoryCommitFunc& trans)
void MetalDataFactoryImpl::commitTransaction(const FactoryCommitFunc& trans __BooTraceArgs)
{
MetalDataFactory::Context ctx(*this);
MetalDataFactory::Context ctx(*this __BooTraceArgsUse);
trans(ctx);
}
ObjToken<IGraphicsBufferD> MetalDataFactoryImpl::newPoolBuffer(BufferUse use, size_t stride, size_t count)
ObjToken<IGraphicsBufferD> MetalDataFactoryImpl::newPoolBuffer(BufferUse use, size_t stride, size_t count __BooTraceArgs)
{
ObjToken<BaseGraphicsPool> pool(new BaseGraphicsPool(*this));
ObjToken<BaseGraphicsPool> pool(new BaseGraphicsPool(*this __BooTraceArgsUse));
MetalCommandQueue* q = static_cast<MetalCommandQueue*>(m_parent->getCommandQueue());
return {new MetalGraphicsBufferD<BaseGraphicsPool>(pool, q, use, m_ctx, stride, count)};
}
IGraphicsCommandQueue* _NewMetalCommandQueue(MetalContext* ctx, IWindow* parentWindow,
IGraphicsContext* parent)
std::unique_ptr<IGraphicsCommandQueue> _NewMetalCommandQueue(MetalContext* ctx, IWindow* parentWindow,
IGraphicsContext* parent)
{
return new struct MetalCommandQueue(ctx, parentWindow, parent);
return std::make_unique<MetalCommandQueue>(ctx, parentWindow, parent);
}
IGraphicsDataFactory* _NewMetalDataFactory(IGraphicsContext* parent, MetalContext* ctx)
std::unique_ptr<IGraphicsDataFactory> _NewMetalDataFactory(IGraphicsContext* parent, MetalContext* ctx)
{
return new class MetalDataFactoryImpl(parent, ctx);
return std::make_unique<MetalDataFactoryImpl>(parent, ctx);
}
}

View File

@ -196,19 +196,19 @@ class GraphicsContextCocoaMetal;
namespace boo
{
static logvisor::Module Log("boo::WindowCocoa");
IGraphicsCommandQueue* _NewGLCommandQueue(IGraphicsContext* parent, GLContext* glCtx);
IGraphicsDataFactory* _NewGLDataFactory(IGraphicsContext* parent, GLContext* glCtx);
IGraphicsCommandQueue* _NewMetalCommandQueue(MetalContext* ctx, IWindow* parentWindow,
IGraphicsContext* parent);
IGraphicsDataFactory* _NewMetalDataFactory(IGraphicsContext* parent, MetalContext* ctx);
std::unique_ptr<IGraphicsCommandQueue> _NewGLCommandQueue(IGraphicsContext* parent, GLContext* glCtx);
std::unique_ptr<IGraphicsDataFactory> _NewGLDataFactory(IGraphicsContext* parent, GLContext* glCtx);
std::unique_ptr<IGraphicsCommandQueue> _NewMetalCommandQueue(MetalContext* ctx, IWindow* parentWindow,
IGraphicsContext* parent);
std::unique_ptr<IGraphicsDataFactory> _NewMetalDataFactory(IGraphicsContext* parent, MetalContext* ctx);
void _CocoaUpdateLastGLCtx(NSOpenGLContext* lastGLCtx);
class GraphicsContextCocoaGL : public GraphicsContextCocoa
{
GraphicsContextCocoaGLInternal* m_nsContext = nullptr;
IGraphicsCommandQueue* m_commandQueue = nullptr;
IGraphicsDataFactory* m_dataFactory = nullptr;
std::unique_ptr<IGraphicsDataFactory> m_dataFactory;
std::unique_ptr<IGraphicsCommandQueue> m_commandQueue;
NSOpenGLContext* m_mainCtx = nullptr;
NSOpenGLContext* m_loadCtx = nullptr;
@ -228,8 +228,6 @@ public:
~GraphicsContextCocoaGL()
{
m_commandQueue->stopRenderer();
delete m_commandQueue;
delete m_dataFactory;
printf("CONTEXT DESTROYED\n");
}
@ -281,12 +279,12 @@ public:
IGraphicsCommandQueue* getCommandQueue()
{
return m_commandQueue;
return m_commandQueue.get();
}
IGraphicsDataFactory* getDataFactory()
{
return m_dataFactory;
return m_dataFactory.get();
}
IGraphicsDataFactory* getMainContextDataFactory()
@ -299,7 +297,7 @@ public:
Log.report(logvisor::Fatal, "unable to make main NSOpenGLContext");
}
[m_mainCtx makeCurrentContext];
return m_dataFactory;
return m_dataFactory.get();
}
IGraphicsDataFactory* getLoadContextDataFactory()
@ -312,7 +310,7 @@ public:
Log.report(logvisor::Fatal, "unable to make load NSOpenGLContext");
}
[m_loadCtx makeCurrentContext];
return m_dataFactory;
return m_dataFactory.get();
}
void present()
@ -372,8 +370,8 @@ class GraphicsContextCocoaMetal : public GraphicsContextCocoa
{
GraphicsContextCocoaMetalInternal* m_nsContext = nullptr;
IGraphicsCommandQueue* m_commandQueue = nullptr;
IGraphicsDataFactory* m_dataFactory = nullptr;
std::unique_ptr<IGraphicsDataFactory> m_dataFactory;
std::unique_ptr<IGraphicsCommandQueue> m_commandQueue;
public:
IWindow* m_parentWindow;
@ -391,8 +389,6 @@ public:
~GraphicsContextCocoaMetal()
{
m_commandQueue->stopRenderer();
delete m_commandQueue;
delete m_dataFactory;
m_metalCtx->m_windows.erase(m_parentWindow);
}
@ -445,22 +441,22 @@ public:
IGraphicsCommandQueue* getCommandQueue()
{
return m_commandQueue;
return m_commandQueue.get();
}
IGraphicsDataFactory* getDataFactory()
{
return m_dataFactory;
return m_dataFactory.get();
}
IGraphicsDataFactory* getMainContextDataFactory()
{
return m_dataFactory;
return m_dataFactory.get();
}
IGraphicsDataFactory* getLoadContextDataFactory()
{
return m_dataFactory;
return m_dataFactory.get();
}
void present()