diff options
| -rw-r--r-- | src/core/hle/service/time/interface.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 132 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.h | 19 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 16 | ||||
| -rw-r--r-- | src/video_core/surface.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/surface.h | 148 | ||||
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 5 |
8 files changed, 236 insertions, 94 deletions
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp index 18a5d71d5..e3cbd7004 100644 --- a/src/core/hle/service/time/interface.cpp +++ b/src/core/hle/service/time/interface.cpp | |||
| @@ -21,7 +21,7 @@ Time::Time(std::shared_ptr<Module> time, const char* name) | |||
| 21 | {102, nullptr, "GetStandardUserSystemClockInitialYear"}, | 21 | {102, nullptr, "GetStandardUserSystemClockInitialYear"}, |
| 22 | {200, nullptr, "IsStandardNetworkSystemClockAccuracySufficient"}, | 22 | {200, nullptr, "IsStandardNetworkSystemClockAccuracySufficient"}, |
| 23 | {300, nullptr, "CalculateMonotonicSystemClockBaseTimePoint"}, | 23 | {300, nullptr, "CalculateMonotonicSystemClockBaseTimePoint"}, |
| 24 | {400, nullptr, "GetClockSnapshot"}, | 24 | {400, &Time::GetClockSnapshot, "GetClockSnapshot"}, |
| 25 | {401, nullptr, "GetClockSnapshotFromSystemClockContext"}, | 25 | {401, nullptr, "GetClockSnapshotFromSystemClockContext"}, |
| 26 | {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"}, | 26 | {500, nullptr, "CalculateStandardUserSystemClockDifferenceByUser"}, |
| 27 | {501, nullptr, "CalculateSpanBetween"}, | 27 | {501, nullptr, "CalculateSpanBetween"}, |
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 28fd8debc..85e7b1195 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -15,6 +15,44 @@ | |||
| 15 | 15 | ||
| 16 | namespace Service::Time { | 16 | namespace Service::Time { |
| 17 | 17 | ||
| 18 | static void PosixToCalendar(u64 posix_time, CalendarTime& calendar_time, | ||
| 19 | CalendarAdditionalInfo& additional_info, | ||
| 20 | [[maybe_unused]] const TimeZoneRule& /*rule*/) { | ||
| 21 | const std::time_t time(posix_time); | ||
| 22 | const std::tm* tm = std::localtime(&time); | ||
| 23 | if (tm == nullptr) { | ||
| 24 | calendar_time = {}; | ||
| 25 | additional_info = {}; | ||
| 26 | return; | ||
| 27 | } | ||
| 28 | calendar_time.year = tm->tm_year + 1900; | ||
| 29 | calendar_time.month = tm->tm_mon + 1; | ||
| 30 | calendar_time.day = tm->tm_mday; | ||
| 31 | calendar_time.hour = tm->tm_hour; | ||
| 32 | calendar_time.minute = tm->tm_min; | ||
| 33 | calendar_time.second = tm->tm_sec; | ||
| 34 | |||
| 35 | additional_info.day_of_week = tm->tm_wday; | ||
| 36 | additional_info.day_of_year = tm->tm_yday; | ||
| 37 | std::memcpy(additional_info.name.data(), "UTC", sizeof("UTC")); | ||
| 38 | additional_info.utc_offset = 0; | ||
| 39 | } | ||
| 40 | |||
| 41 | static u64 CalendarToPosix(const CalendarTime& calendar_time, | ||
| 42 | [[maybe_unused]] const TimeZoneRule& /*rule*/) { | ||
| 43 | std::tm time{}; | ||
| 44 | time.tm_year = calendar_time.year - 1900; | ||
| 45 | time.tm_mon = calendar_time.month - 1; | ||
| 46 | time.tm_mday = calendar_time.day; | ||
| 47 | |||
| 48 | time.tm_hour = calendar_time.hour; | ||
| 49 | time.tm_min = calendar_time.minute; | ||
| 50 | time.tm_sec = calendar_time.second; | ||
| 51 | |||
| 52 | std::time_t epoch_time = std::mktime(&time); | ||
| 53 | return static_cast<u64>(epoch_time); | ||
| 54 | } | ||
| 55 | |||
| 18 | class ISystemClock final : public ServiceFramework<ISystemClock> { | 56 | class ISystemClock final : public ServiceFramework<ISystemClock> { |
| 19 | public: | 57 | public: |
| 20 | ISystemClock() : ServiceFramework("ISystemClock") { | 58 | ISystemClock() : ServiceFramework("ISystemClock") { |
| @@ -80,8 +118,8 @@ public: | |||
| 80 | {5, nullptr, "GetTimeZoneRuleVersion"}, | 118 | {5, nullptr, "GetTimeZoneRuleVersion"}, |
| 81 | {100, &ITimeZoneService::ToCalendarTime, "ToCalendarTime"}, | 119 | {100, &ITimeZoneService::ToCalendarTime, "ToCalendarTime"}, |
| 82 | {101, &ITimeZoneService::ToCalendarTimeWithMyRule, "ToCalendarTimeWithMyRule"}, | 120 | {101, &ITimeZoneService::ToCalendarTimeWithMyRule, "ToCalendarTimeWithMyRule"}, |
| 83 | {201, nullptr, "ToPosixTime"}, | 121 | {201, &ITimeZoneService::ToPosixTime, "ToPosixTime"}, |
| 84 | {202, nullptr, "ToPosixTimeWithMyRule"}, | 122 | {202, &ITimeZoneService::ToPosixTimeWithMyRule, "ToPosixTimeWithMyRule"}, |
| 85 | }; | 123 | }; |
| 86 | RegisterHandlers(functions); | 124 | RegisterHandlers(functions); |
| 87 | } | 125 | } |
| @@ -151,24 +189,29 @@ private: | |||
| 151 | rb.PushRaw(additional_info); | 189 | rb.PushRaw(additional_info); |
| 152 | } | 190 | } |
| 153 | 191 | ||
| 154 | void PosixToCalendar(u64 posix_time, CalendarTime& calendar_time, | 192 | void ToPosixTime(Kernel::HLERequestContext& ctx) { |
| 155 | CalendarAdditionalInfo& additional_info, const TimeZoneRule& /*rule*/) { | 193 | // TODO(ogniK): Figure out how to handle multiple times |
| 156 | std::time_t t(posix_time); | 194 | LOG_WARNING(Service_Time, "(STUBBED) called"); |
| 157 | std::tm* tm = std::localtime(&t); | 195 | IPC::RequestParser rp{ctx}; |
| 158 | if (!tm) { | 196 | auto calendar_time = rp.PopRaw<CalendarTime>(); |
| 159 | return; | 197 | auto posix_time = CalendarToPosix(calendar_time, {}); |
| 160 | } | 198 | |
| 161 | calendar_time.year = tm->tm_year + 1900; | 199 | IPC::ResponseBuilder rb{ctx, 3}; |
| 162 | calendar_time.month = tm->tm_mon + 1; | 200 | rb.Push(RESULT_SUCCESS); |
| 163 | calendar_time.day = tm->tm_mday; | 201 | rb.PushRaw<u32>(1); // Amount of times we're returning |
| 164 | calendar_time.hour = tm->tm_hour; | 202 | ctx.WriteBuffer(&posix_time, sizeof(u64)); |
| 165 | calendar_time.minute = tm->tm_min; | 203 | } |
| 166 | calendar_time.second = tm->tm_sec; | 204 | |
| 167 | 205 | void ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) { | |
| 168 | additional_info.day_of_week = tm->tm_wday; | 206 | LOG_WARNING(Service_Time, "(STUBBED) called"); |
| 169 | additional_info.day_of_year = tm->tm_yday; | 207 | IPC::RequestParser rp{ctx}; |
| 170 | std::memcpy(additional_info.name.data(), "UTC", sizeof("UTC")); | 208 | auto calendar_time = rp.PopRaw<CalendarTime>(); |
| 171 | additional_info.utc_offset = 0; | 209 | auto posix_time = CalendarToPosix(calendar_time, {}); |
| 210 | |||
| 211 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 212 | rb.Push(RESULT_SUCCESS); | ||
| 213 | rb.PushRaw<u32>(1); // Amount of times we're returning | ||
| 214 | ctx.WriteBuffer(&posix_time, sizeof(u64)); | ||
| 172 | } | 215 | } |
| 173 | }; | 216 | }; |
| 174 | 217 | ||
| @@ -207,6 +250,55 @@ void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& c | |||
| 207 | LOG_DEBUG(Service_Time, "called"); | 250 | LOG_DEBUG(Service_Time, "called"); |
| 208 | } | 251 | } |
| 209 | 252 | ||
| 253 | void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | ||
| 254 | LOG_DEBUG(Service_Time, "called"); | ||
| 255 | |||
| 256 | IPC::RequestParser rp{ctx}; | ||
| 257 | auto unknown_u8 = rp.PopRaw<u8>(); | ||
| 258 | |||
| 259 | ClockSnapshot clock_snapshot{}; | ||
| 260 | |||
| 261 | const s64 time_since_epoch{std::chrono::duration_cast<std::chrono::seconds>( | ||
| 262 | std::chrono::system_clock::now().time_since_epoch()) | ||
| 263 | .count()}; | ||
| 264 | CalendarTime calendar_time{}; | ||
| 265 | const std::time_t time(time_since_epoch); | ||
| 266 | const std::tm* tm = std::localtime(&time); | ||
| 267 | if (tm == nullptr) { | ||
| 268 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 269 | rb.Push(ResultCode(-1)); // TODO(ogniK): Find appropriate error code | ||
| 270 | return; | ||
| 271 | } | ||
| 272 | SteadyClockTimePoint steady_clock_time_point{CoreTiming::cyclesToMs(CoreTiming::GetTicks()) / | ||
| 273 | 1000}; | ||
| 274 | |||
| 275 | LocationName location_name{"UTC"}; | ||
| 276 | calendar_time.year = tm->tm_year + 1900; | ||
| 277 | calendar_time.month = tm->tm_mon + 1; | ||
| 278 | calendar_time.day = tm->tm_mday; | ||
| 279 | calendar_time.hour = tm->tm_hour; | ||
| 280 | calendar_time.minute = tm->tm_min; | ||
| 281 | calendar_time.second = tm->tm_sec; | ||
| 282 | clock_snapshot.system_posix_time = time_since_epoch; | ||
| 283 | clock_snapshot.network_posix_time = time_since_epoch; | ||
| 284 | clock_snapshot.system_calendar_time = calendar_time; | ||
| 285 | clock_snapshot.network_calendar_time = calendar_time; | ||
| 286 | |||
| 287 | CalendarAdditionalInfo additional_info{}; | ||
| 288 | PosixToCalendar(time_since_epoch, calendar_time, additional_info, {}); | ||
| 289 | |||
| 290 | clock_snapshot.system_calendar_info = additional_info; | ||
| 291 | clock_snapshot.network_calendar_info = additional_info; | ||
| 292 | |||
| 293 | clock_snapshot.steady_clock_timepoint = steady_clock_time_point; | ||
| 294 | clock_snapshot.location_name = location_name; | ||
| 295 | clock_snapshot.clock_auto_adjustment_enabled = 1; | ||
| 296 | clock_snapshot.ipc_u8 = unknown_u8; | ||
| 297 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 298 | rb.Push(RESULT_SUCCESS); | ||
| 299 | ctx.WriteBuffer(&clock_snapshot, sizeof(ClockSnapshot)); | ||
| 300 | } | ||
| 301 | |||
| 210 | Module::Interface::Interface(std::shared_ptr<Module> time, const char* name) | 302 | Module::Interface::Interface(std::shared_ptr<Module> time, const char* name) |
| 211 | : ServiceFramework(name), time(std::move(time)) {} | 303 | : ServiceFramework(name), time(std::move(time)) {} |
| 212 | 304 | ||
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index 5659ecad3..77871ae07 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include "common/common_funcs.h" | ||
| 8 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| 9 | 10 | ||
| 10 | namespace Service::Time { | 11 | namespace Service::Time { |
| @@ -53,6 +54,23 @@ struct SystemClockContext { | |||
| 53 | static_assert(sizeof(SystemClockContext) == 0x20, | 54 | static_assert(sizeof(SystemClockContext) == 0x20, |
| 54 | "SystemClockContext structure has incorrect size"); | 55 | "SystemClockContext structure has incorrect size"); |
| 55 | 56 | ||
| 57 | struct ClockSnapshot { | ||
| 58 | SystemClockContext user_clock_context; | ||
| 59 | SystemClockContext network_clock_context; | ||
| 60 | s64_le system_posix_time; | ||
| 61 | s64_le network_posix_time; | ||
| 62 | CalendarTime system_calendar_time; | ||
| 63 | CalendarTime network_calendar_time; | ||
| 64 | CalendarAdditionalInfo system_calendar_info; | ||
| 65 | CalendarAdditionalInfo network_calendar_info; | ||
| 66 | SteadyClockTimePoint steady_clock_timepoint; | ||
| 67 | LocationName location_name; | ||
| 68 | u8 clock_auto_adjustment_enabled; | ||
| 69 | u8 ipc_u8; | ||
| 70 | INSERT_PADDING_BYTES(2); | ||
| 71 | }; | ||
| 72 | static_assert(sizeof(ClockSnapshot) == 0xd0, "ClockSnapshot is an invalid size"); | ||
| 73 | |||
| 56 | class Module final { | 74 | class Module final { |
| 57 | public: | 75 | public: |
| 58 | class Interface : public ServiceFramework<Interface> { | 76 | class Interface : public ServiceFramework<Interface> { |
| @@ -65,6 +83,7 @@ public: | |||
| 65 | void GetStandardSteadyClock(Kernel::HLERequestContext& ctx); | 83 | void GetStandardSteadyClock(Kernel::HLERequestContext& ctx); |
| 66 | void GetTimeZoneService(Kernel::HLERequestContext& ctx); | 84 | void GetTimeZoneService(Kernel::HLERequestContext& ctx); |
| 67 | void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx); | 85 | void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx); |
| 86 | void GetClockSnapshot(Kernel::HLERequestContext& ctx); | ||
| 68 | 87 | ||
| 69 | protected: | 88 | protected: |
| 70 | std::shared_ptr<Module> time; | 89 | std::shared_ptr<Module> time; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 894f4f294..24cd88d06 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -314,6 +314,8 @@ static constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex | |||
| 314 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4_SRGB | 314 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4_SRGB |
| 315 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5 | 315 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5 |
| 316 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5_SRGB | 316 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X5_SRGB |
| 317 | {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8 | ||
| 318 | {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_10X8_SRGB | ||
| 317 | 319 | ||
| 318 | // Depth formats | 320 | // Depth formats |
| 319 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F | 321 | {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, ComponentType::Float, false}, // Z32F |
| @@ -456,6 +458,8 @@ static constexpr GLConversionArray morton_to_gl_fns = { | |||
| 456 | MortonCopy<true, PixelFormat::ASTC_2D_5X4_SRGB>, | 458 | MortonCopy<true, PixelFormat::ASTC_2D_5X4_SRGB>, |
| 457 | MortonCopy<true, PixelFormat::ASTC_2D_5X5>, | 459 | MortonCopy<true, PixelFormat::ASTC_2D_5X5>, |
| 458 | MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>, | 460 | MortonCopy<true, PixelFormat::ASTC_2D_5X5_SRGB>, |
| 461 | MortonCopy<true, PixelFormat::ASTC_2D_10X8>, | ||
| 462 | MortonCopy<true, PixelFormat::ASTC_2D_10X8_SRGB>, | ||
| 459 | MortonCopy<true, PixelFormat::Z32F>, | 463 | MortonCopy<true, PixelFormat::Z32F>, |
| 460 | MortonCopy<true, PixelFormat::Z16>, | 464 | MortonCopy<true, PixelFormat::Z16>, |
| 461 | MortonCopy<true, PixelFormat::Z24S8>, | 465 | MortonCopy<true, PixelFormat::Z24S8>, |
| @@ -526,6 +530,8 @@ static constexpr GLConversionArray gl_to_morton_fns = { | |||
| 526 | nullptr, | 530 | nullptr, |
| 527 | nullptr, | 531 | nullptr, |
| 528 | nullptr, | 532 | nullptr, |
| 533 | nullptr, | ||
| 534 | nullptr, | ||
| 529 | MortonCopy<false, PixelFormat::Z32F>, | 535 | MortonCopy<false, PixelFormat::Z32F>, |
| 530 | MortonCopy<false, PixelFormat::Z16>, | 536 | MortonCopy<false, PixelFormat::Z16>, |
| 531 | MortonCopy<false, PixelFormat::Z24S8>, | 537 | MortonCopy<false, PixelFormat::Z24S8>, |
| @@ -932,7 +938,9 @@ static void ConvertFormatAsNeeded_LoadGLBuffer(std::vector<u8>& data, PixelForma | |||
| 932 | case PixelFormat::ASTC_2D_8X8_SRGB: | 938 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 933 | case PixelFormat::ASTC_2D_8X5_SRGB: | 939 | case PixelFormat::ASTC_2D_8X5_SRGB: |
| 934 | case PixelFormat::ASTC_2D_5X4_SRGB: | 940 | case PixelFormat::ASTC_2D_5X4_SRGB: |
| 935 | case PixelFormat::ASTC_2D_5X5_SRGB: { | 941 | case PixelFormat::ASTC_2D_5X5_SRGB: |
| 942 | case PixelFormat::ASTC_2D_10X8: | ||
| 943 | case PixelFormat::ASTC_2D_10X8_SRGB: { | ||
| 936 | // Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC. | 944 | // Convert ASTC pixel formats to RGBA8, as most desktop GPUs do not support ASTC. |
| 937 | u32 block_width{}; | 945 | u32 block_width{}; |
| 938 | u32 block_height{}; | 946 | u32 block_height{}; |
| @@ -967,7 +975,11 @@ static void ConvertFormatAsNeeded_FlushGLBuffer(std::vector<u8>& data, PixelForm | |||
| 967 | case PixelFormat::ASTC_2D_4X4: | 975 | case PixelFormat::ASTC_2D_4X4: |
| 968 | case PixelFormat::ASTC_2D_8X8: | 976 | case PixelFormat::ASTC_2D_8X8: |
| 969 | case PixelFormat::ASTC_2D_4X4_SRGB: | 977 | case PixelFormat::ASTC_2D_4X4_SRGB: |
| 970 | case PixelFormat::ASTC_2D_8X8_SRGB: { | 978 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 979 | case PixelFormat::ASTC_2D_5X5: | ||
| 980 | case PixelFormat::ASTC_2D_5X5_SRGB: | ||
| 981 | case PixelFormat::ASTC_2D_10X8: | ||
| 982 | case PixelFormat::ASTC_2D_10X8_SRGB: { | ||
| 971 | LOG_CRITICAL(HW_GPU, "Conversion of format {} after texture flushing is not implemented", | 983 | LOG_CRITICAL(HW_GPU, "Conversion of format {} after texture flushing is not implemented", |
| 972 | static_cast<u32>(pixel_format)); | 984 | static_cast<u32>(pixel_format)); |
| 973 | UNREACHABLE(); | 985 | UNREACHABLE(); |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 051ad3964..9582dd2ca 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -306,6 +306,8 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format, | |||
| 306 | return is_srgb ? PixelFormat::ASTC_2D_8X8_SRGB : PixelFormat::ASTC_2D_8X8; | 306 | return is_srgb ? PixelFormat::ASTC_2D_8X8_SRGB : PixelFormat::ASTC_2D_8X8; |
| 307 | case Tegra::Texture::TextureFormat::ASTC_2D_8X5: | 307 | case Tegra::Texture::TextureFormat::ASTC_2D_8X5: |
| 308 | return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5; | 308 | return is_srgb ? PixelFormat::ASTC_2D_8X5_SRGB : PixelFormat::ASTC_2D_8X5; |
| 309 | case Tegra::Texture::TextureFormat::ASTC_2D_10X8: | ||
| 310 | return is_srgb ? PixelFormat::ASTC_2D_10X8_SRGB : PixelFormat::ASTC_2D_10X8; | ||
| 309 | case Tegra::Texture::TextureFormat::R16_G16: | 311 | case Tegra::Texture::TextureFormat::R16_G16: |
| 310 | switch (component_type) { | 312 | switch (component_type) { |
| 311 | case Tegra::Texture::ComponentType::FLOAT: | 313 | case Tegra::Texture::ComponentType::FLOAT: |
| @@ -453,6 +455,8 @@ bool IsPixelFormatASTC(PixelFormat format) { | |||
| 453 | case PixelFormat::ASTC_2D_5X5_SRGB: | 455 | case PixelFormat::ASTC_2D_5X5_SRGB: |
| 454 | case PixelFormat::ASTC_2D_8X8_SRGB: | 456 | case PixelFormat::ASTC_2D_8X8_SRGB: |
| 455 | case PixelFormat::ASTC_2D_8X5_SRGB: | 457 | case PixelFormat::ASTC_2D_8X5_SRGB: |
| 458 | case PixelFormat::ASTC_2D_10X8: | ||
| 459 | case PixelFormat::ASTC_2D_10X8_SRGB: | ||
| 456 | return true; | 460 | return true; |
| 457 | default: | 461 | default: |
| 458 | return false; | 462 | return false; |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index dfdb8d122..0dd3eb2e4 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -74,19 +74,21 @@ enum class PixelFormat { | |||
| 74 | ASTC_2D_5X4_SRGB = 56, | 74 | ASTC_2D_5X4_SRGB = 56, |
| 75 | ASTC_2D_5X5 = 57, | 75 | ASTC_2D_5X5 = 57, |
| 76 | ASTC_2D_5X5_SRGB = 58, | 76 | ASTC_2D_5X5_SRGB = 58, |
| 77 | ASTC_2D_10X8 = 59, | ||
| 78 | ASTC_2D_10X8_SRGB = 60, | ||
| 77 | 79 | ||
| 78 | MaxColorFormat, | 80 | MaxColorFormat, |
| 79 | 81 | ||
| 80 | // Depth formats | 82 | // Depth formats |
| 81 | Z32F = 59, | 83 | Z32F = 61, |
| 82 | Z16 = 60, | 84 | Z16 = 62, |
| 83 | 85 | ||
| 84 | MaxDepthFormat, | 86 | MaxDepthFormat, |
| 85 | 87 | ||
| 86 | // DepthStencil formats | 88 | // DepthStencil formats |
| 87 | Z24S8 = 61, | 89 | Z24S8 = 63, |
| 88 | S8Z24 = 62, | 90 | S8Z24 = 64, |
| 89 | Z32FS8 = 63, | 91 | Z32FS8 = 65, |
| 90 | 92 | ||
| 91 | MaxDepthStencilFormat, | 93 | MaxDepthStencilFormat, |
| 92 | 94 | ||
| @@ -193,6 +195,8 @@ static constexpr u32 GetCompressionFactor(PixelFormat format) { | |||
| 193 | 4, // ASTC_2D_5X4_SRGB | 195 | 4, // ASTC_2D_5X4_SRGB |
| 194 | 4, // ASTC_2D_5X5 | 196 | 4, // ASTC_2D_5X5 |
| 195 | 4, // ASTC_2D_5X5_SRGB | 197 | 4, // ASTC_2D_5X5_SRGB |
| 198 | 4, // ASTC_2D_10X8 | ||
| 199 | 4, // ASTC_2D_10X8_SRGB | ||
| 196 | 1, // Z32F | 200 | 1, // Z32F |
| 197 | 1, // Z16 | 201 | 1, // Z16 |
| 198 | 1, // Z24S8 | 202 | 1, // Z24S8 |
| @@ -208,70 +212,72 @@ static constexpr u32 GetDefaultBlockWidth(PixelFormat format) { | |||
| 208 | if (format == PixelFormat::Invalid) | 212 | if (format == PixelFormat::Invalid) |
| 209 | return 0; | 213 | return 0; |
| 210 | constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ | 214 | constexpr std::array<u32, MaxPixelFormat> block_width_table = {{ |
| 211 | 1, // ABGR8U | 215 | 1, // ABGR8U |
| 212 | 1, // ABGR8S | 216 | 1, // ABGR8S |
| 213 | 1, // ABGR8UI | 217 | 1, // ABGR8UI |
| 214 | 1, // B5G6R5U | 218 | 1, // B5G6R5U |
| 215 | 1, // A2B10G10R10U | 219 | 1, // A2B10G10R10U |
| 216 | 1, // A1B5G5R5U | 220 | 1, // A1B5G5R5U |
| 217 | 1, // R8U | 221 | 1, // R8U |
| 218 | 1, // R8UI | 222 | 1, // R8UI |
| 219 | 1, // RGBA16F | 223 | 1, // RGBA16F |
| 220 | 1, // RGBA16U | 224 | 1, // RGBA16U |
| 221 | 1, // RGBA16UI | 225 | 1, // RGBA16UI |
| 222 | 1, // R11FG11FB10F | 226 | 1, // R11FG11FB10F |
| 223 | 1, // RGBA32UI | 227 | 1, // RGBA32UI |
| 224 | 4, // DXT1 | 228 | 4, // DXT1 |
| 225 | 4, // DXT23 | 229 | 4, // DXT23 |
| 226 | 4, // DXT45 | 230 | 4, // DXT45 |
| 227 | 4, // DXN1 | 231 | 4, // DXN1 |
| 228 | 4, // DXN2UNORM | 232 | 4, // DXN2UNORM |
| 229 | 4, // DXN2SNORM | 233 | 4, // DXN2SNORM |
| 230 | 4, // BC7U | 234 | 4, // BC7U |
| 231 | 4, // BC6H_UF16 | 235 | 4, // BC6H_UF16 |
| 232 | 4, // BC6H_SF16 | 236 | 4, // BC6H_SF16 |
| 233 | 4, // ASTC_2D_4X4 | 237 | 4, // ASTC_2D_4X4 |
| 234 | 1, // G8R8U | 238 | 1, // G8R8U |
| 235 | 1, // G8R8S | 239 | 1, // G8R8S |
| 236 | 1, // BGRA8 | 240 | 1, // BGRA8 |
| 237 | 1, // RGBA32F | 241 | 1, // RGBA32F |
| 238 | 1, // RG32F | 242 | 1, // RG32F |
| 239 | 1, // R32F | 243 | 1, // R32F |
| 240 | 1, // R16F | 244 | 1, // R16F |
| 241 | 1, // R16U | 245 | 1, // R16U |
| 242 | 1, // R16S | 246 | 1, // R16S |
| 243 | 1, // R16UI | 247 | 1, // R16UI |
| 244 | 1, // R16I | 248 | 1, // R16I |
| 245 | 1, // RG16 | 249 | 1, // RG16 |
| 246 | 1, // RG16F | 250 | 1, // RG16F |
| 247 | 1, // RG16UI | 251 | 1, // RG16UI |
| 248 | 1, // RG16I | 252 | 1, // RG16I |
| 249 | 1, // RG16S | 253 | 1, // RG16S |
| 250 | 1, // RGB32F | 254 | 1, // RGB32F |
| 251 | 1, // RGBA8_SRGB | 255 | 1, // RGBA8_SRGB |
| 252 | 1, // RG8U | 256 | 1, // RG8U |
| 253 | 1, // RG8S | 257 | 1, // RG8S |
| 254 | 1, // RG32UI | 258 | 1, // RG32UI |
| 255 | 1, // R32UI | 259 | 1, // R32UI |
| 256 | 8, // ASTC_2D_8X8 | 260 | 8, // ASTC_2D_8X8 |
| 257 | 8, // ASTC_2D_8X5 | 261 | 8, // ASTC_2D_8X5 |
| 258 | 5, // ASTC_2D_5X4 | 262 | 5, // ASTC_2D_5X4 |
| 259 | 1, // BGRA8_SRGB | 263 | 1, // BGRA8_SRGB |
| 260 | 4, // DXT1_SRGB | 264 | 4, // DXT1_SRGB |
| 261 | 4, // DXT23_SRGB | 265 | 4, // DXT23_SRGB |
| 262 | 4, // DXT45_SRGB | 266 | 4, // DXT45_SRGB |
| 263 | 4, // BC7U_SRGB | 267 | 4, // BC7U_SRGB |
| 264 | 4, // ASTC_2D_4X4_SRGB | 268 | 4, // ASTC_2D_4X4_SRGB |
| 265 | 8, // ASTC_2D_8X8_SRGB | 269 | 8, // ASTC_2D_8X8_SRGB |
| 266 | 8, // ASTC_2D_8X5_SRGB | 270 | 8, // ASTC_2D_8X5_SRGB |
| 267 | 5, // ASTC_2D_5X4_SRGB | 271 | 5, // ASTC_2D_5X4_SRGB |
| 268 | 5, // ASTC_2D_5X5 | 272 | 5, // ASTC_2D_5X5 |
| 269 | 5, // ASTC_2D_5X5_SRGB | 273 | 5, // ASTC_2D_5X5_SRGB |
| 270 | 1, // Z32F | 274 | 10, // ASTC_2D_10X8 |
| 271 | 1, // Z16 | 275 | 10, // ASTC_2D_10X8_SRGB |
| 272 | 1, // Z24S8 | 276 | 1, // Z32F |
| 273 | 1, // S8Z24 | 277 | 1, // Z16 |
| 274 | 1, // Z32FS8 | 278 | 1, // Z24S8 |
| 279 | 1, // S8Z24 | ||
| 280 | 1, // Z32FS8 | ||
| 275 | }}; | 281 | }}; |
| 276 | ASSERT(static_cast<std::size_t>(format) < block_width_table.size()); | 282 | ASSERT(static_cast<std::size_t>(format) < block_width_table.size()); |
| 277 | return block_width_table[static_cast<std::size_t>(format)]; | 283 | return block_width_table[static_cast<std::size_t>(format)]; |
| @@ -341,6 +347,8 @@ static constexpr u32 GetDefaultBlockHeight(PixelFormat format) { | |||
| 341 | 4, // ASTC_2D_5X4_SRGB | 347 | 4, // ASTC_2D_5X4_SRGB |
| 342 | 5, // ASTC_2D_5X5 | 348 | 5, // ASTC_2D_5X5 |
| 343 | 5, // ASTC_2D_5X5_SRGB | 349 | 5, // ASTC_2D_5X5_SRGB |
| 350 | 8, // ASTC_2D_10X8 | ||
| 351 | 8, // ASTC_2D_10X8_SRGB | ||
| 344 | 1, // Z32F | 352 | 1, // Z32F |
| 345 | 1, // Z16 | 353 | 1, // Z16 |
| 346 | 1, // Z24S8 | 354 | 1, // Z24S8 |
| @@ -416,6 +424,8 @@ static constexpr u32 GetFormatBpp(PixelFormat format) { | |||
| 416 | 128, // ASTC_2D_5X4_SRGB | 424 | 128, // ASTC_2D_5X4_SRGB |
| 417 | 128, // ASTC_2D_5X5 | 425 | 128, // ASTC_2D_5X5 |
| 418 | 128, // ASTC_2D_5X5_SRGB | 426 | 128, // ASTC_2D_5X5_SRGB |
| 427 | 128, // ASTC_2D_10X8 | ||
| 428 | 128, // ASTC_2D_10X8_SRGB | ||
| 419 | 32, // Z32F | 429 | 32, // Z32F |
| 420 | 16, // Z16 | 430 | 16, // Z16 |
| 421 | 32, // Z24S8 | 431 | 32, // Z24S8 |
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp index 3066abf61..a9d134d14 100644 --- a/src/video_core/textures/decoders.cpp +++ b/src/video_core/textures/decoders.cpp | |||
| @@ -202,6 +202,8 @@ u32 BytesPerPixel(TextureFormat format) { | |||
| 202 | case TextureFormat::ASTC_2D_5X4: | 202 | case TextureFormat::ASTC_2D_5X4: |
| 203 | case TextureFormat::ASTC_2D_8X8: | 203 | case TextureFormat::ASTC_2D_8X8: |
| 204 | case TextureFormat::ASTC_2D_8X5: | 204 | case TextureFormat::ASTC_2D_8X5: |
| 205 | case TextureFormat::ASTC_2D_10X8: | ||
| 206 | case TextureFormat::ASTC_2D_5X5: | ||
| 205 | case TextureFormat::A8R8G8B8: | 207 | case TextureFormat::A8R8G8B8: |
| 206 | case TextureFormat::A2B10G10R10: | 208 | case TextureFormat::A2B10G10R10: |
| 207 | case TextureFormat::BF10GF11RF11: | 209 | case TextureFormat::BF10GF11RF11: |
| @@ -294,6 +296,8 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat | |||
| 294 | case TextureFormat::BC6H_SF16: | 296 | case TextureFormat::BC6H_SF16: |
| 295 | case TextureFormat::ASTC_2D_4X4: | 297 | case TextureFormat::ASTC_2D_4X4: |
| 296 | case TextureFormat::ASTC_2D_8X8: | 298 | case TextureFormat::ASTC_2D_8X8: |
| 299 | case TextureFormat::ASTC_2D_5X5: | ||
| 300 | case TextureFormat::ASTC_2D_10X8: | ||
| 297 | case TextureFormat::A8R8G8B8: | 301 | case TextureFormat::A8R8G8B8: |
| 298 | case TextureFormat::A2B10G10R10: | 302 | case TextureFormat::A2B10G10R10: |
| 299 | case TextureFormat::A1B5G5R5: | 303 | case TextureFormat::A1B5G5R5: |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 74a44be37..131ad19de 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -933,7 +933,8 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 933 | const auto full = res == "Full"; | 933 | const auto full = res == "Full"; |
| 934 | const auto entry_size = CalculateRomFSEntrySize(extracted, full); | 934 | const auto entry_size = CalculateRomFSEntrySize(extracted, full); |
| 935 | 935 | ||
| 936 | QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, entry_size, this); | 936 | QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, |
| 937 | static_cast<s32>(entry_size), this); | ||
| 937 | progress.setWindowModality(Qt::WindowModal); | 938 | progress.setWindowModality(Qt::WindowModal); |
| 938 | progress.setMinimumDuration(100); | 939 | progress.setMinimumDuration(100); |
| 939 | 940 | ||
| @@ -1621,7 +1622,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { | |||
| 1621 | return; | 1622 | return; |
| 1622 | } | 1623 | } |
| 1623 | 1624 | ||
| 1624 | if (ui.action_Fullscreen->isChecked()) { | 1625 | if (!ui.action_Fullscreen->isChecked()) { |
| 1625 | UISettings::values.geometry = saveGeometry(); | 1626 | UISettings::values.geometry = saveGeometry(); |
| 1626 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); | 1627 | UISettings::values.renderwindow_geometry = render_window->saveGeometry(); |
| 1627 | } | 1628 | } |