From 3e03b75e007491cad90a807820c01d0dfa7e7de9 Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 27 Dec 2019 16:37:47 -0800 Subject: Fixed few MacOS build issues --- .../include/DeviceContextMtlImpl.h | 2 +- .../src/DeviceContextMtlImpl.mm | 34 ++++++---------------- .../GraphicsEngineMetal/src/EngineFactoryMtl.mm | 22 -------------- 3 files changed, 10 insertions(+), 48 deletions(-) (limited to 'Graphics/GraphicsEngineMetal') 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(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(); - 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 & ) { -- cgit v1.2.3