diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-04-17 16:20:09 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-04-17 16:20:09 +0000 |
| commit | eb129d6308eaca88131656fd58124355cb1b391a (patch) | |
| tree | 5335bb16ba10f6aa26d436b6d47318fc5fde9f16 /Graphics/GraphicsEngineOpenGL | |
| parent | Implementing device context in vulkan (diff) | |
| download | DiligentCore-eb129d6308eaca88131656fd58124355cb1b391a.tar.gz DiligentCore-eb129d6308eaca88131656fd58124355cb1b391a.zip | |
Added template version of RawPtr function to allow more convenient type conversion
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
3 files changed, 17 insertions, 17 deletions
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<ISwapChainGL>(m_pSwapChain.RawPtr()); + auto *pSwapChainGL = m_pSwapChain.RawPtr<ISwapChainGL>(); 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<RenderDeviceGLImpl>(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr<RenderDeviceGLImpl>(); 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<RenderDeviceGLImpl>(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr<RenderDeviceGLImpl>(); if (!m_pPipelineState) { LOG_ERROR("No pipeline state is bound"); return; } - auto *pPipelineStateGL = ValidatedCast<PipelineStateGLImpl>(m_pPipelineState.RawPtr()); + auto *pPipelineStateGL = m_pPipelineState.RawPtr<PipelineStateGLImpl>(); auto *pShaderResBindingGL = ValidatedCast<ShaderResourceBindingGLImpl>(pResBinding); const auto &DeviceCaps = pRenderDeviceGL->GetDeviceCaps(); @@ -390,7 +390,7 @@ namespace Diligent auto& Resource = it->pResources[ArrInd]; if (Resource) { - auto *pBufferOGL = ValidatedCast<BufferGLImpl>(Resource.RawPtr()); + auto *pBufferOGL = Resource.RawPtr<BufferGLImpl>(); 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<BufferViewGLImpl>(Resource.RawPtr()); + auto *pBufViewOGL = Resource.RawPtr<BufferViewGLImpl>(); auto *pBuffer = pBufViewOGL->GetBuffer(); m_ContextState.BindTexture( TextureIndex, GL_TEXTURE_BUFFER, pBufViewOGL->GetTexBufferHandle() ); @@ -447,7 +447,7 @@ namespace Diligent } else { - auto *pTexViewOGL = ValidatedCast<TextureViewGLImpl>(Resource.RawPtr()); + auto *pTexViewOGL = Resource.RawPtr<TextureViewGLImpl>(); 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<TextureViewGLImpl>(Resource.RawPtr()); + auto *pTexViewOGL = Resource.RawPtr<TextureViewGLImpl>(); 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<BufferViewGLImpl>(Resource.RawPtr()); + auto *pBufferViewOGL = Resource.RawPtr<BufferViewGLImpl>(); 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<RenderDeviceGLImpl>(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr<RenderDeviceGLImpl>(); 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<RenderDeviceGLImpl>(m_pDevice.RawPtr()); + auto *pRenderDeviceGL = m_pDevice.RawPtr<RenderDeviceGLImpl>(); 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<DeviceContextGLImpl>( spDeviceContext.RawPtr() ); + auto pDeviceContext = spDeviceContext.RawPtr<DeviceContextGLImpl>(); 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<DeviceContextGLImpl>( spDeviceContext.RawPtr() ); + auto pDeviceContext = spDeviceContext.RawPtr<DeviceContextGLImpl>(); 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<DeviceContextGLImpl>( spDeviceContext.RawPtr() ); + auto *pContextGL = spDeviceContext.RawPtr<DeviceContextGLImpl>(); 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<RenderDeviceGLImpl>(m_pRenderDevice.RawPtr()); + auto *pDeviceGL = m_pRenderDevice.RawPtr<RenderDeviceGLImpl>(); 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<RenderDeviceGLImpl>(m_pRenderDevice.RawPtr()); + auto *pDeviceGL = m_pRenderDevice.RawPtr<RenderDeviceGLImpl>(); 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<DeviceContextGLImpl>( pDeviceContext.RawPtr() ); + auto *pImmediateCtxGL = pDeviceContext.RawPtr<DeviceContextGLImpl>(); bool bIsDefaultFBBound = pImmediateCtxGL->IsDefaultFBBound(); // To update the viewport is the only thing we need to do in OpenGL |
