summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineMetal
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-28 00:37:47 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-28 00:37:47 +0000
commit3e03b75e007491cad90a807820c01d0dfa7e7de9 (patch)
treec9de86409a2c7803c047bcda37940ddf644cfc81 /Graphics/GraphicsEngineMetal
parentFixed minor issue with draw command test (diff)
downloadDiligentCore-3e03b75e007491cad90a807820c01d0dfa7e7de9.tar.gz
DiligentCore-3e03b75e007491cad90a807820c01d0dfa7e7de9.zip
Fixed few MacOS build issues
Diffstat (limited to 'Graphics/GraphicsEngineMetal')
-rw-r--r--Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h2
-rw-r--r--Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm34
-rw-r--r--Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm22
3 files changed, 10 insertions, 48 deletions
diff --git a/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h b/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h
index 32020922..eb7f1aa0 100644
--- a/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h
+++ b/Graphics/GraphicsEngineMetal/include/DeviceContextMtlImpl.h
@@ -109,7 +109,7 @@ public:
virtual void UpdateBuffer(IBuffer* pBuffer,
Uint32 Offset,
Uint32 Size,
- const PVoid pData,
+ const void* pData,
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) override final;
virtual void CopyBuffer(IBuffer* pSrcBuffer,
diff --git a/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm
index 410a6a84..afbfd43a 100644
--- a/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm
+++ b/Graphics/GraphicsEngineMetal/src/DeviceContextMtlImpl.mm
@@ -160,36 +160,20 @@ namespace Diligent
Uint8 Stencil,
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
- if (pView == nullptr)
- {
- if (m_pSwapChain)
- {
- pView = m_pSwapChain->GetDepthBufferDSV();
- }
- else
- {
- LOG_ERROR("Failed to clear default depth stencil buffer: swap chain is not initialized in the device context");
- return;
- }
- }
+ if (!TDeviceContextBase::ClearDepthStencil(pView))
+ return;
+
+ VERIFY_EXPR(pView != nullptr);
LOG_ERROR_MESSAGE("DeviceContextMtlImpl::ClearDepthStencil() is not implemented");
}
void DeviceContextMtlImpl::ClearRenderTarget( ITextureView* pView, const float *RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )
{
- if (pView == nullptr)
- {
- if (m_pSwapChain != nullptr)
- {
- pView = m_pSwapChain->GetCurrentBackBufferRTV();
- }
- else
- {
- LOG_ERROR("Failed to clear default render target: swap chain is not initialized in the device context");
- return;
- }
- }
+ if (!TDeviceContextBase::ClearRenderTarget(pView))
+ return;
+
+ VERIFY_EXPR(pView != nullptr);
LOG_ERROR_MESSAGE("DeviceContextMtlImpl::ClearRenderTarget() is not implemented");
}
@@ -202,7 +186,7 @@ namespace Diligent
void DeviceContextMtlImpl::UpdateBuffer(IBuffer* pBuffer,
Uint32 Offset,
Uint32 Size,
- const PVoid pData,
+ const void* pData,
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
TDeviceContextBase::UpdateBuffer(pBuffer, Offset, Size, pData, StateTransitionMode);
diff --git a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm
index e87dbc27..2f8d1eb1 100644
--- a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm
+++ b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm
@@ -200,28 +200,6 @@ void EngineFactoryMtlImpl::CreateSwapChainMtl(IRenderDevice* pDevice,
auto *pSwapChainMtl = NEW_RC_OBJ(RawMemAllocator, "SwapChainMtlImpl instance", SwapChainMtlImpl)
(SCDesc, pDeviceMtl, pDeviceContextMtl, pView);
pSwapChainMtl->QueryInterface( IID_SwapChain, reinterpret_cast<IObject**>(ppSwapChain) );
-
- pDeviceContextMtl->SetSwapChain(pSwapChainMtl);
- // Bind default render target
- pDeviceContextMtl->SetRenderTargets( 0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION );
- // Set default viewport
- pDeviceContextMtl->SetViewports( 1, nullptr, 0, 0 );
-
- auto NumDeferredCtx = pDeviceMtl->GetNumDeferredContexts();
- for (size_t ctx = 0; ctx < NumDeferredCtx; ++ctx)
- {
- if (auto pDeferredCtx = pDeviceMtl->GetDeferredContext(ctx))
- {
- auto *pDeferredCtxMtl = pDeferredCtx.RawPtr<DeviceContextMtlImpl>();
- pDeferredCtxMtl->SetSwapChain(pSwapChainMtl);
- // Do not bind default render target and viewport to be
- // consistent with D3D12
- //// Bind default render target
- //pDeferredCtxMtl->SetRenderTargets( 0, nullptr, nullptr );
- //// Set default viewport
- //pDeferredCtxMtl->SetViewports( 1, nullptr, 0, 0 );
- }
- }
}
catch( const std::runtime_error & )
{