-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mostly based on PCSX2.
- Loading branch information
Showing
12 changed files
with
4,779 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com> | ||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) | ||
|
||
#pragma once | ||
|
||
#include "common/intrin.h" | ||
|
||
#include <cstring> | ||
|
||
enum Align_Mode | ||
{ | ||
Align_Outside, | ||
Align_Inside, | ||
Align_NegInf, | ||
Align_PosInf | ||
}; | ||
|
||
enum Round_Mode | ||
{ | ||
Round_NearestInt = 8, | ||
Round_NegInf = 9, | ||
Round_PosInf = 10, | ||
Round_Truncate = 11 | ||
}; | ||
|
||
template<class T> | ||
class GSVector2T | ||
{ | ||
public: | ||
union | ||
{ | ||
struct | ||
{ | ||
T x, y; | ||
}; | ||
struct | ||
{ | ||
T r, g; | ||
}; | ||
struct | ||
{ | ||
T v[2]; | ||
}; | ||
}; | ||
|
||
GSVector2T() = default; | ||
|
||
ALWAYS_INLINE constexpr GSVector2T(T x) : x(x), y(x) {} | ||
ALWAYS_INLINE constexpr GSVector2T(T x, T y) : x(x), y(y) {} | ||
ALWAYS_INLINE constexpr bool operator==(const GSVector2T& v) const { return std::memcmp(this, &v, sizeof(*this)) == 0; } | ||
ALWAYS_INLINE constexpr bool operator!=(const GSVector2T& v) const { return std::memcmp(this, &v, sizeof(*this)) != 0; } | ||
ALWAYS_INLINE constexpr GSVector2T operator*(const GSVector2T& v) const { return {x * v.x, y * v.y}; } | ||
ALWAYS_INLINE constexpr GSVector2T operator/(const GSVector2T& v) const { return {x / v.x, y / v.y}; } | ||
}; | ||
|
||
using GSVector2 = GSVector2T<float>; | ||
using GSVector2i = GSVector2T<s32>; | ||
|
||
#if defined(CPU_ARCH_SSE) | ||
#include "common/gsvector_sse.h" | ||
#elif defined(CPU_ARCH_NEON) | ||
#include "common/gsvector_neon.h" | ||
#else | ||
#include "common/gsvector_nosimd.h" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> | ||
<Type Name="GSVector2T<*>"> | ||
<DisplayString>{{ {x}, {y} }}</DisplayString> | ||
</Type> | ||
|
||
<Type Name="GSVector4i"> | ||
<DisplayString>{{ {I32[0]}, {I32[1]}, {I32[2]}, {I32[3]} }}</DisplayString> | ||
</Type> | ||
</AutoVisualizer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-FileCopyrightText: 2024 Connor McLaughlin <stenzek@gmail.com> | ||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) | ||
|
||
#pragma once | ||
|
||
#include "gsvector.h" | ||
#include "small_string.h" | ||
|
||
#include "fmt/format.h" | ||
|
||
template<> | ||
struct fmt::formatter<GSVector4i> : formatter<std::string_view> | ||
{ | ||
auto format(const GSVector4i& rc, format_context& ctx) const | ||
{ | ||
const TinyString str = | ||
TinyString::from_format("{},{} => {},{} ({}x{})", rc.left, rc.top, rc.right, rc.bottom, rc.width(), rc.height()); | ||
|
||
return fmt::formatter<std::string_view>::format(str.view(), ctx); | ||
} | ||
}; |
Oops, something went wrong.