From dadb44ef46cb83a957507a1d2d5d20986b3cec22 Mon Sep 17 00:00:00 2001 From: Robert Campbell Date: Thu, 30 Jan 2020 04:39:19 -0500 Subject: Introduced NativeWindow wrapper for supported platforms --- Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp | 2 +- Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm | 2 +- Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp | 8 ++++---- Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm | 2 +- Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp | 6 +++--- Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm | 2 +- Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp index 54787d46..705124eb 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp @@ -237,7 +237,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa major_version_(0), minor_version_(0) { - auto* NativeWindow = reinterpret_cast(InitAttribs.pNativeWndHandle); + auto* NativeWindow = reinterpret_cast(InitAttribs.Window.pAWindow); Init(NativeWindow); FillDeviceCaps(deviceCaps); diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm index 3381698c..25310e74 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.pNativeWndHandle != nullptr ? "Initialized OpenGLES " : "Attached to OpenGLES ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); + LOG_INFO_MESSAGE(Info.Window.pNSView != 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/GLContextLinux.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp index ce27deb7..8a3174fe 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp @@ -87,8 +87,8 @@ void openglCallbackFunction(GLenum source, GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCaps, const struct SwapChainDesc* /*pSCDesc*/) : m_Context(0), - m_pNativeWindow(InitAttribs.pNativeWndHandle), - m_pDisplay(InitAttribs.pDisplay) + m_pNativeWindow(InitAttribs.Window.pWindow), + m_pDisplay(InitAttribs.Window.pDisplay) { auto CurrentCtx = glXGetCurrentContext(); if (CurrentCtx == 0) @@ -101,7 +101,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa if (GLEW_OK != err) LOG_ERROR_AND_THROW("Failed to initialize GLEW"); - if (InitAttribs.pNativeWndHandle != nullptr && InitAttribs.pDisplay != nullptr) + if (InitAttribs.Window.pWindow != nullptr && InitAttribs.Window.pDisplay != nullptr) { //glXSwapIntervalEXT(0); @@ -127,7 +127,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa //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.pNativeWndHandle != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); + LOG_INFO_MESSAGE(InitAttribs.Window.pWindow != 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/GLContextMacOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm index 56bb5d22..35418f6b 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.pNativeWndHandle != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')'); + LOG_INFO_MESSAGE(InitAttribs.Window.pNSWindow != 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/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp index 2bfd7d9d..2aef9128 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp @@ -104,9 +104,9 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa m_WindowHandleToDeviceContext{0} { Int32 MajorVersion = 0, MinorVersion = 0; - if (InitAttribs.pNativeWndHandle != nullptr) + if (InitAttribs.Window.hWnd != nullptr) { - HWND hWnd = reinterpret_cast(InitAttribs.pNativeWndHandle); + HWND hWnd = reinterpret_cast(InitAttribs.Window.hWnd); // See http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_(C%2B%2B/Win) // http://www.opengl.org/wiki/Creating_an_OpenGL_Context_(WGL) @@ -273,7 +273,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa //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.pNativeWndHandle != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ')'); + LOG_INFO_MESSAGE(InitAttribs.Window.hWnd != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ')'); // 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 c2a95ed0..a7b64e7a 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.pNativeWndHandle; + m_CALayer = InitAttribs.Window.pNSView; InitRenderBuffers(true, m_SwapChainDesc.Width, m_SwapChainDesc.Height); CreateDummyBuffers(m_pRenderDevice.RawPtr()); } diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp index 6245c02e..4c98b44b 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp @@ -48,14 +48,14 @@ SwapChainGLImpl::SwapChainGLImpl(IReferenceCounters* pRefCounters, // clang-format on { #if PLATFORM_WIN32 - HWND hWnd = reinterpret_cast(InitAttribs.pNativeWndHandle); + HWND hWnd = reinterpret_cast(InitAttribs.Window.hWnd); RECT rc; GetClientRect(hWnd, &rc); m_SwapChainDesc.Width = rc.right - rc.left; m_SwapChainDesc.Height = rc.bottom - rc.top; #elif PLATFORM_LINUX - auto wnd = static_cast(reinterpret_cast(InitAttribs.pNativeWndHandle)); - auto display = reinterpret_cast(InitAttribs.pDisplay); + auto wnd = static_cast(reinterpret_cast(InitAttribs.Window.pWindow)); + auto display = reinterpret_cast(InitAttribs.Window.pDisplay); XWindowAttributes XWndAttribs; XGetWindowAttributes(display, wnd, &XWndAttribs); -- cgit v1.2.3