diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-06-19 15:52:15 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-06-19 15:52:15 +0000 |
| commit | f345a63c047c7760cb5c5fe70f72a075b4f3a7df (patch) | |
| tree | 95d9ec41ff14a8b52326e9f80c807365b767c05a /Common/interface | |
| parent | Cleaned D3D Shader Resource implementation (diff) | |
| download | DiligentCore-f345a63c047c7760cb5c5fe70f72a075b4f3a7df.tar.gz DiligentCore-f345a63c047c7760cb5c5fe70f72a075b4f3a7df.zip | |
Implemented resource names string pool for D3D backends
Diffstat (limited to 'Common/interface')
| -rw-r--r-- | Common/interface/StringPool.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Common/interface/StringPool.h b/Common/interface/StringPool.h index b1040989..3844c146 100644 --- a/Common/interface/StringPool.h +++ b/Common/interface/StringPool.h @@ -91,6 +91,21 @@ public: return str; } + Char* CopyString(const char* Str) + { + auto* Ptr = m_pCurrPtr; + while(*Str != 0 && m_pCurrPtr < m_pBuffer + m_ReservedSize) + { + *(m_pCurrPtr++) = *(Str++); + } + if(m_pCurrPtr < m_pBuffer + m_ReservedSize) + *(m_pCurrPtr++) = 0; + else + UNEXPECTED("Not enough space reserved in the string pool"); + return Ptr; + } + + size_t GetRemainingSize()const { VERIFY(m_pCurrPtr <= m_pBuffer + m_ReservedSize, "Buffer overflow"); @@ -103,7 +118,7 @@ public: } private: - Char* m_pBuffer = nullptr; + Char* m_pBuffer = nullptr; Char* m_pCurrPtr = nullptr; size_t m_ReservedSize = 0; IMemoryAllocator* m_pAllocator = nullptr; |
