summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-09-02 19:03:43 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-09-02 19:03:43 +0000
commite9963a8d675a251b8d28d3da2a5678f217709782 (patch)
tree3a77ffbbbc799ff99342cbe014fe0ba5f2ca4787 /Graphics/GraphicsEngineD3D12
parentFixed build error (diff)
downloadDiligentCore-e9963a8d675a251b8d28d3da2a5678f217709782.tar.gz
DiligentCore-e9963a8d675a251b8d28d3da2a5678f217709782.zip
Implemented texture mapping in Vulkan (fixed https://github.com/DiligentGraphics/DiligentCore/issues/28)
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h8
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp9
2 files changed, 8 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h
index bfde19bb..ea70fc8a 100644
--- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h
@@ -212,25 +212,25 @@ private:
std::vector<std::pair<Uint64, RefCntAutoPtr<IFence> > > m_PendingFences;
- struct TextureUploadAllocationKey
+ struct MappedTextureKey
{
TextureD3D12Impl* const Texture;
UINT const Subresource;
- bool operator == (const TextureUploadAllocationKey& rhs)const
+ bool operator == (const MappedTextureKey& rhs)const
{
return Texture == rhs.Texture &&
Subresource == rhs.Subresource;
}
struct Hasher
{
- size_t operator()(const TextureUploadAllocationKey& Key)const
+ size_t operator()(const MappedTextureKey& Key)const
{
return ComputeHash(Key.Texture, Key.Subresource);
}
};
};
- std::unordered_map<TextureUploadAllocationKey, TextureUploadSpace, TextureUploadAllocationKey::Hasher> m_TextureUploadAllocations;
+ std::unordered_map<MappedTextureKey, TextureUploadSpace, MappedTextureKey::Hasher> m_MappedTextures;
};
}
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index 52898a5d..1f7ab435 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -933,13 +933,12 @@ namespace Diligent
{
const auto& TexDesc = TextureD3D12.GetDesc();
auto UploadSpace = AllocateTextureUploadSpace(TexDesc.Format, MapRegion);
- const auto AlignedOffset = (UploadSpace.Allocation.Offset + (D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT-1)) & ~(D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT-1);
MappedData.pData = reinterpret_cast<Uint8*>(UploadSpace.Allocation.CPUAddress) + (UploadSpace.AlignedOffset - UploadSpace.Allocation.Offset);
MappedData.Stride = UploadSpace.Stride;
MappedData.DepthStride = UploadSpace.DepthStride;
auto Subres = D3D12CalcSubresource(MipLevel, ArraySlice, 0, TexDesc.MipLevels, TexDesc.ArraySize);
- auto it = m_TextureUploadAllocations.emplace(TextureUploadAllocationKey{&TextureD3D12, Subres}, std::move(UploadSpace));
+ auto it = m_MappedTextures.emplace(MappedTextureKey{&TextureD3D12, Subres}, std::move(UploadSpace));
if(!it.second)
LOG_ERROR_MESSAGE("Mip level ", MipLevel, ", slice ", ArraySlice, " of texture '", TexDesc.Name, "' has already been mapped");
}
@@ -950,8 +949,8 @@ namespace Diligent
{
const auto& TexDesc = TextureD3D12.GetDesc();
auto Subres = D3D12CalcSubresource(MipLevel, ArraySlice, 0, TexDesc.MipLevels, TexDesc.ArraySize);
- auto UploadSpaceIt = m_TextureUploadAllocations.find(TextureUploadAllocationKey{&TextureD3D12, Subres});
- if(UploadSpaceIt != m_TextureUploadAllocations.end())
+ auto UploadSpaceIt = m_MappedTextures.find(MappedTextureKey{&TextureD3D12, Subres});
+ if(UploadSpaceIt != m_MappedTextures.end())
{
auto& UploadSpace = UploadSpaceIt->second;
CopyTextureRegion(UploadSpace.Allocation.pBuffer,
@@ -962,7 +961,7 @@ namespace Diligent
TextureD3D12,
Subres,
UploadSpace.Region);
- m_TextureUploadAllocations.erase(UploadSpaceIt);
+ m_MappedTextures.erase(UploadSpaceIt);
}
else
{