diff --git a/Source/Engine/Core/Types/StringView.cpp b/Source/Engine/Core/Types/StringView.cpp index 8b30cc755..606e37ad1 100644 --- a/Source/Engine/Core/Types/StringView.cpp +++ b/Source/Engine/Core/Types/StringView.cpp @@ -12,9 +12,8 @@ StringView StringBuilder::ToStringView() const StringView StringView::Empty; StringView::StringView(const String& str) + : StringViewBase(str.Get(), str.Length()) { - _data = str.Get(); - _length = str.Length(); } bool StringView::operator==(const String& other) const @@ -74,9 +73,8 @@ bool operator!=(const String& a, const StringView& b) StringAnsiView StringAnsiView::Empty; StringAnsiView::StringAnsiView(const StringAnsi& str) + : StringViewBase(str.Get(), str.Length()) { - _data = str.Get(); - _length = str.Length(); } bool StringAnsiView::operator==(const StringAnsi& other) const diff --git a/Source/Engine/Core/Types/StringView.h b/Source/Engine/Core/Types/StringView.h index b630c429c..0ed2580ce 100644 --- a/Source/Engine/Core/Types/StringView.h +++ b/Source/Engine/Core/Types/StringView.h @@ -18,9 +18,15 @@ protected: int32 _length; constexpr StringViewBase() + : _data(nullptr) + , _length(0) + { + } + + constexpr StringViewBase(const T* data, int32 length) + : _data(data) + , _length(length) { - _data = nullptr; - _length = 0; } public: @@ -35,6 +41,16 @@ public: ASSERT(index >= 0 && index <= _length); return _data[index]; } + + FORCE_INLINE StringViewBase& operator=(const StringViewBase& other) + { + if (this != &other) + { + _data = other._data; + _length = other._length; + } + return *this; + } /// /// Lexicographically tests how this string compares to the other given string. @@ -194,6 +210,7 @@ public: /// Initializes a new instance of the class. /// constexpr StringView() + : StringViewBase() { } @@ -208,9 +225,8 @@ public: /// /// The reference to the static string. constexpr StringView(const StringView& str) + : StringViewBase(str._data, str._length) { - _data = str._data; - _length = str._length; } /// @@ -229,9 +245,8 @@ public: /// The characters sequence. /// The characters sequence length (excluding null-terminator character). constexpr StringView(const Char* str, int32 length) + : StringViewBase(str, length) { - _data = str; - _length = length; } public: @@ -248,21 +263,6 @@ public: return *this; } - /// - /// Assigns the static string. - /// - /// The other object. - /// The reference to this object. - FORCE_INLINE constexpr StringView& operator=(const StringView& other) - { - if (this != &other) - { - _data = other._data; - _length = other._length; - } - return *this; - } - /// /// Lexicographically test whether this string is equivalent to the other given string (case sensitive). /// @@ -399,6 +399,7 @@ public: /// Initializes a new instance of the class. /// constexpr StringAnsiView() + : StringViewBase() { } @@ -413,9 +414,8 @@ public: /// /// The reference to the static string. constexpr StringAnsiView(const StringAnsiView& str) + : StringViewBase(str._data, str._length) { - _data = str._data; - _length = str._length; } /// @@ -434,9 +434,8 @@ public: /// The characters sequence. /// The characters sequence length (excluding null-terminator character). constexpr StringAnsiView(const char* str, int32 length) + : StringViewBase(str, length) { - _data = str; - _length = length; } public: @@ -453,21 +452,6 @@ public: return *this; } - /// - /// Assigns the static string. - /// - /// The other object. - /// The reference to this object. - FORCE_INLINE constexpr StringAnsiView& operator=(const StringAnsiView& other) - { - if (this != &other) - { - _data = other._data; - _length = other._length; - } - return *this; - } - /// /// Lexicographically test whether this string is equivalent to the other given string (case sensitive). /// diff --git a/Source/Engine/Renderer/LightPass.cpp b/Source/Engine/Renderer/LightPass.cpp index b44f3f452..08dff52a0 100644 --- a/Source/Engine/Renderer/LightPass.cpp +++ b/Source/Engine/Renderer/LightPass.cpp @@ -206,7 +206,7 @@ void LightPass::RenderLight(RenderContext& renderContext, GPUTextureView* lightB // Bind output GPUTexture* depthBuffer = renderContext.Buffers->DepthBuffer; - const bool depthBufferReadOnly = depthBuffer->GetDescription().Flags & GPUTextureFlags::ReadOnlyDepthView; + const bool depthBufferReadOnly = (depthBuffer->GetDescription().Flags & GPUTextureFlags::ReadOnlyDepthView) != 0; GPUTextureView* depthBufferRTV = depthBufferReadOnly ? depthBuffer->ViewReadOnlyDepth() : nullptr; GPUTextureView* depthBufferSRV = depthBufferReadOnly ? depthBuffer->ViewReadOnlyDepth() : depthBuffer->View(); context->SetRenderTarget(depthBufferRTV, lightBuffer); diff --git a/Source/ThirdParty/rapidjson/internal/biginteger.h b/Source/ThirdParty/rapidjson/internal/biginteger.h index 5e7e61688..75209d422 100644 --- a/Source/ThirdParty/rapidjson/internal/biginteger.h +++ b/Source/ThirdParty/rapidjson/internal/biginteger.h @@ -18,7 +18,11 @@ #include "../rapidjson.h" #if defined(_MSC_VER) && defined(_M_AMD64) -#include // for _umul128 +#if _MSC_VER <= 1900 +#include +#else +#include +#endif #pragma intrinsic(_umul128) #endif diff --git a/Source/ThirdParty/rapidjson/internal/diyfp.h b/Source/ThirdParty/rapidjson/internal/diyfp.h index 617b07968..1530c22e0 100644 --- a/Source/ThirdParty/rapidjson/internal/diyfp.h +++ b/Source/ThirdParty/rapidjson/internal/diyfp.h @@ -22,7 +22,11 @@ #include "../rapidjson.h" #if defined(_MSC_VER) && defined(_M_AMD64) +#if _MSC_VER <= 1900 +#include +#else #include +#endif #pragma intrinsic(_BitScanReverse64) #pragma intrinsic(_umul128) #endif