summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-24 22:11:02 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-24 22:11:02 +0000
commit61bfee05db60a67fb8be6e72b27ba6724f0dd277 (patch)
treeb4595056fc881ccbca6fd50c7163d4df1cf54f19 /Graphics/GraphicsEngineOpenGL
parentUpdated debug message about required shader resource binding object (diff)
downloadDiligentCore-61bfee05db60a67fb8be6e72b27ba6724f0dd277.tar.gz
DiligentCore-61bfee05db60a67fb8be6e72b27ba6724f0dd277.zip
Moved/renamed `IBuffer::UpdateData()` to `IDeviceContext::UpdateBuffer()`
Moved/renamed `IBuffer::CopyData()` to `IDeviceContext::CopyBuffer()`
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h5
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h4
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp22
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp17
4 files changed, 31 insertions, 17 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h
index 1d990493..9609eadc 100644
--- a/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h
+++ b/Graphics/GraphicsEngineOpenGL/include/BufferGLImpl.h
@@ -30,6 +30,7 @@
#include "BaseInterfacesGL.h"
#include "BufferViewGLImpl.h"
#include "RenderDeviceGLImpl.h"
+#include "GLContextState.h"
namespace Diligent
{
@@ -59,8 +60,8 @@ public:
/// Queries the specific interface, see IObject::QueryInterface() for details
virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override;
- virtual void UpdateData(IDeviceContext *pContext, Uint32 Offset, Uint32 Size, const PVoid pData)override;
- virtual void CopyData( IDeviceContext *pContext, IBuffer *pSrcBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size )override;
+ void UpdateData(GLContextState& CtxState, Uint32 Offset, Uint32 Size, const PVoid pData);
+ void CopyData(GLContextState& CtxState, BufferGLImpl& SrcBufferGL, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size);
virtual void Map( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData )override;
virtual void Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags )override;
diff --git a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h
index 6727bfb2..c88e8410 100644
--- a/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h
+++ b/Graphics/GraphicsEngineOpenGL/include/DeviceContextGLImpl.h
@@ -78,6 +78,10 @@ public:
virtual void Flush()override final;
+ virtual void UpdateBuffer(IBuffer *pBuffer, Uint32 Offset, Uint32 Size, const PVoid pData)override final;
+
+ virtual void CopyBuffer(IBuffer *pSrcBuffer, IBuffer *pDstBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size)override final;
+
virtual void FinishFrame()override final;
virtual void TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)override final;
diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
index ff2d46de..ed9cfed5 100644
--- a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
@@ -184,18 +184,14 @@ BufferGLImpl::~BufferGLImpl()
IMPLEMENT_QUERY_INTERFACE( BufferGLImpl, IID_BufferGL, TBufferBase )
-void BufferGLImpl :: UpdateData(IDeviceContext *pContext, Uint32 Offset, Uint32 Size, const PVoid pData)
+void BufferGLImpl :: UpdateData(GLContextState& CtxState, Uint32 Offset, Uint32 Size, const PVoid pData)
{
- TBufferBase::UpdateData( pContext, Offset, Size, pData );
-
- auto *pDeviceContextGL = ValidatedCast<DeviceContextGLImpl>(pContext);
-
BufferMemoryBarrier(
GL_BUFFER_UPDATE_BARRIER_BIT,// Reads or writes to buffer objects via any OpenGL API functions that allow
// modifying their contents will reflect data written by shaders prior to the barrier.
// Additionally, writes via these commands issued after the barrier will wait on
// the completion of any shader writes to the same memory initiated prior to the barrier.
- pDeviceContextGL->GetContextState());
+ CtxState);
glBindBuffer(GL_ARRAY_BUFFER, m_GlBuffer);
// All buffer bind targets (GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER etc.) relate to the same
@@ -206,21 +202,17 @@ void BufferGLImpl :: UpdateData(IDeviceContext *pContext, Uint32 Offset, Uint32
}
-void BufferGLImpl :: CopyData(IDeviceContext *pContext, IBuffer *pSrcBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size)
+void BufferGLImpl :: CopyData(GLContextState& CtxState, BufferGLImpl& SrcBufferGL, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size)
{
- TBufferBase::CopyData( pContext, pSrcBuffer, SrcOffset, DstOffset, Size );
-
- auto *pDeviceContextGL = ValidatedCast<DeviceContextGLImpl>(pContext);
- auto *pSrcBufferGL = static_cast<BufferGLImpl*>( pSrcBuffer );
BufferMemoryBarrier(
GL_BUFFER_UPDATE_BARRIER_BIT,// Reads or writes to buffer objects via any OpenGL API functions that allow
// modifying their contents will reflect data written by shaders prior to the barrier.
// Additionally, writes via these commands issued after the barrier will wait on
// the completion of any shader writes to the same memory initiated prior to the barrier.
- pDeviceContextGL->GetContextState());
- pSrcBufferGL->BufferMemoryBarrier(
+ CtxState);
+ SrcBufferGL.BufferMemoryBarrier(
GL_BUFFER_UPDATE_BARRIER_BIT,
- pDeviceContextGL->GetContextState() );
+ CtxState);
// Whilst glCopyBufferSubData() can be used to copy data between buffers bound to any two targets,
// the targets GL_COPY_READ_BUFFER and GL_COPY_WRITE_BUFFER are provided specifically for this purpose.
@@ -228,7 +220,7 @@ void BufferGLImpl :: CopyData(IDeviceContext *pContext, IBuffer *pSrcBuffer, Uin
// the purposes of copying or staging data without disturbing OpenGL state or needing to keep track of
// what was bound to the target before your copy.
glBindBuffer(GL_COPY_WRITE_BUFFER, m_GlBuffer);
- glBindBuffer(GL_COPY_READ_BUFFER, pSrcBufferGL->m_GlBuffer);
+ glBindBuffer(GL_COPY_READ_BUFFER, SrcBufferGL.m_GlBuffer);
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, SrcOffset, DstOffset, Size);
CHECK_GL_ERROR("glCopyBufferSubData() failed");
glBindBuffer(GL_COPY_READ_BUFFER, 0);
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
index 946f8ee9..57c684ff 100644
--- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
@@ -1011,6 +1011,23 @@ namespace Diligent
return true;
}
+ void DeviceContextGLImpl::UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, const PVoid pData)
+ {
+ TDeviceContextBase::UpdateBuffer(pBuffer, Offset, Size, pData);
+
+ auto* pBufferGL = ValidatedCast<BufferGLImpl>(pBuffer);
+ pBufferGL->UpdateData(m_ContextState, Offset, Size, pData);
+ }
+
+ void DeviceContextGLImpl::CopyBuffer(IBuffer *pSrcBuffer, IBuffer *pDstBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size)
+ {
+ TDeviceContextBase::CopyBuffer(pSrcBuffer, pDstBuffer, SrcOffset, DstOffset, Size);
+
+ auto* pSrcBufferGL = ValidatedCast<BufferGLImpl>(pSrcBuffer);
+ auto* pDstBufferGL = ValidatedCast<BufferGLImpl>(pDstBuffer);
+ pDstBufferGL->CopyData(m_ContextState, *pSrcBufferGL, SrcOffset, DstOffset, Size);
+ }
+
void DeviceContextGLImpl::TransitionResourceStates(Uint32 BarrierCount, StateTransitionDesc* pResourceBarriers)
{