summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/time/clock_types.h8
-rw-r--r--src/core/hle/service/time/time.cpp37
-rw-r--r--src/core/hle/service/time/time.h2
-rw-r--r--src/core/hle/service/time/time_manager.cpp6
-rw-r--r--src/core/hle/service/time/time_zone_manager.cpp2
-rw-r--r--src/core/hle/service/time/time_zone_types.h4
-rw-r--r--src/video_core/renderer_vulkan/renderer_vulkan.cpp5
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.cpp2
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.cpp8
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.h2
10 files changed, 49 insertions, 27 deletions
diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h
index b78892223..a9cfe3eb0 100644
--- a/src/core/hle/service/time/clock_types.h
+++ b/src/core/hle/service/time/clock_types.h
@@ -12,6 +12,12 @@
namespace Service::Time::Clock {
+enum class TimeType : u8 {
+ UserSystemClock,
+ NetworkSystemClock,
+ LocalSystemClock,
+};
+
/// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint
struct SteadyClockTimePoint {
s64 time_point;
@@ -84,7 +90,7 @@ struct ClockSnapshot {
SteadyClockTimePoint steady_clock_time_point;
TimeZone::LocationName location_name;
u8 is_automatic_correction_enabled;
- u8 type;
+ TimeType type;
INSERT_PADDING_BYTES_NOINIT(0x2);
static ResultCode GetCurrentTime(s64& current_time,
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index f6ff39789..63e0247de 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -122,14 +122,16 @@ private:
ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
Kernel::KThread* thread, Clock::SystemClockContext user_context,
- Clock::SystemClockContext network_context, u8 type, Clock::ClockSnapshot& clock_snapshot) {
+ Clock::SystemClockContext network_context, Clock::TimeType type,
+ Clock::ClockSnapshot& clock_snapshot) {
auto& time_manager{system.GetTimeManager()};
+ clock_snapshot.steady_clock_time_point =
+ time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system);
clock_snapshot.is_automatic_correction_enabled =
time_manager.GetStandardUserSystemClockCore().IsAutomaticCorrectionEnabled();
- clock_snapshot.user_context = user_context;
- clock_snapshot.network_context = network_context;
+ clock_snapshot.type = type;
if (const ResultCode result{
time_manager.GetTimeZoneContentManager().GetTimeZoneManager().GetDeviceLocationName(
@@ -138,12 +140,11 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
return result;
}
- const auto current_time_point{
- time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)};
- clock_snapshot.steady_clock_time_point = current_time_point;
+ clock_snapshot.user_context = user_context;
if (const ResultCode result{Clock::ClockSnapshot::GetCurrentTime(
- clock_snapshot.user_time, current_time_point, clock_snapshot.user_context)};
+ clock_snapshot.user_time, clock_snapshot.steady_clock_time_point,
+ clock_snapshot.user_context)};
result != RESULT_SUCCESS) {
return result;
}
@@ -157,9 +158,12 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
}
clock_snapshot.user_calendar_time = userCalendarInfo.time;
- clock_snapshot.user_calendar_additional_time = userCalendarInfo.additiona_info;
+ clock_snapshot.user_calendar_additional_time = userCalendarInfo.additional_info;
- if (Clock::ClockSnapshot::GetCurrentTime(clock_snapshot.network_time, current_time_point,
+ clock_snapshot.network_context = network_context;
+
+ if (Clock::ClockSnapshot::GetCurrentTime(clock_snapshot.network_time,
+ clock_snapshot.steady_clock_time_point,
clock_snapshot.network_context) != RESULT_SUCCESS) {
clock_snapshot.network_time = 0;
}
@@ -173,8 +177,7 @@ ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
}
clock_snapshot.network_calendar_time = networkCalendarInfo.time;
- clock_snapshot.network_calendar_additional_time = networkCalendarInfo.additiona_info;
- clock_snapshot.type = type;
+ clock_snapshot.network_calendar_additional_time = networkCalendarInfo.additional_info;
return RESULT_SUCCESS;
}
@@ -257,9 +260,10 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe
}
void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_Time, "called");
IPC::RequestParser rp{ctx};
- const auto type{rp.PopRaw<u8>()};
+ const auto type{rp.PopEnum<Clock::TimeType>()};
+
+ LOG_DEBUG(Service_Time, "called, type={}", type);
Clock::SystemClockContext user_context{};
if (const ResultCode result{
@@ -270,6 +274,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
rb.Push(result);
return;
}
+
Clock::SystemClockContext network_context{};
if (const ResultCode result{
system.GetTimeManager().GetStandardNetworkSystemClockCore().GetClockContext(
@@ -295,14 +300,16 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) {
- LOG_DEBUG(Service_Time, "called");
IPC::RequestParser rp{ctx};
- const auto type{rp.PopRaw<u8>()};
+ const auto type{rp.PopEnum<Clock::TimeType>()};
+
rp.AlignWithPadding();
const Clock::SystemClockContext user_context{rp.PopRaw<Clock::SystemClockContext>()};
const Clock::SystemClockContext network_context{rp.PopRaw<Clock::SystemClockContext>()};
+ LOG_DEBUG(Service_Time, "called, type={}", type);
+
Clock::ClockSnapshot clock_snapshot{};
if (const ResultCode result{GetClockSnapshotFromSystemClockContextInternal(
&ctx.GetThread(), user_context, network_context, type, clock_snapshot)};
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 4154c7ee9..ce9c479c6 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -40,7 +40,7 @@ public:
private:
ResultCode GetClockSnapshotFromSystemClockContextInternal(
Kernel::KThread* thread, Clock::SystemClockContext user_context,
- Clock::SystemClockContext network_context, u8 type,
+ Clock::SystemClockContext network_context, Clock::TimeType type,
Clock::ClockSnapshot& cloc_snapshot);
protected:
diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp
index 1f7309f6b..51becd074 100644
--- a/src/core/hle/service/time/time_manager.cpp
+++ b/src/core/hle/service/time/time_manager.cpp
@@ -44,7 +44,11 @@ struct TimeManager::Impl final {
const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())};
SetupStandardSteadyClock(system, Common::UUID::Generate(), system_time, {}, {});
SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds());
- SetupStandardNetworkSystemClock({}, standard_network_clock_accuracy);
+
+ Clock::SystemClockContext clock_context{};
+ standard_local_system_clock_core.GetClockContext(system, clock_context);
+
+ SetupStandardNetworkSystemClock(clock_context, standard_network_clock_accuracy);
SetupStandardUserSystemClock(system, {}, Clock::SteadyClockTimePoint::GetRandom());
SetupEphemeralNetworkSystemClock();
}
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp
index bdf0439f2..3032ca193 100644
--- a/src/core/hle/service/time/time_zone_manager.cpp
+++ b/src/core/hle/service/time/time_zone_manager.cpp
@@ -818,7 +818,7 @@ static ResultCode ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time,
static ResultCode ToCalendarTimeImpl(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) {
CalendarTimeInternal calendar_time{};
const ResultCode result{
- ToCalendarTimeInternal(rules, time, calendar_time, calendar.additiona_info)};
+ ToCalendarTimeInternal(rules, time, calendar_time, calendar.additional_info)};
calendar.time.year = static_cast<s16>(calendar_time.year);
// Internal impl. uses 0-indexed month
diff --git a/src/core/hle/service/time/time_zone_types.h b/src/core/hle/service/time/time_zone_types.h
index 4a57e036d..d39103253 100644
--- a/src/core/hle/service/time/time_zone_types.h
+++ b/src/core/hle/service/time/time_zone_types.h
@@ -66,8 +66,8 @@ struct CalendarTime {
static_assert(sizeof(CalendarTime) == 0x8, "CalendarTime is incorrect size");
struct CalendarInfo {
- CalendarTime time{};
- CalendarAdditionalInfo additiona_info{};
+ CalendarTime time;
+ CalendarAdditionalInfo additional_info;
};
static_assert(sizeof(CalendarInfo) == 0x20, "CalendarInfo is incorrect size");
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
index 1cc720ddd..14e5f36e2 100644
--- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp
+++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
@@ -143,7 +143,10 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
scheduler.WaitWorker();
- swapchain.AcquireNextImage();
+ while (!swapchain.AcquireNextImage()) {
+ swapchain.Create(layout.width, layout.height, is_srgb);
+ blit_screen.Recreate();
+ }
const VkSemaphore render_semaphore = blit_screen.Draw(*framebuffer, use_accelerated);
scheduler.Flush(render_semaphore);
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
index 668633e7b..8cb65e588 100644
--- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
@@ -176,7 +176,7 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset
u32 stride) {
if (device.IsExtExtendedDynamicStateSupported()) {
scheduler.Record([index, buffer, offset, size, stride](vk::CommandBuffer cmdbuf) {
- const VkDeviceSize vk_offset = offset;
+ const VkDeviceSize vk_offset = buffer != VK_NULL_HANDLE ? offset : 0;
const VkDeviceSize vk_size = buffer != VK_NULL_HANDLE ? size : VK_WHOLE_SIZE;
const VkDeviceSize vk_stride = stride;
cmdbuf.BindVertexBuffers2EXT(index, 1, &buffer, &vk_offset, &vk_size, &vk_stride);
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp
index 0b63bd6c8..dfd5c65ba 100644
--- a/src/video_core/renderer_vulkan/vk_swapchain.cpp
+++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp
@@ -82,11 +82,13 @@ void VKSwapchain::Create(u32 width, u32 height, bool srgb) {
resource_ticks.resize(image_count);
}
-void VKSwapchain::AcquireNextImage() {
- device.GetLogical().AcquireNextImageKHR(*swapchain, std::numeric_limits<u64>::max(),
- *present_semaphores[frame_index], {}, &image_index);
+bool VKSwapchain::AcquireNextImage() {
+ const VkResult result =
+ device.GetLogical().AcquireNextImageKHR(*swapchain, std::numeric_limits<u64>::max(),
+ *present_semaphores[frame_index], {}, &image_index);
scheduler.Wait(resource_ticks[image_index]);
+ return result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR;
}
bool VKSwapchain::Present(VkSemaphore render_semaphore) {
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.h b/src/video_core/renderer_vulkan/vk_swapchain.h
index a728511e0..adc8d27cf 100644
--- a/src/video_core/renderer_vulkan/vk_swapchain.h
+++ b/src/video_core/renderer_vulkan/vk_swapchain.h
@@ -28,7 +28,7 @@ public:
void Create(u32 width, u32 height, bool srgb);
/// Acquires the next image in the swapchain, waits as needed.
- void AcquireNextImage();
+ bool AcquireNextImage();
/// Presents the rendered image to the swapchain. Returns true when the swapchains had to be
/// recreated. Takes responsability for the ownership of fence.