early-access version 3583

This commit is contained in:
pineappleEA 2023-05-12 04:52:02 +02:00
parent cf35b9c846
commit 8bee2e20b4
6 changed files with 38 additions and 4 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3582. This is the source code for early-access 3583.
## Legal Notice ## Legal Notice

View File

@ -61,6 +61,18 @@ static_assert(sizeof(SystemClockContext) == 0x20, "SystemClockContext is incorre
static_assert(std::is_trivially_copyable_v<SystemClockContext>, static_assert(std::is_trivially_copyable_v<SystemClockContext>,
"SystemClockContext must be trivially copyable"); "SystemClockContext must be trivially copyable");
struct ContinuousAdjustmentTimePoint {
s64 measurement_offset;
s64 diff_scale;
u32 shift_amount;
s64 lower;
s64 upper;
Common::UUID clock_source_id;
};
static_assert(sizeof(ContinuousAdjustmentTimePoint) == 0x38);
static_assert(std::is_trivially_copyable_v<ContinuousAdjustmentTimePoint>,
"ContinuousAdjustmentTimePoint must be trivially copyable");
/// https://switchbrew.org/wiki/Glue_services#TimeSpanType /// https://switchbrew.org/wiki/Glue_services#TimeSpanType
struct TimeSpanType { struct TimeSpanType {
s64 nanoseconds{}; s64 nanoseconds{};

View File

@ -31,6 +31,25 @@ void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id,
} }
void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) { void SharedMemory::UpdateLocalSystemClockContext(const Clock::SystemClockContext& context) {
// lower and upper are related to the measurement point for the steady time point,
// and compare equal on boot
const s64 time_point_ns = context.steady_time_point.time_point * 1'000'000'000LL;
// This adjusts for some sort of time skew
// Both 0 on boot
const s64 diff_scale = 0;
const u32 shift_amount = 0;
const Clock::ContinuousAdjustmentTimePoint adjustment{
.measurement_offset = system.CoreTiming().GetGlobalTimeNs().count(),
.diff_scale = diff_scale,
.shift_amount = shift_amount,
.lower = time_point_ns,
.upper = time_point_ns,
.clock_source_id = context.steady_time_point.clock_source_id,
};
StoreToLockFreeAtomicType(&GetFormat()->continuous_adjustment_timepoint, adjustment);
StoreToLockFreeAtomicType(&GetFormat()->standard_local_system_clock_context, context); StoreToLockFreeAtomicType(&GetFormat()->standard_local_system_clock_context, context);
} }

View File

@ -65,14 +65,15 @@ public:
LockFreeAtomicType<Clock::SystemClockContext> standard_local_system_clock_context; LockFreeAtomicType<Clock::SystemClockContext> standard_local_system_clock_context;
LockFreeAtomicType<Clock::SystemClockContext> standard_network_system_clock_context; LockFreeAtomicType<Clock::SystemClockContext> standard_network_system_clock_context;
LockFreeAtomicType<bool> is_standard_user_system_clock_automatic_correction_enabled; LockFreeAtomicType<bool> is_standard_user_system_clock_automatic_correction_enabled;
u32 format_version; LockFreeAtomicType<Clock::ContinuousAdjustmentTimePoint> continuous_adjustment_timepoint;
}; };
static_assert(offsetof(Format, standard_steady_clock_timepoint) == 0x0); static_assert(offsetof(Format, standard_steady_clock_timepoint) == 0x0);
static_assert(offsetof(Format, standard_local_system_clock_context) == 0x38); static_assert(offsetof(Format, standard_local_system_clock_context) == 0x38);
static_assert(offsetof(Format, standard_network_system_clock_context) == 0x80); static_assert(offsetof(Format, standard_network_system_clock_context) == 0x80);
static_assert(offsetof(Format, is_standard_user_system_clock_automatic_correction_enabled) == static_assert(offsetof(Format, is_standard_user_system_clock_automatic_correction_enabled) ==
0xc8); 0xc8);
static_assert(sizeof(Format) == 0xd8, "Format is an invalid size"); static_assert(offsetof(Format, continuous_adjustment_timepoint) == 0xd0);
static_assert(sizeof(Format) == 0x148, "Format is an invalid size");
void SetupStandardSteadyClock(const Common::UUID& clock_source_id, void SetupStandardSteadyClock(const Common::UUID& clock_source_id,
Clock::TimeSpanType current_time_point); Clock::TimeSpanType current_time_point);

View File

@ -1864,6 +1864,7 @@ void Framebuffer::CreateFramebuffer(TextureCacheRuntime& runtime,
num_layers = std::max(num_layers, color_buffer->range.extent.layers); num_layers = std::max(num_layers, color_buffer->range.extent.layers);
images[num_images] = color_buffer->ImageHandle(); images[num_images] = color_buffer->ImageHandle();
image_ranges[num_images] = MakeSubresourceRange(color_buffer); image_ranges[num_images] = MakeSubresourceRange(color_buffer);
rt_map[index] = num_images;
samples = color_buffer->Samples(); samples = color_buffer->Samples();
++num_images; ++num_images;
} }

View File

@ -334,7 +334,7 @@ public:
} }
[[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept { [[nodiscard]] bool HasAspectColorBit(size_t index) const noexcept {
return (image_ranges.at(index).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0; return (image_ranges.at(rt_map[index]).aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
} }
[[nodiscard]] bool HasAspectDepthBit() const noexcept { [[nodiscard]] bool HasAspectDepthBit() const noexcept {
@ -354,6 +354,7 @@ private:
u32 num_images = 0; u32 num_images = 0;
std::array<VkImage, 9> images{}; std::array<VkImage, 9> images{};
std::array<VkImageSubresourceRange, 9> image_ranges{}; std::array<VkImageSubresourceRange, 9> image_ranges{};
std::array<size_t, NUM_RT> rt_map{};
bool has_depth{}; bool has_depth{};
bool has_stencil{}; bool has_stencil{};
}; };