mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2025-08-29 23:41:14 +00:00
Compare commits
3 commits
master
...
mainline-0
Author | SHA1 | Date | |
---|---|---|---|
|
5aab1b86c6 | ||
|
949e34b714 | ||
|
705871d67c |
|
@ -11,6 +11,7 @@
|
|||
#include "common/fs/path_util.h"
|
||||
#include "common/polyfill_ranges.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
|
||||
namespace Service::Account {
|
||||
|
@ -164,6 +165,22 @@ std::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user)
|
|||
return GetUserIndex(user.user_uuid);
|
||||
}
|
||||
|
||||
/// Returns the first user profile seen based on username (which does not enforce uniqueness)
|
||||
std::optional<std::size_t> ProfileManager::GetUserIndex(const std::string& username) const {
|
||||
const auto iter =
|
||||
std::find_if(profiles.begin(), profiles.end(), [&username](const ProfileInfo& p) {
|
||||
const std::string profile_username = Common::StringFromFixedZeroTerminatedBuffer(
|
||||
reinterpret_cast<const char*>(p.username.data()), p.username.size());
|
||||
|
||||
return username.compare(profile_username) == 0;
|
||||
});
|
||||
if (iter == profiles.end()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return static_cast<std::size_t>(std::distance(profiles.begin(), iter));
|
||||
}
|
||||
|
||||
/// Returns the data structure used by the switch when GetProfileBase is called on acc:*
|
||||
bool ProfileManager::GetProfileBase(std::optional<std::size_t> index, ProfileBase& profile) const {
|
||||
if (!index || index >= MAX_USERS) {
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
std::optional<Common::UUID> GetUser(std::size_t index) const;
|
||||
std::optional<std::size_t> GetUserIndex(const Common::UUID& uuid) const;
|
||||
std::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const;
|
||||
std::optional<std::size_t> GetUserIndex(const std::string& username) const;
|
||||
bool GetProfileBase(std::optional<std::size_t> index, ProfileBase& profile) const;
|
||||
bool GetProfileBase(Common::UUID uuid, ProfileBase& profile) const;
|
||||
bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const;
|
||||
|
|
|
@ -329,7 +329,7 @@ void PresentManager::CopyToSwapchainImpl(Frame* frame) {
|
|||
// to account for that.
|
||||
const bool is_suboptimal = swapchain.NeedsRecreation();
|
||||
const bool size_changed =
|
||||
swapchain.GetWidth() < frame->width || swapchain.GetHeight() < frame->height;
|
||||
swapchain.GetWidth() != frame->width || swapchain.GetHeight() != frame->height;
|
||||
if (is_suboptimal || size_changed) {
|
||||
RecreateSwapchain(frame);
|
||||
}
|
||||
|
|
|
@ -1043,37 +1043,16 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
|
|||
regs.zeta.format == Tegra::DepthFormat::X8Z24_UNORM ||
|
||||
regs.zeta.format == Tegra::DepthFormat::S8Z24_UNORM ||
|
||||
regs.zeta.format == Tegra::DepthFormat::V8Z24_UNORM;
|
||||
bool force_unorm = ([&] {
|
||||
if (!is_d24 || device.SupportsD24DepthBuffer()) {
|
||||
return false;
|
||||
}
|
||||
if (device.IsExtDepthBiasControlSupported()) {
|
||||
return true;
|
||||
}
|
||||
if (!Settings::values.renderer_amdvlk_depth_bias_workaround) {
|
||||
return false;
|
||||
}
|
||||
if (is_d24 && !device.SupportsD24DepthBuffer() &&
|
||||
Settings::values.renderer_amdvlk_depth_bias_workaround) {
|
||||
// the base formulas can be obtained from here:
|
||||
// https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-output-merger-stage-depth-bias
|
||||
const double rescale_factor =
|
||||
static_cast<double>(1ULL << (32 - 24)) / (static_cast<double>(0x1.ep+127));
|
||||
units = static_cast<float>(static_cast<double>(units) * rescale_factor);
|
||||
return false;
|
||||
})();
|
||||
}
|
||||
scheduler.Record([constant = units, clamp = regs.depth_bias_clamp,
|
||||
factor = regs.slope_scale_depth_bias, force_unorm,
|
||||
precise = device.HasExactDepthBiasControl()](vk::CommandBuffer cmdbuf) {
|
||||
if (force_unorm) {
|
||||
VkDepthBiasRepresentationInfoEXT info{
|
||||
.sType = VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT,
|
||||
.pNext = nullptr,
|
||||
.depthBiasRepresentation =
|
||||
VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT,
|
||||
.depthBiasExact = precise ? VK_TRUE : VK_FALSE,
|
||||
};
|
||||
cmdbuf.SetDepthBias(constant, clamp, factor, &info);
|
||||
return;
|
||||
}
|
||||
factor = regs.slope_scale_depth_bias](vk::CommandBuffer cmdbuf) {
|
||||
cmdbuf.SetDepthBias(constant, clamp, factor);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1135,13 +1135,6 @@ void Device::RemoveUnsuitableExtensions() {
|
|||
RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color,
|
||||
VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
|
||||
|
||||
// VK_EXT_depth_bias_control
|
||||
extensions.depth_bias_control =
|
||||
features.depth_bias_control.depthBiasControl &&
|
||||
features.depth_bias_control.leastRepresentableValueForceUnormRepresentation;
|
||||
RemoveExtensionFeatureIfUnsuitable(extensions.depth_bias_control, features.depth_bias_control,
|
||||
VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME);
|
||||
|
||||
// VK_EXT_depth_clip_control
|
||||
extensions.depth_clip_control = features.depth_clip_control.depthClipControl;
|
||||
RemoveExtensionFeatureIfUnsuitable(extensions.depth_clip_control, features.depth_clip_control,
|
||||
|
|
|
@ -41,7 +41,6 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
|||
// Define all features which may be used by the implementation and require an extension here.
|
||||
#define FOR_EACH_VK_FEATURE_EXT(FEATURE) \
|
||||
FEATURE(EXT, CustomBorderColor, CUSTOM_BORDER_COLOR, custom_border_color) \
|
||||
FEATURE(EXT, DepthBiasControl, DEPTH_BIAS_CONTROL, depth_bias_control) \
|
||||
FEATURE(EXT, DepthClipControl, DEPTH_CLIP_CONTROL, depth_clip_control) \
|
||||
FEATURE(EXT, ExtendedDynamicState, EXTENDED_DYNAMIC_STATE, extended_dynamic_state) \
|
||||
FEATURE(EXT, ExtendedDynamicState2, EXTENDED_DYNAMIC_STATE_2, extended_dynamic_state2) \
|
||||
|
@ -97,7 +96,6 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
|||
#define FOR_EACH_VK_RECOMMENDED_EXTENSION(EXTENSION_NAME) \
|
||||
EXTENSION_NAME(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME) \
|
||||
EXTENSION_NAME(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME) \
|
||||
EXTENSION_NAME(VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME) \
|
||||
EXTENSION_NAME(VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME) \
|
||||
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME) \
|
||||
EXTENSION_NAME(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME) \
|
||||
|
@ -150,9 +148,6 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
|||
// Define features where the absence of the feature may result in a degraded experience.
|
||||
#define FOR_EACH_VK_RECOMMENDED_FEATURE(FEATURE_NAME) \
|
||||
FEATURE_NAME(custom_border_color, customBorderColors) \
|
||||
FEATURE_NAME(depth_bias_control, depthBiasControl) \
|
||||
FEATURE_NAME(depth_bias_control, leastRepresentableValueForceUnormRepresentation) \
|
||||
FEATURE_NAME(depth_bias_control, depthBiasExact) \
|
||||
FEATURE_NAME(extended_dynamic_state, extendedDynamicState) \
|
||||
FEATURE_NAME(format_a4b4g4r4, formatA4B4G4R4) \
|
||||
FEATURE_NAME(index_type_uint8, indexTypeUint8) \
|
||||
|
@ -479,11 +474,6 @@ public:
|
|||
return extensions.depth_clip_control;
|
||||
}
|
||||
|
||||
/// Returns true if the device supports VK_EXT_depth_bias_control.
|
||||
bool IsExtDepthBiasControlSupported() const {
|
||||
return extensions.depth_bias_control;
|
||||
}
|
||||
|
||||
/// Returns true if the device supports VK_EXT_shader_viewport_index_layer.
|
||||
bool IsExtShaderViewportIndexLayerSupported() const {
|
||||
return extensions.shader_viewport_index_layer;
|
||||
|
@ -649,10 +639,6 @@ public:
|
|||
return features.robustness2.nullDescriptor;
|
||||
}
|
||||
|
||||
bool HasExactDepthBiasControl() const {
|
||||
return features.depth_bias_control.depthBiasExact;
|
||||
}
|
||||
|
||||
u32 GetMaxVertexInputAttributes() const {
|
||||
return properties.properties.limits.maxVertexInputAttributes;
|
||||
}
|
||||
|
|
|
@ -518,12 +518,21 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
|
|||
continue;
|
||||
}
|
||||
|
||||
int user_arg_idx = ++i;
|
||||
bool argument_ok;
|
||||
const std::size_t selected_user = args[++i].toUInt(&argument_ok);
|
||||
std::size_t selected_user = args[user_arg_idx].toUInt(&argument_ok);
|
||||
|
||||
if (!argument_ok) {
|
||||
LOG_ERROR(Frontend, "Invalid user argument");
|
||||
continue;
|
||||
// try to look it up by username, only finds the first username that matches.
|
||||
const std::string user_arg_str = args[user_arg_idx].toStdString();
|
||||
const auto user_idx = system->GetProfileManager().GetUserIndex(user_arg_str);
|
||||
|
||||
if (user_idx == std::nullopt) {
|
||||
LOG_ERROR(Frontend, "Invalid user argument");
|
||||
continue;
|
||||
}
|
||||
|
||||
selected_user = user_idx.value();
|
||||
}
|
||||
|
||||
if (!system->GetProfileManager().UserExistsIndex(selected_user)) {
|
||||
|
@ -532,6 +541,8 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
|
|||
}
|
||||
|
||||
Settings::values.current_user = static_cast<s32>(selected_user);
|
||||
|
||||
user_flag_cmd_line = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1942,7 +1953,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
|||
|
||||
Settings::LogSettings();
|
||||
|
||||
if (UISettings::values.select_user_on_boot) {
|
||||
if (UISettings::values.select_user_on_boot && !user_flag_cmd_line) {
|
||||
const Core::Frontend::ProfileSelectParameters parameters{
|
||||
.mode = Service::AM::Applets::UiMode::UserSelector,
|
||||
.invalid_uid_list = {},
|
||||
|
@ -1954,6 +1965,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
|
|||
}
|
||||
}
|
||||
|
||||
// If the user specifies -u (successfully) on the cmd line, don't prompt for a user on first
|
||||
// game startup only. If the user stops emulation and starts a new one, go back to the expected
|
||||
// behavior of asking.
|
||||
user_flag_cmd_line = false;
|
||||
|
||||
if (!LoadROM(filename, program_id, program_index, launch_type)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -523,6 +523,8 @@ private:
|
|||
std::unique_ptr<EmuThread> emu_thread;
|
||||
// The path to the game currently running
|
||||
QString current_game_path;
|
||||
// Whether a user was set on the command line (skips UserSelector if it's forced to show up)
|
||||
bool user_flag_cmd_line = false;
|
||||
|
||||
bool auto_paused = false;
|
||||
bool auto_muted = false;
|
||||
|
|
Loading…
Reference in a new issue