From 13440e98e8cd926620d9913aa72780ceaca4f668 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 30 Oct 2019 10:46:28 -0700 Subject: Some code refactoring --- Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h | 5 ++++- Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 11 ++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h index 1cf1576b..65835fc4 100644 --- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h +++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h @@ -35,11 +35,14 @@ namespace Diligent { +class RenderDeviceGLImpl; + struct DeviceContextGLImplTraits { using BufferType = BufferGLImpl; using TextureType = TextureBaseGL; using PipelineStateType = PipelineStateGLImpl; + using DeviceType = RenderDeviceGLImpl; }; /// Implementation of the Diligent::IDeviceContextGL interface @@ -48,7 +51,7 @@ class DeviceContextGLImpl final : public DeviceContextBase; - DeviceContextGLImpl(IReferenceCounters* pRefCounters, class RenderDeviceGLImpl* pDeviceGL, bool bIsDeferred); + DeviceContextGLImpl(IReferenceCounters* pRefCounters, RenderDeviceGLImpl* pDeviceGL, bool bIsDeferred); /// Queries the specific interface, see IObject::QueryInterface() for details. virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface )override final; diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 2a039c7e..f85bd454 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -333,9 +333,8 @@ namespace Diligent for (Uint32 rt = 0; rt < NumRenderTargets; ++rt) pBoundRTVs[rt] = m_pBoundRenderTargets[rt]; - auto* pRenderDeviceGL = m_pDevice.RawPtr(); auto CurrentNativeGLContext = m_ContextState.GetCurrentGLContext(); - auto& FBOCache = pRenderDeviceGL->GetFBOCache(CurrentNativeGLContext); + auto& FBOCache = m_pDevice->GetFBOCache(CurrentNativeGLContext); const auto& FBO = FBOCache.GetFBO(NumRenderTargets, pBoundRTVs, m_pBoundDepthStencil, m_ContextState); // Even though the write mask only applies to writes to a framebuffer, the mask state is NOT // Framebuffer state. So it is NOT part of a Framebuffer Object or the Default Framebuffer. @@ -612,12 +611,11 @@ namespace Diligent m_pPipelineState->CommitProgram(m_ContextState); - auto* pRenderDeviceGL = m_pDevice.RawPtr(); - auto CurrNativeGLContext = pRenderDeviceGL->m_GLContext.GetCurrentNativeGLContext(); + auto CurrNativeGLContext = m_pDevice->m_GLContext.GetCurrentNativeGLContext(); const auto& PipelineDesc = m_pPipelineState->GetDesc().GraphicsPipeline; if (!m_ContextState.IsValidVAOBound()) { - auto& VAOCache = pRenderDeviceGL->GetVAOCache(CurrNativeGLContext); + auto& VAOCache = m_pDevice->GetVAOCache(CurrNativeGLContext); IBuffer* pIndexBuffer = IsIndexed ? m_pIndexBuffer.RawPtr() : nullptr; if (PipelineDesc.InputLayout.NumElements > 0 || pIndexBuffer != nullptr) { @@ -1028,8 +1026,7 @@ namespace Diligent bool DeviceContextGLImpl::UpdateCurrentGLContext() { - auto* pRenderDeviceGL = m_pDevice.RawPtr(); - auto NativeGLContext = pRenderDeviceGL->m_GLContext.GetCurrentNativeGLContext(); + auto NativeGLContext = m_pDevice->m_GLContext.GetCurrentNativeGLContext(); if (NativeGLContext == NULL) return false; -- cgit v1.2.3