early-access version 1390
This commit is contained in:
parent
817df4ca70
commit
ef74ce8ba1
10 changed files with 109 additions and 69 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1387.
|
This is the source code for early-access 1390.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,6 @@ struct UserCallbacks {
|
||||||
|
|
||||||
virtual void ExceptionRaised(VAddr pc, Exception exception) = 0;
|
virtual void ExceptionRaised(VAddr pc, Exception exception) = 0;
|
||||||
virtual void DataCacheOperationRaised(DataCacheOperation /*op*/, VAddr /*value*/) {}
|
virtual void DataCacheOperationRaised(DataCacheOperation /*op*/, VAddr /*value*/) {}
|
||||||
virtual void InstructionSynchronizationBarrierRaised() {}
|
|
||||||
|
|
||||||
// Timing-related callbacks
|
// Timing-related callbacks
|
||||||
// ticks ticks have passed
|
// ticks ticks have passed
|
||||||
|
@ -154,11 +153,6 @@ struct UserConfig {
|
||||||
/// Executing DC ZVA in this mode will result in zeros being written to memory.
|
/// Executing DC ZVA in this mode will result in zeros being written to memory.
|
||||||
bool hook_data_cache_operations = false;
|
bool hook_data_cache_operations = false;
|
||||||
|
|
||||||
/// When set to true, UserCallbacks::InstructionSynchronizationBarrierRaised will be
|
|
||||||
/// called when an ISB instruction is executed.
|
|
||||||
/// When set to false, ISB will be treated as a NOP instruction.
|
|
||||||
bool hook_isb = false;
|
|
||||||
|
|
||||||
/// When set to true, UserCallbacks::ExceptionRaised will be called when any hint
|
/// When set to true, UserCallbacks::ExceptionRaised will be called when any hint
|
||||||
/// instruction is executed.
|
/// instruction is executed.
|
||||||
bool hook_hint_instructions = false;
|
bool hook_hint_instructions = false;
|
||||||
|
|
|
@ -660,12 +660,10 @@ void A64EmitX64::EmitA64DataMemoryBarrier(A64EmitContext&, IR::Inst*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void A64EmitX64::EmitA64InstructionSynchronizationBarrier(A64EmitContext& ctx, IR::Inst* ) {
|
void A64EmitX64::EmitA64InstructionSynchronizationBarrier(A64EmitContext& ctx, IR::Inst* ) {
|
||||||
if (!conf.hook_isb) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.reg_alloc.HostCall(nullptr);
|
ctx.reg_alloc.HostCall(nullptr);
|
||||||
Devirtualize<&A64::UserCallbacks::InstructionSynchronizationBarrierRaised>(conf.callbacks).EmitCall(code);
|
|
||||||
|
code.mov(code.ABI_PARAM1, reinterpret_cast<u64>(jit_interface));
|
||||||
|
code.CallLambda([](A64::Jit* jit) { jit->ClearCache(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void A64EmitX64::EmitA64GetCNTFRQ(A64EmitContext& ctx, IR::Inst* inst) {
|
void A64EmitX64::EmitA64GetCNTFRQ(A64EmitContext& ctx, IR::Inst* inst) {
|
||||||
|
|
|
@ -338,6 +338,28 @@ std::size_t HLERequestContext::GetWriteBufferSize(std::size_t buffer_index) cons
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HLERequestContext::CanReadBuffer(std::size_t buffer_index) const {
|
||||||
|
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
||||||
|
BufferDescriptorA()[buffer_index].Size()};
|
||||||
|
|
||||||
|
if (is_buffer_a) {
|
||||||
|
return BufferDescriptorA().size() > buffer_index;
|
||||||
|
} else {
|
||||||
|
return BufferDescriptorX().size() > buffer_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HLERequestContext::CanWriteBuffer(std::size_t buffer_index) const {
|
||||||
|
const bool is_buffer_b{BufferDescriptorB().size() > buffer_index &&
|
||||||
|
BufferDescriptorB()[buffer_index].Size()};
|
||||||
|
|
||||||
|
if (is_buffer_b) {
|
||||||
|
return BufferDescriptorB().size() > buffer_index;
|
||||||
|
} else {
|
||||||
|
return BufferDescriptorC().size() > buffer_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string HLERequestContext::Description() const {
|
std::string HLERequestContext::Description() const {
|
||||||
if (!command_header) {
|
if (!command_header) {
|
||||||
return "No command header available";
|
return "No command header available";
|
||||||
|
|
|
@ -204,6 +204,12 @@ public:
|
||||||
/// Helper function to get the size of the output buffer
|
/// Helper function to get the size of the output buffer
|
||||||
std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
|
std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
|
/// Helper function to test whether the input buffer at buffer_index can be read
|
||||||
|
bool CanReadBuffer(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
|
/// Helper function to test whether the output buffer at buffer_index can be written
|
||||||
|
bool CanWriteBuffer(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::shared_ptr<T> GetCopyObject(std::size_t index) {
|
std::shared_ptr<T> GetCopyObject(std::size_t index) {
|
||||||
return DynamicObjectCast<T>(copy_objects.at(index));
|
return DynamicObjectCast<T>(copy_objects.at(index));
|
||||||
|
|
|
@ -946,20 +946,19 @@ void Controller_NPad::SetSixAxisEnabled(bool six_axis_status) {
|
||||||
sixaxis_sensors_enabled = six_axis_status;
|
sixaxis_sensors_enabled = six_axis_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_NPad::SetSixAxisFusionParameters(const DeviceHandle& handle, f32 parameter1,
|
void Controller_NPad::SetSixAxisFusionParameters(f32 parameter1, f32 parameter2) {
|
||||||
f32 parameter2) {
|
|
||||||
sixaxis_fusion_parameter1 = parameter1;
|
sixaxis_fusion_parameter1 = parameter1;
|
||||||
sixaxis_fusion_parameter2 = parameter2;
|
sixaxis_fusion_parameter2 = parameter2;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters(const DeviceHandle& handle) {
|
std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters() {
|
||||||
return {
|
return {
|
||||||
sixaxis_fusion_parameter1,
|
sixaxis_fusion_parameter1,
|
||||||
sixaxis_fusion_parameter2,
|
sixaxis_fusion_parameter2,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_NPad::ResetSixAxisFusionParameters(const DeviceHandle& handle) {
|
void Controller_NPad::ResetSixAxisFusionParameters() {
|
||||||
sixaxis_fusion_parameter1 = 0.0f;
|
sixaxis_fusion_parameter1 = 0.0f;
|
||||||
sixaxis_fusion_parameter2 = 0.0f;
|
sixaxis_fusion_parameter2 = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,9 +202,9 @@ public:
|
||||||
GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;
|
GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;
|
||||||
bool IsSixAxisSensorAtRest() const;
|
bool IsSixAxisSensorAtRest() const;
|
||||||
void SetSixAxisEnabled(bool six_axis_status);
|
void SetSixAxisEnabled(bool six_axis_status);
|
||||||
void SetSixAxisFusionParameters(const DeviceHandle& handle, f32 parameter1, f32 parameter2);
|
void SetSixAxisFusionParameters(f32 parameter1, f32 parameter2);
|
||||||
std::pair<f32, f32> GetSixAxisFusionParameters(const DeviceHandle& handle);
|
std::pair<f32, f32> GetSixAxisFusionParameters();
|
||||||
void ResetSixAxisFusionParameters(const DeviceHandle& handle);
|
void ResetSixAxisFusionParameters();
|
||||||
LedPattern GetLedPattern(u32 npad_id);
|
LedPattern GetLedPattern(u32 npad_id);
|
||||||
bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
|
bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
|
||||||
void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
|
void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
|
||||||
|
|
|
@ -520,6 +520,7 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) {
|
||||||
Controller_NPad::DeviceHandle sixaxis_handle;
|
Controller_NPad::DeviceHandle sixaxis_handle;
|
||||||
u64 applet_resource_user_id;
|
u64 applet_resource_user_id;
|
||||||
};
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
@ -542,19 +543,19 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
|
||||||
f32 parameter2;
|
f32 parameter2;
|
||||||
u64 applet_resource_user_id;
|
u64 applet_resource_user_id;
|
||||||
};
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size.");
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
.SetSixAxisFusionParameters(parameters.sixaxis_handle, parameters.parameter1,
|
.SetSixAxisFusionParameters(parameters.parameter1, parameters.parameter2);
|
||||||
parameters.parameter2);
|
|
||||||
|
|
||||||
LOG_WARNING(Service_HID,
|
LOG_WARNING(Service_HID,
|
||||||
"(STUBBED) called, float1={}, float2={}, npad_type={}, npad_id={}, "
|
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, parameter1={}, "
|
||||||
"device_index={}, applet_resource_user_id={}",
|
"parameter2={}, applet_resource_user_id={}",
|
||||||
parameters.parameter1, parameters.parameter2, parameters.sixaxis_handle.npad_type,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index,
|
parameters.sixaxis_handle.device_index, parameters.parameter1,
|
||||||
parameters.applet_resource_user_id);
|
parameters.parameter2, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -566,6 +567,7 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
|
||||||
Controller_NPad::DeviceHandle sixaxis_handle;
|
Controller_NPad::DeviceHandle sixaxis_handle;
|
||||||
u64 applet_resource_user_id;
|
u64 applet_resource_user_id;
|
||||||
};
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
f32 parameter1 = 0;
|
f32 parameter1 = 0;
|
||||||
f32 parameter2 = 0;
|
f32 parameter2 = 0;
|
||||||
|
@ -573,11 +575,11 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
std::tie(parameter1, parameter2) =
|
std::tie(parameter1, parameter2) =
|
||||||
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
.GetSixAxisFusionParameters(parameters.sixaxis_handle);
|
.GetSixAxisFusionParameters();
|
||||||
|
|
||||||
LOG_WARNING(Service_HID,
|
LOG_WARNING(
|
||||||
"(STUBBED) called, npad_type={}, npad_id={}, "
|
Service_HID,
|
||||||
"device_index={}, applet_resource_user_id={}",
|
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
|
||||||
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
@ -593,15 +595,16 @@ void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
|
||||||
Controller_NPad::DeviceHandle sixaxis_handle;
|
Controller_NPad::DeviceHandle sixaxis_handle;
|
||||||
u64 applet_resource_user_id;
|
u64 applet_resource_user_id;
|
||||||
};
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
.ResetSixAxisFusionParameters(parameters.sixaxis_handle);
|
.ResetSixAxisFusionParameters();
|
||||||
|
|
||||||
LOG_WARNING(Service_HID,
|
LOG_WARNING(
|
||||||
"(STUBBED) called, npad_type={}, npad_id={}, "
|
Service_HID,
|
||||||
"device_index={}, applet_resource_user_id={}",
|
"(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
|
||||||
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
|
||||||
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ public:
|
||||||
{10101, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::Old>, "SaveReportWithUserOld"},
|
{10101, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::Old>, "SaveReportWithUserOld"},
|
||||||
{10102, &PlayReport::SaveReport<Core::Reporter::PlayReportType::Old2>, "SaveReportOld2"},
|
{10102, &PlayReport::SaveReport<Core::Reporter::PlayReportType::Old2>, "SaveReportOld2"},
|
||||||
{10103, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::Old2>, "SaveReportWithUserOld2"},
|
{10103, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::Old2>, "SaveReportWithUserOld2"},
|
||||||
{10104, nullptr, "SaveReport"},
|
{10104, &PlayReport::SaveReport<Core::Reporter::PlayReportType::New>, "SaveReport"},
|
||||||
{10105, nullptr, "SaveReportWithUser"},
|
{10105, &PlayReport::SaveReportWithUser<Core::Reporter::PlayReportType::New>, "SaveReportWithUser"},
|
||||||
{10200, nullptr, "RequestImmediateTransmission"},
|
{10200, nullptr, "RequestImmediateTransmission"},
|
||||||
{10300, nullptr, "GetTransmissionStatus"},
|
{10300, nullptr, "GetTransmissionStatus"},
|
||||||
{10400, nullptr, "GetSystemSessionId"},
|
{10400, nullptr, "GetSystemSessionId"},
|
||||||
|
@ -59,16 +59,22 @@ private:
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto process_id = rp.PopRaw<u64>();
|
const auto process_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
std::vector<std::vector<u8>> data{ctx.ReadBuffer(0)};
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
if constexpr (Type == Core::Reporter::PlayReportType::Old2) {
|
const auto data2 = [ctx] {
|
||||||
data.emplace_back(ctx.ReadBuffer(1));
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO, "called, type={:02X}, process_id={:016X}, data1_size={:016X}",
|
return std::vector<u8>{};
|
||||||
Type, process_id, data[0].size());
|
}();
|
||||||
|
|
||||||
|
LOG_DEBUG(Service_PREPO,
|
||||||
|
"called, type={:02X}, process_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
||||||
|
Type, process_id, data1.size(), data2.size());
|
||||||
|
|
||||||
const auto& reporter{system.GetReporter()};
|
const auto& reporter{system.GetReporter()};
|
||||||
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id);
|
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), {data1, data2},
|
||||||
|
process_id);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -79,24 +85,24 @@ private:
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto user_id = rp.PopRaw<u128>();
|
const auto user_id = rp.PopRaw<u128>();
|
||||||
const auto process_id = rp.PopRaw<u64>();
|
const auto process_id = rp.PopRaw<u64>();
|
||||||
std::vector<std::vector<u8>> data{ctx.ReadBuffer(0)};
|
|
||||||
|
|
||||||
if constexpr (Type == Core::Reporter::PlayReportType::Old2) {
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto read_buffer_count =
|
const auto data2 = [ctx] {
|
||||||
ctx.BufferDescriptorX().size() + ctx.BufferDescriptorA().size();
|
if (ctx.CanReadBuffer(1)) {
|
||||||
if (read_buffer_count > 1) {
|
return ctx.ReadBuffer(1);
|
||||||
data.emplace_back(ctx.ReadBuffer(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG(
|
return std::vector<u8>{};
|
||||||
Service_PREPO,
|
}();
|
||||||
"called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, data1_size={:016X}",
|
|
||||||
Type, user_id[1], user_id[0], process_id, data[0].size());
|
LOG_DEBUG(Service_PREPO,
|
||||||
|
"called, type={:02X}, user_id={:016X}{:016X}, process_id={:016X}, "
|
||||||
|
"data1_size={:016X}, data2_size={:016X}",
|
||||||
|
Type, user_id[1], user_id[0], process_id, data1.size(), data2.size());
|
||||||
|
|
||||||
const auto& reporter{system.GetReporter()};
|
const auto& reporter{system.GetReporter()};
|
||||||
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), data, process_id,
|
reporter.SavePlayReport(Type, system.CurrentProcess()->GetTitleID(), {data1, data2},
|
||||||
user_id);
|
process_id, user_id);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
@ -107,7 +113,13 @@ private:
|
||||||
const auto title_id = rp.PopRaw<u64>();
|
const auto title_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
const auto data1 = ctx.ReadBuffer(0);
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto data2 = ctx.ReadBuffer(1);
|
const auto data2 = [ctx] {
|
||||||
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::vector<u8>{};
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
||||||
title_id, data1.size(), data2.size());
|
title_id, data1.size(), data2.size());
|
||||||
|
@ -125,7 +137,13 @@ private:
|
||||||
const auto title_id = rp.PopRaw<u64>();
|
const auto title_id = rp.PopRaw<u64>();
|
||||||
|
|
||||||
const auto data1 = ctx.ReadBuffer(0);
|
const auto data1 = ctx.ReadBuffer(0);
|
||||||
const auto data2 = ctx.ReadBuffer(1);
|
const auto data2 = [ctx] {
|
||||||
|
if (ctx.CanReadBuffer(1)) {
|
||||||
|
return ctx.ReadBuffer(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::vector<u8>{};
|
||||||
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
"called, user_id={:016X}{:016X}, title_id={:016X}, data1_size={:016X}, "
|
"called, user_id={:016X}{:016X}, title_id={:016X}, data1_size={:016X}, "
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include "common/alignment.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/threadsafe_queue.h"
|
#include "common/threadsafe_queue.h"
|
||||||
#include "video_core/renderer_vulkan/vk_master_semaphore.h"
|
#include "video_core/renderer_vulkan/vk_master_semaphore.h"
|
||||||
|
@ -136,12 +138,11 @@ private:
|
||||||
using FuncType = TypedCommand<T>;
|
using FuncType = TypedCommand<T>;
|
||||||
static_assert(sizeof(FuncType) < sizeof(data), "Lambda is too large");
|
static_assert(sizeof(FuncType) < sizeof(data), "Lambda is too large");
|
||||||
|
|
||||||
|
command_offset = Common::AlignUp(command_offset, alignof(FuncType));
|
||||||
if (command_offset > sizeof(data) - sizeof(FuncType)) {
|
if (command_offset > sizeof(data) - sizeof(FuncType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Command* const current_last = last;
|
||||||
Command* current_last = last;
|
|
||||||
|
|
||||||
last = new (data.data() + command_offset) FuncType(std::move(command));
|
last = new (data.data() + command_offset) FuncType(std::move(command));
|
||||||
|
|
||||||
if (current_last) {
|
if (current_last) {
|
||||||
|
@ -149,7 +150,6 @@ private:
|
||||||
} else {
|
} else {
|
||||||
first = last;
|
first = last;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_offset += sizeof(FuncType);
|
command_offset += sizeof(FuncType);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +162,8 @@ private:
|
||||||
Command* first = nullptr;
|
Command* first = nullptr;
|
||||||
Command* last = nullptr;
|
Command* last = nullptr;
|
||||||
|
|
||||||
std::size_t command_offset = 0;
|
size_t command_offset = 0;
|
||||||
std::array<u8, 0x8000> data{};
|
alignas(std::max_align_t) std::array<u8, 0x8000> data{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
|
|
Loading…
Reference in a new issue