From 19b00dc26c163c97d10e9869f66e12014a6353ca Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 23 Dec 2020 18:32:05 -0800 Subject: Some more updates to D3D12 PSO and ShaderResourceLayoutVk --- Common/interface/DynamicLinearAllocator.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Common/interface') 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(len + 1); + if (len == 0) + len = strlen(Str); + else + VERIFY_EXPR(len <= strlen(Str)); + + auto* Dst = Allocate(len + 1); for (size_t i = 0; i < len; ++i) { Dst[i] = static_cast(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 { -- cgit v1.2.3