diff options
Diffstat (limited to 'src')
29 files changed, 95 insertions, 95 deletions
diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp index 454de798b..c5a0d98ce 100644 --- a/src/audio_core/codec.cpp +++ b/src/audio_core/codec.cpp | |||
| @@ -68,8 +68,8 @@ std::vector<s16> DecodeADPCM(const u8* const data, std::size_t size, const ADPCM | |||
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | state.yn1 = yn1; | 71 | state.yn1 = static_cast<s16>(yn1); |
| 72 | state.yn2 = yn2; | 72 | state.yn2 = static_cast<s16>(yn2); |
| 73 | 73 | ||
| 74 | return ret; | 74 | return ret; |
| 75 | } | 75 | } |
diff --git a/src/audio_core/cubeb_sink.cpp b/src/audio_core/cubeb_sink.cpp index 097328901..dc45dedd3 100644 --- a/src/audio_core/cubeb_sink.cpp +++ b/src/audio_core/cubeb_sink.cpp | |||
| @@ -46,7 +46,7 @@ public: | |||
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | ~CubebSinkStream() { | 49 | ~CubebSinkStream() override { |
| 50 | if (!ctx) { | 50 | if (!ctx) { |
| 51 | return; | 51 | return; |
| 52 | } | 52 | } |
| @@ -75,11 +75,11 @@ public: | |||
| 75 | queue.Push(samples); | 75 | queue.Push(samples); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | std::size_t SamplesInQueue(u32 num_channels) const override { | 78 | std::size_t SamplesInQueue(u32 channel_count) const override { |
| 79 | if (!ctx) | 79 | if (!ctx) |
| 80 | return 0; | 80 | return 0; |
| 81 | 81 | ||
| 82 | return queue.Size() / num_channels; | 82 | return queue.Size() / channel_count; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | void Flush() override { | 85 | void Flush() override { |
| @@ -98,7 +98,7 @@ private: | |||
| 98 | u32 num_channels{}; | 98 | u32 num_channels{}; |
| 99 | 99 | ||
| 100 | Common::RingBuffer<s16, 0x10000> queue; | 100 | Common::RingBuffer<s16, 0x10000> queue; |
| 101 | std::array<s16, 2> last_frame; | 101 | std::array<s16, 2> last_frame{}; |
| 102 | std::atomic<bool> should_flush{}; | 102 | std::atomic<bool> should_flush{}; |
| 103 | TimeStretcher time_stretch; | 103 | TimeStretcher time_stretch; |
| 104 | 104 | ||
diff --git a/src/common/color.h b/src/common/color.h index 0379040be..3a2222077 100644 --- a/src/common/color.h +++ b/src/common/color.h | |||
| @@ -55,36 +55,36 @@ constexpr u8 Convert8To6(u8 value) { | |||
| 55 | /** | 55 | /** |
| 56 | * Decode a color stored in RGBA8 format | 56 | * Decode a color stored in RGBA8 format |
| 57 | * @param bytes Pointer to encoded source color | 57 | * @param bytes Pointer to encoded source color |
| 58 | * @return Result color decoded as Math::Vec4<u8> | 58 | * @return Result color decoded as Common::Vec4<u8> |
| 59 | */ | 59 | */ |
| 60 | inline Math::Vec4<u8> DecodeRGBA8(const u8* bytes) { | 60 | inline Common::Vec4<u8> DecodeRGBA8(const u8* bytes) { |
| 61 | return {bytes[3], bytes[2], bytes[1], bytes[0]}; | 61 | return {bytes[3], bytes[2], bytes[1], bytes[0]}; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /** | 64 | /** |
| 65 | * Decode a color stored in RGB8 format | 65 | * Decode a color stored in RGB8 format |
| 66 | * @param bytes Pointer to encoded source color | 66 | * @param bytes Pointer to encoded source color |
| 67 | * @return Result color decoded as Math::Vec4<u8> | 67 | * @return Result color decoded as Common::Vec4<u8> |
| 68 | */ | 68 | */ |
| 69 | inline Math::Vec4<u8> DecodeRGB8(const u8* bytes) { | 69 | inline Common::Vec4<u8> DecodeRGB8(const u8* bytes) { |
| 70 | return {bytes[2], bytes[1], bytes[0], 255}; | 70 | return {bytes[2], bytes[1], bytes[0], 255}; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| 74 | * Decode a color stored in RG8 (aka HILO8) format | 74 | * Decode a color stored in RG8 (aka HILO8) format |
| 75 | * @param bytes Pointer to encoded source color | 75 | * @param bytes Pointer to encoded source color |
| 76 | * @return Result color decoded as Math::Vec4<u8> | 76 | * @return Result color decoded as Common::Vec4<u8> |
| 77 | */ | 77 | */ |
| 78 | inline Math::Vec4<u8> DecodeRG8(const u8* bytes) { | 78 | inline Common::Vec4<u8> DecodeRG8(const u8* bytes) { |
| 79 | return {bytes[1], bytes[0], 0, 255}; | 79 | return {bytes[1], bytes[0], 0, 255}; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | /** | 82 | /** |
| 83 | * Decode a color stored in RGB565 format | 83 | * Decode a color stored in RGB565 format |
| 84 | * @param bytes Pointer to encoded source color | 84 | * @param bytes Pointer to encoded source color |
| 85 | * @return Result color decoded as Math::Vec4<u8> | 85 | * @return Result color decoded as Common::Vec4<u8> |
| 86 | */ | 86 | */ |
| 87 | inline Math::Vec4<u8> DecodeRGB565(const u8* bytes) { | 87 | inline Common::Vec4<u8> DecodeRGB565(const u8* bytes) { |
| 88 | u16_le pixel; | 88 | u16_le pixel; |
| 89 | std::memcpy(&pixel, bytes, sizeof(pixel)); | 89 | std::memcpy(&pixel, bytes, sizeof(pixel)); |
| 90 | return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F), | 90 | return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F), |
| @@ -94,9 +94,9 @@ inline Math::Vec4<u8> DecodeRGB565(const u8* bytes) { | |||
| 94 | /** | 94 | /** |
| 95 | * Decode a color stored in RGB5A1 format | 95 | * Decode a color stored in RGB5A1 format |
| 96 | * @param bytes Pointer to encoded source color | 96 | * @param bytes Pointer to encoded source color |
| 97 | * @return Result color decoded as Math::Vec4<u8> | 97 | * @return Result color decoded as Common::Vec4<u8> |
| 98 | */ | 98 | */ |
| 99 | inline Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) { | 99 | inline Common::Vec4<u8> DecodeRGB5A1(const u8* bytes) { |
| 100 | u16_le pixel; | 100 | u16_le pixel; |
| 101 | std::memcpy(&pixel, bytes, sizeof(pixel)); | 101 | std::memcpy(&pixel, bytes, sizeof(pixel)); |
| 102 | return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F), | 102 | return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F), |
| @@ -106,9 +106,9 @@ inline Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) { | |||
| 106 | /** | 106 | /** |
| 107 | * Decode a color stored in RGBA4 format | 107 | * Decode a color stored in RGBA4 format |
| 108 | * @param bytes Pointer to encoded source color | 108 | * @param bytes Pointer to encoded source color |
| 109 | * @return Result color decoded as Math::Vec4<u8> | 109 | * @return Result color decoded as Common::Vec4<u8> |
| 110 | */ | 110 | */ |
| 111 | inline Math::Vec4<u8> DecodeRGBA4(const u8* bytes) { | 111 | inline Common::Vec4<u8> DecodeRGBA4(const u8* bytes) { |
| 112 | u16_le pixel; | 112 | u16_le pixel; |
| 113 | std::memcpy(&pixel, bytes, sizeof(pixel)); | 113 | std::memcpy(&pixel, bytes, sizeof(pixel)); |
| 114 | return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF), | 114 | return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF), |
| @@ -138,9 +138,9 @@ inline u32 DecodeD24(const u8* bytes) { | |||
| 138 | /** | 138 | /** |
| 139 | * Decode a depth value and a stencil value stored in D24S8 format | 139 | * Decode a depth value and a stencil value stored in D24S8 format |
| 140 | * @param bytes Pointer to encoded source values | 140 | * @param bytes Pointer to encoded source values |
| 141 | * @return Resulting values stored as a Math::Vec2 | 141 | * @return Resulting values stored as a Common::Vec2 |
| 142 | */ | 142 | */ |
| 143 | inline Math::Vec2<u32> DecodeD24S8(const u8* bytes) { | 143 | inline Common::Vec2<u32> DecodeD24S8(const u8* bytes) { |
| 144 | return {static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]}; | 144 | return {static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]}; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| @@ -149,7 +149,7 @@ inline Math::Vec2<u32> DecodeD24S8(const u8* bytes) { | |||
| 149 | * @param color Source color to encode | 149 | * @param color Source color to encode |
| 150 | * @param bytes Destination pointer to store encoded color | 150 | * @param bytes Destination pointer to store encoded color |
| 151 | */ | 151 | */ |
| 152 | inline void EncodeRGBA8(const Math::Vec4<u8>& color, u8* bytes) { | 152 | inline void EncodeRGBA8(const Common::Vec4<u8>& color, u8* bytes) { |
| 153 | bytes[3] = color.r(); | 153 | bytes[3] = color.r(); |
| 154 | bytes[2] = color.g(); | 154 | bytes[2] = color.g(); |
| 155 | bytes[1] = color.b(); | 155 | bytes[1] = color.b(); |
| @@ -161,7 +161,7 @@ inline void EncodeRGBA8(const Math::Vec4<u8>& color, u8* bytes) { | |||
| 161 | * @param color Source color to encode | 161 | * @param color Source color to encode |
| 162 | * @param bytes Destination pointer to store encoded color | 162 | * @param bytes Destination pointer to store encoded color |
| 163 | */ | 163 | */ |
| 164 | inline void EncodeRGB8(const Math::Vec4<u8>& color, u8* bytes) { | 164 | inline void EncodeRGB8(const Common::Vec4<u8>& color, u8* bytes) { |
| 165 | bytes[2] = color.r(); | 165 | bytes[2] = color.r(); |
| 166 | bytes[1] = color.g(); | 166 | bytes[1] = color.g(); |
| 167 | bytes[0] = color.b(); | 167 | bytes[0] = color.b(); |
| @@ -172,7 +172,7 @@ inline void EncodeRGB8(const Math::Vec4<u8>& color, u8* bytes) { | |||
| 172 | * @param color Source color to encode | 172 | * @param color Source color to encode |
| 173 | * @param bytes Destination pointer to store encoded color | 173 | * @param bytes Destination pointer to store encoded color |
| 174 | */ | 174 | */ |
| 175 | inline void EncodeRG8(const Math::Vec4<u8>& color, u8* bytes) { | 175 | inline void EncodeRG8(const Common::Vec4<u8>& color, u8* bytes) { |
| 176 | bytes[1] = color.r(); | 176 | bytes[1] = color.r(); |
| 177 | bytes[0] = color.g(); | 177 | bytes[0] = color.g(); |
| 178 | } | 178 | } |
| @@ -181,7 +181,7 @@ inline void EncodeRG8(const Math::Vec4<u8>& color, u8* bytes) { | |||
| 181 | * @param color Source color to encode | 181 | * @param color Source color to encode |
| 182 | * @param bytes Destination pointer to store encoded color | 182 | * @param bytes Destination pointer to store encoded color |
| 183 | */ | 183 | */ |
| 184 | inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) { | 184 | inline void EncodeRGB565(const Common::Vec4<u8>& color, u8* bytes) { |
| 185 | const u16_le data = | 185 | const u16_le data = |
| 186 | (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b()); | 186 | (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b()); |
| 187 | 187 | ||
| @@ -193,7 +193,7 @@ inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) { | |||
| 193 | * @param color Source color to encode | 193 | * @param color Source color to encode |
| 194 | * @param bytes Destination pointer to store encoded color | 194 | * @param bytes Destination pointer to store encoded color |
| 195 | */ | 195 | */ |
| 196 | inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) { | 196 | inline void EncodeRGB5A1(const Common::Vec4<u8>& color, u8* bytes) { |
| 197 | const u16_le data = (Convert8To5(color.r()) << 11) | (Convert8To5(color.g()) << 6) | | 197 | const u16_le data = (Convert8To5(color.r()) << 11) | (Convert8To5(color.g()) << 6) | |
| 198 | (Convert8To5(color.b()) << 1) | Convert8To1(color.a()); | 198 | (Convert8To5(color.b()) << 1) | Convert8To1(color.a()); |
| 199 | 199 | ||
| @@ -205,7 +205,7 @@ inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) { | |||
| 205 | * @param color Source color to encode | 205 | * @param color Source color to encode |
| 206 | * @param bytes Destination pointer to store encoded color | 206 | * @param bytes Destination pointer to store encoded color |
| 207 | */ | 207 | */ |
| 208 | inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) { | 208 | inline void EncodeRGBA4(const Common::Vec4<u8>& color, u8* bytes) { |
| 209 | const u16 data = (Convert8To4(color.r()) << 12) | (Convert8To4(color.g()) << 8) | | 209 | const u16 data = (Convert8To4(color.r()) << 12) | (Convert8To4(color.g()) << 8) | |
| 210 | (Convert8To4(color.b()) << 4) | Convert8To4(color.a()); | 210 | (Convert8To4(color.b()) << 4) | Convert8To4(color.a()); |
| 211 | 211 | ||
diff --git a/src/common/math_util.h b/src/common/math_util.h index 94b4394c5..cff3d48c5 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <cstdlib> | 7 | #include <cstdlib> |
| 8 | #include <type_traits> | 8 | #include <type_traits> |
| 9 | 9 | ||
| 10 | namespace MathUtil { | 10 | namespace Common { |
| 11 | 11 | ||
| 12 | constexpr float PI = 3.14159265f; | 12 | constexpr float PI = 3.14159265f; |
| 13 | 13 | ||
| @@ -41,4 +41,4 @@ struct Rectangle { | |||
| 41 | } | 41 | } |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | } // namespace MathUtil | 44 | } // namespace Common |
diff --git a/src/common/quaternion.h b/src/common/quaternion.h index c528c0b68..370198ae0 100644 --- a/src/common/quaternion.h +++ b/src/common/quaternion.h | |||
| @@ -6,12 +6,12 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/vector_math.h" | 7 | #include "common/vector_math.h" |
| 8 | 8 | ||
| 9 | namespace Math { | 9 | namespace Common { |
| 10 | 10 | ||
| 11 | template <typename T> | 11 | template <typename T> |
| 12 | class Quaternion { | 12 | class Quaternion { |
| 13 | public: | 13 | public: |
| 14 | Math::Vec3<T> xyz; | 14 | Vec3<T> xyz; |
| 15 | T w{}; | 15 | T w{}; |
| 16 | 16 | ||
| 17 | Quaternion<decltype(-T{})> Inverse() const { | 17 | Quaternion<decltype(-T{})> Inverse() const { |
| @@ -38,12 +38,12 @@ public: | |||
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | template <typename T> | 40 | template <typename T> |
| 41 | auto QuaternionRotate(const Quaternion<T>& q, const Math::Vec3<T>& v) { | 41 | auto QuaternionRotate(const Quaternion<T>& q, const Vec3<T>& v) { |
| 42 | return v + 2 * Cross(q.xyz, Cross(q.xyz, v) + v * q.w); | 42 | return v + 2 * Cross(q.xyz, Cross(q.xyz, v) + v * q.w); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | inline Quaternion<float> MakeQuaternion(const Math::Vec3<float>& axis, float angle) { | 45 | inline Quaternion<float> MakeQuaternion(const Vec3<float>& axis, float angle) { |
| 46 | return {axis * std::sin(angle / 2), std::cos(angle / 2)}; | 46 | return {axis * std::sin(angle / 2), std::cos(angle / 2)}; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | } // namespace Math | 49 | } // namespace Common |
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 8feb49941..429485329 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | #include <cmath> | 33 | #include <cmath> |
| 34 | #include <type_traits> | 34 | #include <type_traits> |
| 35 | 35 | ||
| 36 | namespace Math { | 36 | namespace Common { |
| 37 | 37 | ||
| 38 | template <typename T> | 38 | template <typename T> |
| 39 | class Vec2; | 39 | class Vec2; |
| @@ -690,4 +690,4 @@ constexpr Vec4<T> MakeVec(const T& x, const Vec3<T>& yzw) { | |||
| 690 | return MakeVec(x, yzw[0], yzw[1], yzw[2]); | 690 | return MakeVec(x, yzw[0], yzw[1], yzw[2]); |
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | } // namespace Math | 693 | } // namespace Common |
diff --git a/src/core/file_sys/vfs_vector.cpp b/src/core/file_sys/vfs_vector.cpp index 515626658..75fc04302 100644 --- a/src/core/file_sys/vfs_vector.cpp +++ b/src/core/file_sys/vfs_vector.cpp | |||
| @@ -47,7 +47,7 @@ std::size_t VectorVfsFile::Write(const u8* data_, std::size_t length, std::size_ | |||
| 47 | if (offset + length > data.size()) | 47 | if (offset + length > data.size()) |
| 48 | data.resize(offset + length); | 48 | data.resize(offset + length); |
| 49 | const auto write = std::min(length, data.size() - offset); | 49 | const auto write = std::min(length, data.size() - offset); |
| 50 | std::memcpy(data.data(), data_, write); | 50 | std::memcpy(data.data() + offset, data_, write); |
| 51 | return write; | 51 | return write; |
| 52 | } | 52 | } |
| 53 | 53 | ||
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index f8662d193..a1357179f 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -12,12 +12,12 @@ namespace Layout { | |||
| 12 | 12 | ||
| 13 | // Finds the largest size subrectangle contained in window area that is confined to the aspect ratio | 13 | // Finds the largest size subrectangle contained in window area that is confined to the aspect ratio |
| 14 | template <class T> | 14 | template <class T> |
| 15 | static MathUtil::Rectangle<T> maxRectangle(MathUtil::Rectangle<T> window_area, | 15 | static Common::Rectangle<T> MaxRectangle(Common::Rectangle<T> window_area, |
| 16 | float screen_aspect_ratio) { | 16 | float screen_aspect_ratio) { |
| 17 | float scale = std::min(static_cast<float>(window_area.GetWidth()), | 17 | float scale = std::min(static_cast<float>(window_area.GetWidth()), |
| 18 | window_area.GetHeight() / screen_aspect_ratio); | 18 | window_area.GetHeight() / screen_aspect_ratio); |
| 19 | return MathUtil::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)), | 19 | return Common::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)), |
| 20 | static_cast<T>(std::round(scale * screen_aspect_ratio))}; | 20 | static_cast<T>(std::round(scale * screen_aspect_ratio))}; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height) { | 23 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height) { |
| @@ -29,8 +29,8 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height) { | |||
| 29 | 29 | ||
| 30 | const float emulation_aspect_ratio{static_cast<float>(ScreenUndocked::Height) / | 30 | const float emulation_aspect_ratio{static_cast<float>(ScreenUndocked::Height) / |
| 31 | ScreenUndocked::Width}; | 31 | ScreenUndocked::Width}; |
| 32 | MathUtil::Rectangle<unsigned> screen_window_area{0, 0, width, height}; | 32 | Common::Rectangle<unsigned> screen_window_area{0, 0, width, height}; |
| 33 | MathUtil::Rectangle<unsigned> screen = maxRectangle(screen_window_area, emulation_aspect_ratio); | 33 | Common::Rectangle<unsigned> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); |
| 34 | 34 | ||
| 35 | float window_aspect_ratio = static_cast<float>(height) / width; | 35 | float window_aspect_ratio = static_cast<float>(height) / width; |
| 36 | 36 | ||
diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index e06647794..c2c63d08c 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h | |||
| @@ -16,7 +16,7 @@ struct FramebufferLayout { | |||
| 16 | unsigned width{ScreenUndocked::Width}; | 16 | unsigned width{ScreenUndocked::Width}; |
| 17 | unsigned height{ScreenUndocked::Height}; | 17 | unsigned height{ScreenUndocked::Height}; |
| 18 | 18 | ||
| 19 | MathUtil::Rectangle<unsigned> screen; | 19 | Common::Rectangle<unsigned> screen; |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | * Returns the ration of pixel size of the screen, compared to the native size of the undocked | 22 | * Returns the ration of pixel size of the screen, compared to the native size of the undocked |
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h index 16fdcd376..7c11d7546 100644 --- a/src/core/frontend/input.h +++ b/src/core/frontend/input.h | |||
| @@ -124,7 +124,7 @@ using AnalogDevice = InputDevice<std::tuple<float, float>>; | |||
| 124 | * Orientation is determined by right-hand rule. | 124 | * Orientation is determined by right-hand rule. |
| 125 | * Units: deg/sec | 125 | * Units: deg/sec |
| 126 | */ | 126 | */ |
| 127 | using MotionDevice = InputDevice<std::tuple<Math::Vec3<float>, Math::Vec3<float>>>; | 127 | using MotionDevice = InputDevice<std::tuple<Common::Vec3<float>, Common::Vec3<float>>>; |
| 128 | 128 | ||
| 129 | /** | 129 | /** |
| 130 | * A touch device is an input device that returns a tuple of two floats and a bool. The floats are | 130 | * A touch device is an input device that returns a tuple of two floats and a bool. The floats are |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 21ccfe1f8..dbe7ee6e8 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | |||
| @@ -23,7 +23,7 @@ u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector | |||
| 23 | 23 | ||
| 24 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, | 24 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, |
| 25 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, | 25 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, |
| 26 | const MathUtil::Rectangle<int>& crop_rect) { | 26 | const Common::Rectangle<int>& crop_rect) { |
| 27 | VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); | 27 | VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); |
| 28 | LOG_TRACE(Service, | 28 | LOG_TRACE(Service, |
| 29 | "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", | 29 | "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index a45086e45..ace71169f 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | |||
| @@ -25,7 +25,7 @@ public: | |||
| 25 | /// Performs a screen flip, drawing the buffer pointed to by the handle. | 25 | /// Performs a screen flip, drawing the buffer pointed to by the handle. |
| 26 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, | 26 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, |
| 27 | NVFlinger::BufferQueue::BufferTransformFlags transform, | 27 | NVFlinger::BufferQueue::BufferTransformFlags transform, |
| 28 | const MathUtil::Rectangle<int>& crop_rect); | 28 | const Common::Rectangle<int>& crop_rect); |
| 29 | 29 | ||
| 30 | private: | 30 | private: |
| 31 | std::shared_ptr<nvmap> nvmap_dev; | 31 | std::shared_ptr<nvmap> nvmap_dev; |
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp index fc07d9bb8..4d150fc71 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue.cpp | |||
| @@ -63,7 +63,7 @@ const IGBPBuffer& BufferQueue::RequestBuffer(u32 slot) const { | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform, | 65 | void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform, |
| 66 | const MathUtil::Rectangle<int>& crop_rect) { | 66 | const Common::Rectangle<int>& crop_rect) { |
| 67 | auto itr = std::find_if(queue.begin(), queue.end(), | 67 | auto itr = std::find_if(queue.begin(), queue.end(), |
| 68 | [&](const Buffer& buffer) { return buffer.slot == slot; }); | 68 | [&](const Buffer& buffer) { return buffer.slot == slot; }); |
| 69 | ASSERT(itr != queue.end()); | 69 | ASSERT(itr != queue.end()); |
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h index ab90d591e..e1ccb6171 100644 --- a/src/core/hle/service/nvflinger/buffer_queue.h +++ b/src/core/hle/service/nvflinger/buffer_queue.h | |||
| @@ -67,14 +67,14 @@ public: | |||
| 67 | Status status = Status::Free; | 67 | Status status = Status::Free; |
| 68 | IGBPBuffer igbp_buffer; | 68 | IGBPBuffer igbp_buffer; |
| 69 | BufferTransformFlags transform; | 69 | BufferTransformFlags transform; |
| 70 | MathUtil::Rectangle<int> crop_rect; | 70 | Common::Rectangle<int> crop_rect; |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | void SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer); | 73 | void SetPreallocatedBuffer(u32 slot, const IGBPBuffer& igbp_buffer); |
| 74 | std::optional<u32> DequeueBuffer(u32 width, u32 height); | 74 | std::optional<u32> DequeueBuffer(u32 width, u32 height); |
| 75 | const IGBPBuffer& RequestBuffer(u32 slot) const; | 75 | const IGBPBuffer& RequestBuffer(u32 slot) const; |
| 76 | void QueueBuffer(u32 slot, BufferTransformFlags transform, | 76 | void QueueBuffer(u32 slot, BufferTransformFlags transform, |
| 77 | const MathUtil::Rectangle<int>& crop_rect); | 77 | const Common::Rectangle<int>& crop_rect); |
| 78 | std::optional<std::reference_wrapper<const Buffer>> AcquireBuffer(); | 78 | std::optional<std::reference_wrapper<const Buffer>> AcquireBuffer(); |
| 79 | void ReleaseBuffer(u32 slot); | 79 | void ReleaseBuffer(u32 slot); |
| 80 | u32 Query(QueryType type); | 80 | u32 Query(QueryType type); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 7369a09ec..a975767bb 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -420,7 +420,7 @@ public: | |||
| 420 | u32_le fence_is_valid; | 420 | u32_le fence_is_valid; |
| 421 | std::array<Fence, 2> fences; | 421 | std::array<Fence, 2> fences; |
| 422 | 422 | ||
| 423 | MathUtil::Rectangle<int> GetCropRect() const { | 423 | Common::Rectangle<int> GetCropRect() const { |
| 424 | return {crop_left, crop_top, crop_right, crop_bottom}; | 424 | return {crop_left, crop_top, crop_right, crop_bottom}; |
| 425 | } | 425 | } |
| 426 | }; | 426 | }; |
| @@ -752,6 +752,7 @@ public: | |||
| 752 | {1102, nullptr, "GetDisplayResolution"}, | 752 | {1102, nullptr, "GetDisplayResolution"}, |
| 753 | {2010, &IManagerDisplayService::CreateManagedLayer, "CreateManagedLayer"}, | 753 | {2010, &IManagerDisplayService::CreateManagedLayer, "CreateManagedLayer"}, |
| 754 | {2011, nullptr, "DestroyManagedLayer"}, | 754 | {2011, nullptr, "DestroyManagedLayer"}, |
| 755 | {2012, nullptr, "CreateStrayLayer"}, | ||
| 755 | {2050, nullptr, "CreateIndirectLayer"}, | 756 | {2050, nullptr, "CreateIndirectLayer"}, |
| 756 | {2051, nullptr, "DestroyIndirectLayer"}, | 757 | {2051, nullptr, "DestroyIndirectLayer"}, |
| 757 | {2052, nullptr, "CreateIndirectProducerEndPoint"}, | 758 | {2052, nullptr, "CreateIndirectProducerEndPoint"}, |
diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp index 9570c060e..6d96d4019 100644 --- a/src/input_common/motion_emu.cpp +++ b/src/input_common/motion_emu.cpp | |||
| @@ -32,12 +32,12 @@ public: | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | void BeginTilt(int x, int y) { | 34 | void BeginTilt(int x, int y) { |
| 35 | mouse_origin = Math::MakeVec(x, y); | 35 | mouse_origin = Common::MakeVec(x, y); |
| 36 | is_tilting = true; | 36 | is_tilting = true; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void Tilt(int x, int y) { | 39 | void Tilt(int x, int y) { |
| 40 | auto mouse_move = Math::MakeVec(x, y) - mouse_origin; | 40 | auto mouse_move = Common::MakeVec(x, y) - mouse_origin; |
| 41 | if (is_tilting) { | 41 | if (is_tilting) { |
| 42 | std::lock_guard<std::mutex> guard(tilt_mutex); | 42 | std::lock_guard<std::mutex> guard(tilt_mutex); |
| 43 | if (mouse_move.x == 0 && mouse_move.y == 0) { | 43 | if (mouse_move.x == 0 && mouse_move.y == 0) { |
| @@ -45,7 +45,7 @@ public: | |||
| 45 | } else { | 45 | } else { |
| 46 | tilt_direction = mouse_move.Cast<float>(); | 46 | tilt_direction = mouse_move.Cast<float>(); |
| 47 | tilt_angle = | 47 | tilt_angle = |
| 48 | std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f, MathUtil::PI * 0.5f); | 48 | std::clamp(tilt_direction.Normalize() * sensitivity, 0.0f, Common::PI * 0.5f); |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| @@ -56,7 +56,7 @@ public: | |||
| 56 | is_tilting = false; | 56 | is_tilting = false; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> GetStatus() { | 59 | std::tuple<Common::Vec3<float>, Common::Vec3<float>> GetStatus() { |
| 60 | std::lock_guard<std::mutex> guard(status_mutex); | 60 | std::lock_guard<std::mutex> guard(status_mutex); |
| 61 | return status; | 61 | return status; |
| 62 | } | 62 | } |
| @@ -66,17 +66,17 @@ private: | |||
| 66 | const std::chrono::steady_clock::duration update_duration; | 66 | const std::chrono::steady_clock::duration update_duration; |
| 67 | const float sensitivity; | 67 | const float sensitivity; |
| 68 | 68 | ||
| 69 | Math::Vec2<int> mouse_origin; | 69 | Common::Vec2<int> mouse_origin; |
| 70 | 70 | ||
| 71 | std::mutex tilt_mutex; | 71 | std::mutex tilt_mutex; |
| 72 | Math::Vec2<float> tilt_direction; | 72 | Common::Vec2<float> tilt_direction; |
| 73 | float tilt_angle = 0; | 73 | float tilt_angle = 0; |
| 74 | 74 | ||
| 75 | bool is_tilting = false; | 75 | bool is_tilting = false; |
| 76 | 76 | ||
| 77 | Common::Event shutdown_event; | 77 | Common::Event shutdown_event; |
| 78 | 78 | ||
| 79 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> status; | 79 | std::tuple<Common::Vec3<float>, Common::Vec3<float>> status; |
| 80 | std::mutex status_mutex; | 80 | std::mutex status_mutex; |
| 81 | 81 | ||
| 82 | // Note: always keep the thread declaration at the end so that other objects are initialized | 82 | // Note: always keep the thread declaration at the end so that other objects are initialized |
| @@ -85,8 +85,8 @@ private: | |||
| 85 | 85 | ||
| 86 | void MotionEmuThread() { | 86 | void MotionEmuThread() { |
| 87 | auto update_time = std::chrono::steady_clock::now(); | 87 | auto update_time = std::chrono::steady_clock::now(); |
| 88 | Math::Quaternion<float> q = MakeQuaternion(Math::Vec3<float>(), 0); | 88 | Common::Quaternion<float> q = Common::MakeQuaternion(Common::Vec3<float>(), 0); |
| 89 | Math::Quaternion<float> old_q; | 89 | Common::Quaternion<float> old_q; |
| 90 | 90 | ||
| 91 | while (!shutdown_event.WaitUntil(update_time)) { | 91 | while (!shutdown_event.WaitUntil(update_time)) { |
| 92 | update_time += update_duration; | 92 | update_time += update_duration; |
| @@ -96,18 +96,18 @@ private: | |||
| 96 | std::lock_guard<std::mutex> guard(tilt_mutex); | 96 | std::lock_guard<std::mutex> guard(tilt_mutex); |
| 97 | 97 | ||
| 98 | // Find the quaternion describing current 3DS tilting | 98 | // Find the quaternion describing current 3DS tilting |
| 99 | q = MakeQuaternion(Math::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x), | 99 | q = Common::MakeQuaternion( |
| 100 | tilt_angle); | 100 | Common::MakeVec(-tilt_direction.y, 0.0f, tilt_direction.x), tilt_angle); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | auto inv_q = q.Inverse(); | 103 | auto inv_q = q.Inverse(); |
| 104 | 104 | ||
| 105 | // Set the gravity vector in world space | 105 | // Set the gravity vector in world space |
| 106 | auto gravity = Math::MakeVec(0.0f, -1.0f, 0.0f); | 106 | auto gravity = Common::MakeVec(0.0f, -1.0f, 0.0f); |
| 107 | 107 | ||
| 108 | // Find the angular rate vector in world space | 108 | // Find the angular rate vector in world space |
| 109 | auto angular_rate = ((q - old_q) * inv_q).xyz * 2; | 109 | auto angular_rate = ((q - old_q) * inv_q).xyz * 2; |
| 110 | angular_rate *= 1000 / update_millisecond / MathUtil::PI * 180; | 110 | angular_rate *= 1000 / update_millisecond / Common::PI * 180; |
| 111 | 111 | ||
| 112 | // Transform the two vectors from world space to 3DS space | 112 | // Transform the two vectors from world space to 3DS space |
| 113 | gravity = QuaternionRotate(inv_q, gravity); | 113 | gravity = QuaternionRotate(inv_q, gravity); |
| @@ -131,7 +131,7 @@ public: | |||
| 131 | device = std::make_shared<MotionEmuDevice>(update_millisecond, sensitivity); | 131 | device = std::make_shared<MotionEmuDevice>(update_millisecond, sensitivity); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | std::tuple<Math::Vec3<float>, Math::Vec3<float>> GetStatus() const override { | 134 | std::tuple<Common::Vec3<float>, Common::Vec3<float>> GetStatus() const override { |
| 135 | return device->GetStatus(); | 135 | return device->GetStatus(); |
| 136 | } | 136 | } |
| 137 | 137 | ||
diff --git a/src/video_core/engines/fermi_2d.cpp b/src/video_core/engines/fermi_2d.cpp index ec1a57226..540dcc52c 100644 --- a/src/video_core/engines/fermi_2d.cpp +++ b/src/video_core/engines/fermi_2d.cpp | |||
| @@ -44,10 +44,10 @@ void Fermi2D::HandleSurfaceCopy() { | |||
| 44 | const u32 src_blit_y2{ | 44 | const u32 src_blit_y2{ |
| 45 | static_cast<u32>((regs.blit_src_y + (regs.blit_dst_height * regs.blit_dv_dy)) >> 32)}; | 45 | static_cast<u32>((regs.blit_src_y + (regs.blit_dst_height * regs.blit_dv_dy)) >> 32)}; |
| 46 | 46 | ||
| 47 | const MathUtil::Rectangle<u32> src_rect{src_blit_x1, src_blit_y1, src_blit_x2, src_blit_y2}; | 47 | const Common::Rectangle<u32> src_rect{src_blit_x1, src_blit_y1, src_blit_x2, src_blit_y2}; |
| 48 | const MathUtil::Rectangle<u32> dst_rect{regs.blit_dst_x, regs.blit_dst_y, | 48 | const Common::Rectangle<u32> dst_rect{regs.blit_dst_x, regs.blit_dst_y, |
| 49 | regs.blit_dst_x + regs.blit_dst_width, | 49 | regs.blit_dst_x + regs.blit_dst_width, |
| 50 | regs.blit_dst_y + regs.blit_dst_height}; | 50 | regs.blit_dst_y + regs.blit_dst_height}; |
| 51 | 51 | ||
| 52 | if (!rasterizer.AccelerateSurfaceCopy(regs.src, regs.dst, src_rect, dst_rect)) { | 52 | if (!rasterizer.AccelerateSurfaceCopy(regs.src, regs.dst, src_rect, dst_rect)) { |
| 53 | UNIMPLEMENTED(); | 53 | UNIMPLEMENTED(); |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 0e3873ffd..584f51c48 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -503,7 +503,7 @@ public: | |||
| 503 | f32 translate_z; | 503 | f32 translate_z; |
| 504 | INSERT_PADDING_WORDS(2); | 504 | INSERT_PADDING_WORDS(2); |
| 505 | 505 | ||
| 506 | MathUtil::Rectangle<s32> GetRect() const { | 506 | Common::Rectangle<s32> GetRect() const { |
| 507 | return { | 507 | return { |
| 508 | GetX(), // left | 508 | GetX(), // left |
| 509 | GetY() + GetHeight(), // top | 509 | GetY() + GetHeight(), // top |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 0f5bfdcbf..6313702f2 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -100,7 +100,7 @@ struct FramebufferConfig { | |||
| 100 | 100 | ||
| 101 | using TransformFlags = Service::NVFlinger::BufferQueue::BufferTransformFlags; | 101 | using TransformFlags = Service::NVFlinger::BufferQueue::BufferTransformFlags; |
| 102 | TransformFlags transform_flags; | 102 | TransformFlags transform_flags; |
| 103 | MathUtil::Rectangle<int> crop_rect; | 103 | Common::Rectangle<int> crop_rect; |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | namespace Engines { | 106 | namespace Engines { |
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index b2a223705..6a1dc9cf6 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h | |||
| @@ -47,8 +47,8 @@ public: | |||
| 47 | /// Attempt to use a faster method to perform a surface copy | 47 | /// Attempt to use a faster method to perform a surface copy |
| 48 | virtual bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, | 48 | virtual bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, |
| 49 | const Tegra::Engines::Fermi2D::Regs::Surface& dst, | 49 | const Tegra::Engines::Fermi2D::Regs::Surface& dst, |
| 50 | const MathUtil::Rectangle<u32>& src_rect, | 50 | const Common::Rectangle<u32>& src_rect, |
| 51 | const MathUtil::Rectangle<u32>& dst_rect) { | 51 | const Common::Rectangle<u32>& dst_rect) { |
| 52 | return false; | 52 | return false; |
| 53 | } | 53 | } |
| 54 | 54 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 12d876120..09fa01d25 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -779,8 +779,8 @@ void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size) { | |||
| 779 | 779 | ||
| 780 | bool RasterizerOpenGL::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, | 780 | bool RasterizerOpenGL::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, |
| 781 | const Tegra::Engines::Fermi2D::Regs::Surface& dst, | 781 | const Tegra::Engines::Fermi2D::Regs::Surface& dst, |
| 782 | const MathUtil::Rectangle<u32>& src_rect, | 782 | const Common::Rectangle<u32>& src_rect, |
| 783 | const MathUtil::Rectangle<u32>& dst_rect) { | 783 | const Common::Rectangle<u32>& dst_rect) { |
| 784 | MICROPROFILE_SCOPE(OpenGL_Blits); | 784 | MICROPROFILE_SCOPE(OpenGL_Blits); |
| 785 | res_cache.FermiCopySurface(src, dst, src_rect, dst_rect); | 785 | res_cache.FermiCopySurface(src, dst, src_rect, dst_rect); |
| 786 | return true; | 786 | return true; |
| @@ -1034,7 +1034,7 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) { | |||
| 1034 | for (std::size_t i = 0; i < viewport_count; i++) { | 1034 | for (std::size_t i = 0; i < viewport_count; i++) { |
| 1035 | auto& viewport = current_state.viewports[i]; | 1035 | auto& viewport = current_state.viewports[i]; |
| 1036 | const auto& src = regs.viewports[i]; | 1036 | const auto& src = regs.viewports[i]; |
| 1037 | const MathUtil::Rectangle<s32> viewport_rect{regs.viewport_transform[i].GetRect()}; | 1037 | const Common::Rectangle<s32> viewport_rect{regs.viewport_transform[i].GetRect()}; |
| 1038 | viewport.x = viewport_rect.left; | 1038 | viewport.x = viewport_rect.left; |
| 1039 | viewport.y = viewport_rect.bottom; | 1039 | viewport.y = viewport_rect.bottom; |
| 1040 | viewport.width = viewport_rect.GetWidth(); | 1040 | viewport.width = viewport_rect.GetWidth(); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 258d62259..2f0524f85 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -62,8 +62,8 @@ public: | |||
| 62 | void FlushAndInvalidateRegion(VAddr addr, u64 size) override; | 62 | void FlushAndInvalidateRegion(VAddr addr, u64 size) override; |
| 63 | bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, | 63 | bool AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Regs::Surface& src, |
| 64 | const Tegra::Engines::Fermi2D::Regs::Surface& dst, | 64 | const Tegra::Engines::Fermi2D::Regs::Surface& dst, |
| 65 | const MathUtil::Rectangle<u32>& src_rect, | 65 | const Common::Rectangle<u32>& src_rect, |
| 66 | const MathUtil::Rectangle<u32>& dst_rect) override; | 66 | const Common::Rectangle<u32>& dst_rect) override; |
| 67 | bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr, | 67 | bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr, |
| 68 | u32 pixel_stride) override; | 68 | u32 pixel_stride) override; |
| 69 | bool AccelerateDrawBatch(bool is_indexed) override; | 69 | bool AccelerateDrawBatch(bool is_indexed) override; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index e6d47ce41..49c79811d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -399,7 +399,7 @@ static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType | |||
| 399 | return format; | 399 | return format; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | MathUtil::Rectangle<u32> SurfaceParams::GetRect(u32 mip_level) const { | 402 | Common::Rectangle<u32> SurfaceParams::GetRect(u32 mip_level) const { |
| 403 | u32 actual_height{std::max(1U, unaligned_height >> mip_level)}; | 403 | u32 actual_height{std::max(1U, unaligned_height >> mip_level)}; |
| 404 | if (IsPixelFormatASTC(pixel_format)) { | 404 | if (IsPixelFormatASTC(pixel_format)) { |
| 405 | // ASTC formats must stop at the ATSC block size boundary | 405 | // ASTC formats must stop at the ATSC block size boundary |
| @@ -1062,8 +1062,8 @@ void RasterizerCacheOpenGL::FastLayeredCopySurface(const Surface& src_surface, | |||
| 1062 | } | 1062 | } |
| 1063 | 1063 | ||
| 1064 | static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface, | 1064 | static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface, |
| 1065 | const MathUtil::Rectangle<u32>& src_rect, | 1065 | const Common::Rectangle<u32>& src_rect, |
| 1066 | const MathUtil::Rectangle<u32>& dst_rect, GLuint read_fb_handle, | 1066 | const Common::Rectangle<u32>& dst_rect, GLuint read_fb_handle, |
| 1067 | GLuint draw_fb_handle, GLenum src_attachment = 0, GLenum dst_attachment = 0, | 1067 | GLuint draw_fb_handle, GLenum src_attachment = 0, GLenum dst_attachment = 0, |
| 1068 | std::size_t cubemap_face = 0) { | 1068 | std::size_t cubemap_face = 0) { |
| 1069 | 1069 | ||
| @@ -1193,7 +1193,7 @@ static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface, | |||
| 1193 | void RasterizerCacheOpenGL::FermiCopySurface( | 1193 | void RasterizerCacheOpenGL::FermiCopySurface( |
| 1194 | const Tegra::Engines::Fermi2D::Regs::Surface& src_config, | 1194 | const Tegra::Engines::Fermi2D::Regs::Surface& src_config, |
| 1195 | const Tegra::Engines::Fermi2D::Regs::Surface& dst_config, | 1195 | const Tegra::Engines::Fermi2D::Regs::Surface& dst_config, |
| 1196 | const MathUtil::Rectangle<u32>& src_rect, const MathUtil::Rectangle<u32>& dst_rect) { | 1196 | const Common::Rectangle<u32>& src_rect, const Common::Rectangle<u32>& dst_rect) { |
| 1197 | 1197 | ||
| 1198 | const auto& src_params = SurfaceParams::CreateForFermiCopySurface(src_config); | 1198 | const auto& src_params = SurfaceParams::CreateForFermiCopySurface(src_config); |
| 1199 | const auto& dst_params = SurfaceParams::CreateForFermiCopySurface(dst_config); | 1199 | const auto& dst_params = SurfaceParams::CreateForFermiCopySurface(dst_config); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 89d733c50..838554c35 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -28,7 +28,7 @@ namespace OpenGL { | |||
| 28 | 28 | ||
| 29 | class CachedSurface; | 29 | class CachedSurface; |
| 30 | using Surface = std::shared_ptr<CachedSurface>; | 30 | using Surface = std::shared_ptr<CachedSurface>; |
| 31 | using SurfaceSurfaceRect_Tuple = std::tuple<Surface, Surface, MathUtil::Rectangle<u32>>; | 31 | using SurfaceSurfaceRect_Tuple = std::tuple<Surface, Surface, Common::Rectangle<u32>>; |
| 32 | 32 | ||
| 33 | using SurfaceTarget = VideoCore::Surface::SurfaceTarget; | 33 | using SurfaceTarget = VideoCore::Surface::SurfaceTarget; |
| 34 | using SurfaceType = VideoCore::Surface::SurfaceType; | 34 | using SurfaceType = VideoCore::Surface::SurfaceType; |
| @@ -71,7 +71,7 @@ struct SurfaceParams { | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /// Returns the rectangle corresponding to this surface | 73 | /// Returns the rectangle corresponding to this surface |
| 74 | MathUtil::Rectangle<u32> GetRect(u32 mip_level = 0) const; | 74 | Common::Rectangle<u32> GetRect(u32 mip_level = 0) const; |
| 75 | 75 | ||
| 76 | /// Returns the total size of this surface in bytes, adjusted for compression | 76 | /// Returns the total size of this surface in bytes, adjusted for compression |
| 77 | std::size_t SizeInBytesRaw(bool ignore_tiled = false) const { | 77 | std::size_t SizeInBytesRaw(bool ignore_tiled = false) const { |
| @@ -430,8 +430,8 @@ public: | |||
| 430 | /// Copies the contents of one surface to another | 430 | /// Copies the contents of one surface to another |
| 431 | void FermiCopySurface(const Tegra::Engines::Fermi2D::Regs::Surface& src_config, | 431 | void FermiCopySurface(const Tegra::Engines::Fermi2D::Regs::Surface& src_config, |
| 432 | const Tegra::Engines::Fermi2D::Regs::Surface& dst_config, | 432 | const Tegra::Engines::Fermi2D::Regs::Surface& dst_config, |
| 433 | const MathUtil::Rectangle<u32>& src_rect, | 433 | const Common::Rectangle<u32>& src_rect, |
| 434 | const MathUtil::Rectangle<u32>& dst_rect); | 434 | const Common::Rectangle<u32>& dst_rect); |
| 435 | 435 | ||
| 436 | private: | 436 | private: |
| 437 | void LoadSurface(const Surface& surface); | 437 | void LoadSurface(const Surface& surface); |
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 81882822b..82fc4d44b 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | |||
| @@ -2,8 +2,6 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <cstring> | 5 | #include <cstring> |
| 8 | #include <fmt/format.h> | 6 | #include <fmt/format.h> |
| 9 | #include <lz4.h> | 7 | #include <lz4.h> |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 272fc2e8e..e60b2eb44 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -257,6 +257,7 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, | |||
| 257 | const Tegra::FramebufferConfig& framebuffer) { | 257 | const Tegra::FramebufferConfig& framebuffer) { |
| 258 | texture.width = framebuffer.width; | 258 | texture.width = framebuffer.width; |
| 259 | texture.height = framebuffer.height; | 259 | texture.height = framebuffer.height; |
| 260 | texture.pixel_format = framebuffer.pixel_format; | ||
| 260 | 261 | ||
| 261 | GLint internal_format; | 262 | GLint internal_format; |
| 262 | switch (framebuffer.pixel_format) { | 263 | switch (framebuffer.pixel_format) { |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 7e13e566b..c168fa89e 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -39,7 +39,7 @@ struct TextureInfo { | |||
| 39 | /// Structure used for storing information about the display target for the Switch screen | 39 | /// Structure used for storing information about the display target for the Switch screen |
| 40 | struct ScreenInfo { | 40 | struct ScreenInfo { |
| 41 | GLuint display_texture; | 41 | GLuint display_texture; |
| 42 | const MathUtil::Rectangle<float> display_texcoords{0.0f, 0.0f, 1.0f, 1.0f}; | 42 | const Common::Rectangle<float> display_texcoords{0.0f, 0.0f, 1.0f, 1.0f}; |
| 43 | TextureInfo texture; | 43 | TextureInfo texture; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| @@ -102,7 +102,7 @@ private: | |||
| 102 | 102 | ||
| 103 | /// Used for transforming the framebuffer orientation | 103 | /// Used for transforming the framebuffer orientation |
| 104 | Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags; | 104 | Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags; |
| 105 | MathUtil::Rectangle<int> framebuffer_crop_rect; | 105 | Common::Rectangle<int> framebuffer_crop_rect; |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | } // namespace OpenGL | 108 | } // namespace OpenGL |
diff --git a/src/video_core/shader/track.cpp b/src/video_core/shader/track.cpp index be4635342..33b071747 100644 --- a/src/video_core/shader/track.cpp +++ b/src/video_core/shader/track.cpp | |||
| @@ -20,9 +20,9 @@ std::pair<Node, s64> FindOperation(const NodeBlock& code, s64 cursor, | |||
| 20 | return {node, cursor}; | 20 | return {node, cursor}; |
| 21 | } | 21 | } |
| 22 | if (const auto conditional = std::get_if<ConditionalNode>(node)) { | 22 | if (const auto conditional = std::get_if<ConditionalNode>(node)) { |
| 23 | const auto& code = conditional->GetCode(); | 23 | const auto& conditional_code = conditional->GetCode(); |
| 24 | const auto [found, internal_cursor] = | 24 | const auto [found, internal_cursor] = FindOperation( |
| 25 | FindOperation(code, static_cast<s64>(code.size() - 1), operation_code); | 25 | conditional_code, static_cast<s64>(conditional_code.size() - 1), operation_code); |
| 26 | if (found) | 26 | if (found) |
| 27 | return {found, cursor}; | 27 | return {found, cursor}; |
| 28 | } | 28 | } |
| @@ -58,8 +58,8 @@ Node ShaderIR::TrackCbuf(Node tracked, const NodeBlock& code, s64 cursor) { | |||
| 58 | return nullptr; | 58 | return nullptr; |
| 59 | } | 59 | } |
| 60 | if (const auto conditional = std::get_if<ConditionalNode>(tracked)) { | 60 | if (const auto conditional = std::get_if<ConditionalNode>(tracked)) { |
| 61 | const auto& code = conditional->GetCode(); | 61 | const auto& conditional_code = conditional->GetCode(); |
| 62 | return TrackCbuf(tracked, code, static_cast<s64>(code.size())); | 62 | return TrackCbuf(tracked, conditional_code, static_cast<s64>(conditional_code.size())); |
| 63 | } | 63 | } |
| 64 | return nullptr; | 64 | return nullptr; |
| 65 | } | 65 | } |
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp index 209798521..71683da8e 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.cpp +++ b/src/yuzu/debugger/graphics/graphics_surface.cpp | |||
| @@ -398,7 +398,7 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 398 | 398 | ||
| 399 | for (unsigned int y = 0; y < surface_height; ++y) { | 399 | for (unsigned int y = 0; y < surface_height; ++y) { |
| 400 | for (unsigned int x = 0; x < surface_width; ++x) { | 400 | for (unsigned int x = 0; x < surface_width; ++x) { |
| 401 | Math::Vec4<u8> color; | 401 | Common::Vec4<u8> color; |
| 402 | color[0] = texture_data[x + y * surface_width + 0]; | 402 | color[0] = texture_data[x + y * surface_width + 0]; |
| 403 | color[1] = texture_data[x + y * surface_width + 1]; | 403 | color[1] = texture_data[x + y * surface_width + 1]; |
| 404 | color[2] = texture_data[x + y * surface_width + 2]; | 404 | color[2] = texture_data[x + y * surface_width + 2]; |