summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsTools
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-25 20:08:42 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-25 20:08:42 +0000
commit3494f0538a108730f9bb25d79416136d2b329af4 (patch)
treec0e82cd48d811954f1cd722f113f8042561b6caf /Graphics/GraphicsTools
parentMoved ITextureView::GenerateMips() to IDeviceContext::GenerateMips() (diff)
downloadDiligentCore-3494f0538a108730f9bb25d79416136d2b329af4.tar.gz
DiligentCore-3494f0538a108730f9bb25d79416136d2b329af4.zip
Renamed/moved IBuffer::Map() to IDeviceContext::MapBuffer()
Renamed/moved IBuffer::Unmap() to IDeviceContext::UnmapBuffer() Closed https://github.com/DiligentGraphics/DiligentCore/issues/30 (Removed map type, map flag parameters from IBuffer::Unmap function)
Diffstat (limited to 'Graphics/GraphicsTools')
-rw-r--r--Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp10
-rw-r--r--Graphics/GraphicsTools/src/TextureUploaderGL.cpp4
2 files changed, 10 insertions, 4 deletions
diff --git a/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp b/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp
index 8d824343..e45dfc0d 100644
--- a/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp
+++ b/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp
@@ -60,7 +60,10 @@ namespace Diligent
~UploadBufferD3D12()
{
- m_pStagingBuffer->Unmap(nullptr, MAP_WRITE, 0);
+ RefCntAutoPtr<IBufferD3D12> pBufferD3D12(m_pStagingBuffer, IID_BufferD3D12);
+ size_t DataStartOffset;
+ auto* pd3d12Buff = pBufferD3D12->GetD3D12Buffer(DataStartOffset, nullptr);
+ pd3d12Buff->Unmap(0, nullptr);
LOG_INFO_MESSAGE("Releasing staging buffer of size ", m_pStagingBuffer->GetDesc().uiSizeInBytes);
}
@@ -237,7 +240,10 @@ namespace Diligent
m_pDevice->CreateBuffer(BuffDesc, BufferData(), &pStagingBuffer);
PVoid CpuVirtualAddress = nullptr;
- pStagingBuffer->Map(nullptr, MAP_WRITE, 0, CpuVirtualAddress);
+ RefCntAutoPtr<IBufferD3D12> pStagingBufferD3D12(pStagingBuffer, IID_BufferD3D12);
+ size_t DataStartOffset;
+ auto* pd3d12Buff = pStagingBufferD3D12->GetD3D12Buffer(DataStartOffset, nullptr);
+ pd3d12Buff->Map(0, nullptr, &CpuVirtualAddress);
if (CpuVirtualAddress == nullptr)
{
LOG_ERROR_MESSAGE("Failed to map upload buffer");
diff --git a/Graphics/GraphicsTools/src/TextureUploaderGL.cpp b/Graphics/GraphicsTools/src/TextureUploaderGL.cpp
index ef0bac67..26476a3c 100644
--- a/Graphics/GraphicsTools/src/TextureUploaderGL.cpp
+++ b/Graphics/GraphicsTools/src/TextureUploaderGL.cpp
@@ -191,7 +191,7 @@ namespace Diligent
}
PVoid CpuAddress = nullptr;
- pBuffer->m_pStagingBuffer->Map(pContext, MAP_WRITE, MAP_FLAG_DISCARD, CpuAddress);
+ pContext->MapBuffer(pBuffer->m_pStagingBuffer, MAP_WRITE, MAP_FLAG_DISCARD, CpuAddress);
pBuffer->SetDataPtr(CpuAddress, RowStride, 0);
pBuffer->SignalMapped();
@@ -200,7 +200,7 @@ namespace Diligent
case InternalData::PendingBufferOperation::Copy:
{
- pBuffer->m_pStagingBuffer->Unmap(pContext, MAP_WRITE, MAP_FLAG_DISCARD);
+ pContext->UnmapBuffer(pBuffer->m_pStagingBuffer);
TextureSubResData SubResData(pBuffer->m_pStagingBuffer, static_cast<Uint32>(pBuffer->GetRowStride()));
Box DstBox;
const auto &TexDesc = OperationInfo.pDstTexture->GetDesc();