From eb129d6308eaca88131656fd58124355cb1b391a Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 17 Apr 2018 09:20:09 -0700 Subject: Added template version of RawPtr function to allow more convenient type conversion --- .../src/DeviceContextGLImpl.cpp | 22 +++++++++++----------- .../src/RenderDeviceGLImpl.cpp | 6 +++--- .../GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'Graphics/GraphicsEngineOpenGL') diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index a771318d..41592b37 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -286,7 +286,7 @@ namespace Diligent { if (m_IsDefaultFramebufferBound) { - auto *pSwapChainGL = ValidatedCast(m_pSwapChain.RawPtr()); + auto *pSwapChainGL = m_pSwapChain.RawPtr(); GLuint DefaultFBOHandle = pSwapChainGL->GetDefaultFBO(); if (m_DefaultFBO != DefaultFBOHandle) { @@ -310,7 +310,7 @@ namespace Diligent for (Uint32 rt = 0; rt < NumRenderTargets; ++rt) pBoundRTVs[rt] = m_pBoundRenderTargets[rt]; - auto *pRenderDeviceGL = ValidatedCast(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr(); auto CurrentNativeGLContext = m_ContextState.GetCurrentGLContext(); auto &FBOCache = pRenderDeviceGL->GetFBOCache(CurrentNativeGLContext); const auto& FBO = FBOCache.GetFBO(NumRenderTargets, pBoundRTVs, m_pBoundDepthStencil, m_ContextState); @@ -331,13 +331,13 @@ namespace Diligent void DeviceContextGLImpl::BindProgramResources( Uint32 &NewMemoryBarriers, IShaderResourceBinding *pResBinding ) { - auto *pRenderDeviceGL = ValidatedCast(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr(); if (!m_pPipelineState) { LOG_ERROR("No pipeline state is bound"); return; } - auto *pPipelineStateGL = ValidatedCast(m_pPipelineState.RawPtr()); + auto *pPipelineStateGL = m_pPipelineState.RawPtr(); auto *pShaderResBindingGL = ValidatedCast(pResBinding); const auto &DeviceCaps = pRenderDeviceGL->GetDeviceCaps(); @@ -390,7 +390,7 @@ namespace Diligent auto& Resource = it->pResources[ArrInd]; if (Resource) { - auto *pBufferOGL = ValidatedCast(Resource.RawPtr()); + auto *pBufferOGL = Resource.RawPtr(); pBufferOGL->BufferMemoryBarrier( GL_UNIFORM_BARRIER_BIT,// Shader uniforms sourced from buffer objects after the barrier // will reflect data written by shaders prior to the barrier @@ -432,7 +432,7 @@ namespace Diligent it->Type == GL_INT_SAMPLER_BUFFER || it->Type == GL_UNSIGNED_INT_SAMPLER_BUFFER ) { - auto *pBufViewOGL = ValidatedCast(Resource.RawPtr()); + auto *pBufViewOGL = Resource.RawPtr(); auto *pBuffer = pBufViewOGL->GetBuffer(); m_ContextState.BindTexture( TextureIndex, GL_TEXTURE_BUFFER, pBufViewOGL->GetTexBufferHandle() ); @@ -447,7 +447,7 @@ namespace Diligent } else { - auto *pTexViewOGL = ValidatedCast(Resource.RawPtr()); + auto *pTexViewOGL = Resource.RawPtr(); m_ContextState.BindTexture( TextureIndex, pTexViewOGL->GetBindTarget(), pTexViewOGL->GetHandle() ); auto *pTexture = pTexViewOGL->GetTexture(); @@ -507,7 +507,7 @@ namespace Diligent auto &Resource = it->pResources[ArrInd]; if( Resource ) { - auto *pTexViewOGL = ValidatedCast(Resource.RawPtr()); + auto *pTexViewOGL = Resource.RawPtr(); const auto &ViewDesc = pTexViewOGL->GetDesc(); if( ViewDesc.AccessFlags & UAV_ACCESS_FLAG_WRITE ) @@ -574,7 +574,7 @@ namespace Diligent auto &Resource = it->pResources[ArrInd]; if( Resource ) { - auto *pBufferViewOGL = ValidatedCast(Resource.RawPtr()); + auto *pBufferViewOGL = Resource.RawPtr(); const auto &ViewDesc = pBufferViewOGL->GetDesc(); VERIFY( ViewDesc.ViewType == BUFFER_VIEW_UNORDERED_ACCESS || ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE, "Unexpceted buffer view type" ); @@ -661,7 +661,7 @@ namespace Diligent return; } - auto *pRenderDeviceGL = ValidatedCast(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr(); auto CurrNativeGLContext = pRenderDeviceGL->m_GLContext.GetCurrentNativeGLContext(); const auto& PipelineDesc = m_pPipelineState->GetDesc().GraphicsPipeline; if(!m_bVAOIsUpToDate) @@ -983,7 +983,7 @@ namespace Diligent bool DeviceContextGLImpl::UpdateCurrentGLContext() { - auto *pRenderDeviceGL = ValidatedCast(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr(); auto NativeGLContext = pRenderDeviceGL->m_GLContext.GetCurrentNativeGLContext(); if (NativeGLContext == NULL) return false; diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp index 12f40f1a..b62c1288 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp @@ -147,7 +147,7 @@ void RenderDeviceGLImpl :: CreateTexture(const TextureDesc& TexDesc, const Textu { auto spDeviceContext = GetImmediateContext(); VERIFY(spDeviceContext, "Immediate device context has been destroyed"); - auto pDeviceContext = ValidatedCast( spDeviceContext.RawPtr() ); + auto pDeviceContext = spDeviceContext.RawPtr(); const auto &FmtInfo = GetTextureFormatInfo( TexDesc.Format ); if( !FmtInfo.Supported ) { @@ -215,7 +215,7 @@ void RenderDeviceGLImpl::CreateTextureFromGLHandle(Uint32 GLHandle, const Textur { auto spDeviceContext = GetImmediateContext(); VERIFY(spDeviceContext, "Immediate device context has been destroyed"); - auto pDeviceContext = ValidatedCast( spDeviceContext.RawPtr() ); + auto pDeviceContext = spDeviceContext.RawPtr(); TextureBaseGL *pTextureOGL = nullptr; switch(TexDesc.Type) { @@ -514,7 +514,7 @@ void RenderDeviceGLImpl::TestTextureFormat( TEXTURE_FORMAT TexFormat ) auto spDeviceContext = GetImmediateContext(); VERIFY(spDeviceContext, "Immediate device context has been destroyed"); - auto *pContextGL = ValidatedCast( spDeviceContext.RawPtr() ); + auto *pContextGL = spDeviceContext.RawPtr(); auto &ContextState = pContextGL->GetContextState(); const int TestTextureDim = 32; diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp index bebaacb3..3456d7bf 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp @@ -72,7 +72,7 @@ IMPLEMENT_QUERY_INTERFACE( SwapChainGLImpl, IID_SwapChainGL, TSwapChainBase ) void SwapChainGLImpl::Present(Uint32 SyncInterval) { #if PLATFORM_WIN32 || PLATFORM_LINUX || PLATFORM_ANDROID - auto *pDeviceGL = ValidatedCast(m_pRenderDevice.RawPtr()); + auto *pDeviceGL = m_pRenderDevice.RawPtr(); auto &GLContext = pDeviceGL->m_GLContext; GLContext.SwapBuffers(); #elif PLATFORM_MACOS @@ -85,7 +85,7 @@ void SwapChainGLImpl::Present(Uint32 SyncInterval) void SwapChainGLImpl::Resize( Uint32 NewWidth, Uint32 NewHeight ) { #if PLATFORM_ANDROID - auto *pDeviceGL = ValidatedCast(m_pRenderDevice.RawPtr()); + auto *pDeviceGL = m_pRenderDevice.RawPtr(); auto &GLContext = pDeviceGL->m_GLContext; GLContext.UpdateScreenSize(); NewWidth = GLContext.GetScreenWidth(); @@ -98,7 +98,7 @@ void SwapChainGLImpl::Resize( Uint32 NewWidth, Uint32 NewHeight ) VERIFY( pDeviceContext, "Immediate context has been released" ); if( pDeviceContext ) { - auto *pImmediateCtxGL = ValidatedCast( pDeviceContext.RawPtr() ); + auto *pImmediateCtxGL = pDeviceContext.RawPtr(); bool bIsDefaultFBBound = pImmediateCtxGL->IsDefaultFBBound(); // To update the viewport is the only thing we need to do in OpenGL -- cgit v1.2.3