From a8143c85fec240e0fdb17db731f8e06a0d0f48c3 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 3 Feb 2020 10:37:34 -0800 Subject: Updated Mac and iOS native window structs --- .../GraphicsEngineMetal/include/SwapChainMtlImpl.h | 2 +- .../interface/EngineFactoryMtl.h | 2 +- .../GraphicsEngineMetal/src/EngineFactoryMtl.mm | 22 +++++++++++----------- .../GraphicsEngineMetal/src/SwapChainMtlImpl.mm | 2 +- Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm | 2 +- .../GraphicsEngineOpenGL/src/GLContextMacOS.mm | 2 +- .../GraphicsEngineOpenGL/src/SwapChainGLIOS.mm | 2 +- .../GraphicsEngineVulkan/src/SwapChainVkImpl.cpp | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h b/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h index 0654f2a7..a868dd32 100644 --- a/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h +++ b/Graphics/GraphicsEngineMetal/include/SwapChainMtlImpl.h @@ -42,7 +42,7 @@ public: const SwapChainDesc& SCDesc, class RenderDeviceMtlImpl* pRenderDeviceMtl, class DeviceContextMtlImpl* pDeviceContextMtl, - void* pView); + const NativeWindow& Window); ~SwapChainMtlImpl(); virtual void QueryInterface(const Diligent::INTERFACE_ID& IID, IObject** ppInterface) override final; diff --git a/Graphics/GraphicsEngineMetal/interface/EngineFactoryMtl.h b/Graphics/GraphicsEngineMetal/interface/EngineFactoryMtl.h index 7509f082..996b01a4 100644 --- a/Graphics/GraphicsEngineMetal/interface/EngineFactoryMtl.h +++ b/Graphics/GraphicsEngineMetal/interface/EngineFactoryMtl.h @@ -53,7 +53,7 @@ public: virtual void CreateSwapChainMtl(IRenderDevice* pDevice, IDeviceContext* pImmediateContext, const SwapChainDesc& SCDesc, - void* pView, + const NativeWindow& Window, ISwapChain** ppSwapChain) = 0; virtual void AttachToMtlDevice(void* pMtlNativeDevice, diff --git a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm index a845f121..3425c849 100644 --- a/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm +++ b/Graphics/GraphicsEngineMetal/src/EngineFactoryMtl.mm @@ -54,11 +54,11 @@ public: IRenderDevice** ppDevice, IDeviceContext** ppContexts)override final; - void CreateSwapChainMtl( IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SCDesc, - void* pView, - ISwapChain** ppSwapChain )override final; + void CreateSwapChainMtl( IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc& SCDesc, + const NativeWindow& Window, + ISwapChain** ppSwapChain )override final; void AttachToMtlDevice(void* pMtlNativeDevice, const EngineMtlCreateInfo& EngineCI, @@ -179,11 +179,11 @@ void EngineFactoryMtlImpl::AttachToMtlDevice(void* pMtlNat /// /// \param [out] ppSwapChain - Address of the memory location where pointer to the new /// swap chain will be written -void EngineFactoryMtlImpl::CreateSwapChainMtl(IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SCDesc, - void* pView, - ISwapChain** ppSwapChain ) +void EngineFactoryMtlImpl::CreateSwapChainMtl(IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc& SCDesc, + const NativeWindow& Window, + ISwapChain** ppSwapChain ) { VERIFY( ppSwapChain, "Null pointer provided" ); if( !ppSwapChain ) @@ -198,7 +198,7 @@ void EngineFactoryMtlImpl::CreateSwapChainMtl(IRenderDevice* pDevice, auto &RawMemAllocator = GetRawAllocator(); auto *pSwapChainMtl = NEW_RC_OBJ(RawMemAllocator, "SwapChainMtlImpl instance", SwapChainMtlImpl) - (SCDesc, pDeviceMtl, pDeviceContextMtl, pView); + (SCDesc, pDeviceMtl, pDeviceContextMtl, Window); pSwapChainMtl->QueryInterface( IID_SwapChain, reinterpret_cast(ppSwapChain) ); } catch( const std::runtime_error & ) diff --git a/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm b/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm index b9974659..87ba6a6b 100644 --- a/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm +++ b/Graphics/GraphicsEngineMetal/src/SwapChainMtlImpl.mm @@ -32,7 +32,7 @@ SwapChainMtlImpl::SwapChainMtlImpl(IReferenceCounters* pRefCounters, const SwapChainDesc& SCDesc, RenderDeviceMtlImpl* pRenderDeviceMtl, DeviceContextMtlImpl* pDeviceContextMtl, - void* pNativeWndHandle) : + const NativeWindow& Window) : TSwapChainBase(pRefCounters, pRenderDeviceMtl, pDeviceContextMtl, SCDesc) { LOG_ERROR_AND_THROW("Swap chain is not implemented in Metal backend"); diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm index 25310e74..731633b8 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm @@ -46,7 +46,7 @@ namespace Diligent //Or better yet, use the GL3 way to get the version number glGetIntegerv( GL_MAJOR_VERSION, &MajorVersion ); glGetIntegerv( GL_MINOR_VERSION, &MinorVersion ); - LOG_INFO_MESSAGE(Info.Window.pNSView != nullptr ? "Initialized OpenGLES " : "Attached to OpenGLES ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); + LOG_INFO_MESSAGE(Info.Window.pCALayer != nullptr ? "Initialized OpenGLES " : "Attached to OpenGLES ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); // Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap. // This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm index 35418f6b..d9482837 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm @@ -74,7 +74,7 @@ namespace Diligent //Or better yet, use the GL3 way to get the version number glGetIntegerv( GL_MAJOR_VERSION, &MajorVersion ); glGetIntegerv( GL_MINOR_VERSION, &MinorVersion ); - LOG_INFO_MESSAGE(InitAttribs.Window.pNSWindow != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); + LOG_INFO_MESSAGE(InitAttribs.Window.pNSView != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); // Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap. // This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm index a7b64e7a..d31c5055 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm +++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm @@ -43,7 +43,7 @@ SwapChainGLIOS::SwapChainGLIOS(IReferenceCounters* pRefCounters, m_DepthRenderBuffer(false), m_DefaultFBO(false) { - m_CALayer = InitAttribs.Window.pNSView; + m_CALayer = InitAttribs.Window.pCALayer; InitRenderBuffers(true, m_SwapChainDesc.Width, m_SwapChainDesc.Height); CreateDummyBuffers(m_pRenderDevice.RawPtr()); } diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index f3096fd9..147e4f1f 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -69,14 +69,14 @@ SwapChainVkImpl::SwapChainVkImpl(IReferenceCounters* pRefCounters, VkIOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; - surfaceCreateInfo.pView = Window.pNSView; + surfaceCreateInfo.pView = Window.pCALayer; auto err = vkCreateIOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, nullptr, &m_VkSurface); #elif defined(VK_USE_PLATFORM_MACOS_MVK) VkMacOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; - surfaceCreateInfo.pView = Window.pNSWindow; + surfaceCreateInfo.pView = Window.pNSView; auto err = vkCreateMacOSSurfaceMVK(m_VulkanInstance->GetVkInstance(), &surfaceCreateInfo, NULL, &m_VkSurface); #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) -- cgit v1.2.3