diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-12-24 02:32:05 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-12-24 02:32:05 +0000 |
| commit | 19b00dc26c163c97d10e9869f66e12014a6353ca (patch) | |
| tree | 4e9bf21c1122959772b96620a56acdc925aebda4 /Common/interface | |
| parent | ShaderResourceLayoutVk: added a few extra debug check in InitializeStaticReso... (diff) | |
| download | DiligentCore-19b00dc26c163c97d10e9869f66e12014a6353ca.tar.gz DiligentCore-19b00dc26c163c97d10e9869f66e12014a6353ca.zip | |
Some more updates to D3D12 PSO and ShaderResourceLayoutVk
Diffstat (limited to 'Common/interface')
| -rw-r--r-- | Common/interface/DynamicLinearAllocator.hpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Common/interface/DynamicLinearAllocator.hpp b/Common/interface/DynamicLinearAllocator.hpp index f57eaf10..f545cd2a 100644 --- a/Common/interface/DynamicLinearAllocator.hpp +++ b/Common/interface/DynamicLinearAllocator.hpp @@ -163,13 +163,17 @@ public: return Dst; } - NODISCARD wchar_t* CopyWString(const char* Str) + NODISCARD wchar_t* CopyWString(const char* Str, size_t len = 0) { if (Str == nullptr) return nullptr; - size_t len = strlen(Str); - auto* Dst = Allocate<wchar_t>(len + 1); + if (len == 0) + len = strlen(Str); + else + VERIFY_EXPR(len <= strlen(Str)); + + auto* Dst = Allocate<wchar_t>(len + 1); for (size_t i = 0; i < len; ++i) { Dst[i] = static_cast<wchar_t>(Str[i]); @@ -183,6 +187,11 @@ public: return CopyString(Str.c_str(), Str.length()); } + NODISCARD wchar_t* CopyWString(const String& Str) + { + return CopyWString(Str.c_str(), Str.length()); + } + private: struct Block { |
