Fix compilation with MSVC 140 tools

This commit is contained in:
Wojtek Figat
2021-08-05 21:01:36 +02:00
parent 1b3c74c3eb
commit 25f48a3469
5 changed files with 36 additions and 46 deletions

View File

@@ -12,9 +12,8 @@ StringView StringBuilder::ToStringView() const
StringView StringView::Empty;
StringView::StringView(const String& str)
: StringViewBase<Char>(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<char>(str.Get(), str.Length())
{
_data = str.Get();
_length = str.Length();
}
bool StringAnsiView::operator==(const StringAnsi& other) const

View File

@@ -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;
}
/// <summary>
/// Lexicographically tests how this string compares to the other given string.
@@ -194,6 +210,7 @@ public:
/// Initializes a new instance of the <see cref="StringView"/> class.
/// </summary>
constexpr StringView()
: StringViewBase<Char>()
{
}
@@ -208,9 +225,8 @@ public:
/// </summary>
/// <param name="str">The reference to the static string.</param>
constexpr StringView(const StringView& str)
: StringViewBase<Char>(str._data, str._length)
{
_data = str._data;
_length = str._length;
}
/// <summary>
@@ -229,9 +245,8 @@ public:
/// <param name="str">The characters sequence.</param>
/// <param name="length">The characters sequence length (excluding null-terminator character).</param>
constexpr StringView(const Char* str, int32 length)
: StringViewBase<Char>(str, length)
{
_data = str;
_length = length;
}
public:
@@ -248,21 +263,6 @@ public:
return *this;
}
/// <summary>
/// Assigns the static string.
/// </summary>
/// <param name="other">The other object.</param>
/// <returns>The reference to this object.</returns>
FORCE_INLINE constexpr StringView& operator=(const StringView& other)
{
if (this != &other)
{
_data = other._data;
_length = other._length;
}
return *this;
}
/// <summary>
/// Lexicographically test whether this string is equivalent to the other given string (case sensitive).
/// </summary>
@@ -399,6 +399,7 @@ public:
/// Initializes a new instance of the <see cref="StringView"/> class.
/// </summary>
constexpr StringAnsiView()
: StringViewBase<char>()
{
}
@@ -413,9 +414,8 @@ public:
/// </summary>
/// <param name="str">The reference to the static string.</param>
constexpr StringAnsiView(const StringAnsiView& str)
: StringViewBase<char>(str._data, str._length)
{
_data = str._data;
_length = str._length;
}
/// <summary>
@@ -434,9 +434,8 @@ public:
/// <param name="str">The characters sequence.</param>
/// <param name="length">The characters sequence length (excluding null-terminator character).</param>
constexpr StringAnsiView(const char* str, int32 length)
: StringViewBase<char>(str, length)
{
_data = str;
_length = length;
}
public:
@@ -453,21 +452,6 @@ public:
return *this;
}
/// <summary>
/// Assigns the static string.
/// </summary>
/// <param name="other">The other object.</param>
/// <returns>The reference to this object.</returns>
FORCE_INLINE constexpr StringAnsiView& operator=(const StringAnsiView& other)
{
if (this != &other)
{
_data = other._data;
_length = other._length;
}
return *this;
}
/// <summary>
/// Lexicographically test whether this string is equivalent to the other given string (case sensitive).
/// </summary>

View File

@@ -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);

View File

@@ -18,7 +18,11 @@
#include "../rapidjson.h"
#if defined(_MSC_VER) && defined(_M_AMD64)
#include <intrin0.h> // for _umul128
#if _MSC_VER <= 1900
#include <intrin.h>
#else
#include <intrin0.h>
#endif
#pragma intrinsic(_umul128)
#endif

View File

@@ -22,7 +22,11 @@
#include "../rapidjson.h"
#if defined(_MSC_VER) && defined(_M_AMD64)
#if _MSC_VER <= 1900
#include <intrin.h>
#else
#include <intrin0.h>
#endif
#pragma intrinsic(_BitScanReverse64)
#pragma intrinsic(_umul128)
#endif