summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3DBase
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-03-06 06:05:17 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-03-06 06:05:17 +0000
commit772ef0e6cfbb218814ad4e7d25dd94b697a6b4f3 (patch)
treecc60120d48012dc8cd45e27d5f39931bae751d0b /Graphics/GraphicsEngineD3DBase
parentKeep fixing metal back-end (diff)
downloadDiligentCore-772ef0e6cfbb218814ad4e7d25dd94b697a6b4f3.tar.gz
DiligentCore-772ef0e6cfbb218814ad4e7d25dd94b697a6b4f3.zip
Keep fixing Metal backend + few other minor changes
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/ShaderResources.h3
-rw-r--r--Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp4
2 files changed, 6 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h
index f8f6917b..e12049e4 100644
--- a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h
+++ b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.h
@@ -399,6 +399,9 @@ private:
// Memory buffer that holds all resources as continuous chunk of memory:
// | CBs | TexSRVs | TexUAVs | BufSRVs | BufUAVs | Samplers | Resource Names |
+ // |
+ // end of names data may not be aligned
+
std::unique_ptr< void, STDDeleterRawMem<void> > m_MemoryBuffer;
StringPool m_ResourceNames;
diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp
index a3efe9f3..c52b2cee 100644
--- a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp
+++ b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp
@@ -27,6 +27,7 @@
#include "ShaderResources.h"
#include "HashUtils.h"
#include "ShaderResourceVariableBase.h"
+#include "Align.h"
namespace Diligent
{
@@ -74,7 +75,8 @@ void ShaderResources::AllocateMemory(IMemoryAllocator& Allocator,
m_SamplersOffset = AdvanceOffset(ResCounters.NumSamplers);
m_TotalResources = AdvanceOffset(0);
- auto MemorySize = m_TotalResources * sizeof(D3DShaderResourceAttribs) + ResourceNamesPoolSize * sizeof(char);
+ auto AlignedResourceNamesPoolSize = Align(ResourceNamesPoolSize, sizeof(void*));
+ auto MemorySize = m_TotalResources * sizeof(D3DShaderResourceAttribs) + AlignedResourceNamesPoolSize * sizeof(char);
VERIFY_EXPR(GetNumCBs() == ResCounters.NumCBs);
VERIFY_EXPR(GetNumTexSRV() == ResCounters.NumTexSRVs);