mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82e5f80f11 | ||
|
|
44ba9e283e | ||
|
|
0244cde98d | ||
|
|
d75612e4c9 | ||
|
|
cbfc838aab | ||
|
|
6a760e05a8 | ||
|
|
5278477de9 | ||
|
|
0da84c2c69 |
@@ -7,9 +7,9 @@
|
||||
|
||||
// Template function for casting enumerations to their underlying type
|
||||
template <typename Enumeration>
|
||||
typename std::underlying_type<Enumeration>::type enum_cast(Enumeration E)
|
||||
std::underlying_type_t<Enumeration> enum_cast(Enumeration E)
|
||||
{
|
||||
return static_cast<typename std::underlying_type<Enumeration>::type>(E);
|
||||
return static_cast<typename std::underlying_type_t<Enumeration>>(E);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
@@ -25,67 +25,67 @@ namespace detail
|
||||
Enum value;
|
||||
constexpr enum_bool_helper(Enum value): value(value) {}
|
||||
constexpr operator Enum() const { return value; }
|
||||
constexpr operator bool() const { return static_cast<bool>(static_cast<typename std::underlying_type<Enum>::type>(value)); }
|
||||
constexpr operator bool() const { return static_cast<bool>(static_cast<std::underlying_type_t<Enum>>(value)); }
|
||||
};
|
||||
};
|
||||
|
||||
#define MARK_ENUM_AS_FLAGS(T) template<> struct detail::enum_is_flags<T> : public std::true_type {}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, Enum>::type
|
||||
operator|(Enum lhs, Enum rhs) noexcept
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr Enum operator|(Enum lhs, Enum rhs) noexcept
|
||||
{
|
||||
using underlying = typename std::underlying_type<Enum>::type;
|
||||
using underlying = std::underlying_type_t<Enum>;
|
||||
return static_cast<Enum>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, detail::enum_bool_helper<Enum>>::type
|
||||
operator&(Enum lhs, Enum rhs) noexcept
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr detail::enum_bool_helper<Enum> operator&(Enum lhs, Enum rhs) noexcept
|
||||
{
|
||||
using underlying = typename std::underlying_type<Enum>::type;
|
||||
using underlying = std::underlying_type_t<Enum>;
|
||||
return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, Enum>::type
|
||||
operator^(Enum lhs, Enum rhs) noexcept
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr Enum operator^(Enum lhs, Enum rhs) noexcept
|
||||
{
|
||||
using underlying = typename std::underlying_type<Enum>::type;
|
||||
using underlying = std::underlying_type_t<Enum>;
|
||||
return static_cast<Enum>(static_cast<underlying>(lhs) ^ static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, Enum&>::type
|
||||
operator|=(Enum& lhs, Enum rhs) noexcept
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr Enum& operator|=(Enum& lhs, Enum rhs) noexcept
|
||||
{
|
||||
return lhs = lhs | rhs;
|
||||
}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, Enum&>::type
|
||||
operator&=(Enum& lhs, Enum rhs) noexcept
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr Enum& operator&=(Enum& lhs, Enum rhs) noexcept
|
||||
{
|
||||
return lhs = lhs & rhs;
|
||||
}
|
||||
|
||||
template <typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, Enum&>::type
|
||||
operator^=(Enum& lhs, Enum rhs) noexcept
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr Enum& operator^=(Enum& lhs, Enum rhs) noexcept
|
||||
{
|
||||
return lhs = lhs ^ rhs;
|
||||
}
|
||||
|
||||
template<typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, bool>::type
|
||||
operator!(Enum e) noexcept
|
||||
template <typename Enum>
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr bool operator!(Enum e) noexcept
|
||||
{
|
||||
return !static_cast<typename std::underlying_type<Enum>::type>(e);
|
||||
return !static_cast<std::underlying_type_t<Enum>>(e);
|
||||
}
|
||||
|
||||
template<typename Enum>
|
||||
constexpr typename std::enable_if<detail::enum_is_flags<Enum>::value, Enum>::type
|
||||
operator~(Enum e) noexcept
|
||||
template <typename Enum>
|
||||
requires detail::enum_is_flags<Enum>::value
|
||||
constexpr Enum operator~(Enum e) noexcept
|
||||
{
|
||||
return static_cast<Enum>(~static_cast<typename std::underlying_type<Enum>::type>(e));
|
||||
return static_cast<Enum>(~static_cast<std::underlying_type_t<Enum>>(e));
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// Platform-specific includes
|
||||
#if defined(_WIN32)
|
||||
#include "RedtapeWindows.h"
|
||||
static_assert(std::is_same<DWORD, unsigned long>::value, "DWORD is unsigned long");
|
||||
static_assert(std::is_same<HRESULT, long>::value, "HRESULT is long");
|
||||
static_assert(std::is_same_v<DWORD, unsigned long>, "DWORD is unsigned long");
|
||||
static_assert(std::is_same_v<HRESULT, long>, "HRESULT is long");
|
||||
#endif
|
||||
|
||||
Error::Error() = default;
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace StringUtil
|
||||
}
|
||||
|
||||
/// Wrapper around std::from_chars
|
||||
template <typename T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T>
|
||||
inline std::optional<T> FromChars(const std::string_view str, int base = 10)
|
||||
{
|
||||
T value;
|
||||
@@ -86,7 +87,8 @@ namespace StringUtil
|
||||
|
||||
return value;
|
||||
}
|
||||
template <typename T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T>
|
||||
inline std::optional<T> FromChars(const std::string_view str, int base, std::string_view* endptr)
|
||||
{
|
||||
T value;
|
||||
@@ -103,7 +105,8 @@ namespace StringUtil
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
|
||||
template <typename T>
|
||||
requires std::is_floating_point_v<T>
|
||||
inline std::optional<T> FromChars(const std::string_view str)
|
||||
{
|
||||
T value;
|
||||
@@ -114,7 +117,8 @@ namespace StringUtil
|
||||
|
||||
return value;
|
||||
}
|
||||
template <typename T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
|
||||
template <typename T>
|
||||
requires std::is_floating_point_v<T>
|
||||
inline std::optional<T> FromChars(const std::string_view str, std::string_view* endptr)
|
||||
{
|
||||
T value;
|
||||
@@ -132,7 +136,8 @@ namespace StringUtil
|
||||
}
|
||||
|
||||
/// Wrapper around std::to_chars
|
||||
template <typename T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T>
|
||||
inline std::string ToChars(T value, int base = 10)
|
||||
{
|
||||
// to_chars() requires macOS 10.15+.
|
||||
@@ -154,7 +159,8 @@ namespace StringUtil
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
|
||||
template <typename T>
|
||||
requires std::is_floating_point_v<T>
|
||||
inline std::string ToChars(T value)
|
||||
{
|
||||
// No to_chars() in older versions of libstdc++/libc++.
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace x86Emitter
|
||||
template <typename T>
|
||||
static __fi bool is_s8(T imm)
|
||||
{
|
||||
return (s8)imm == (typename std::make_signed<T>::type)imm;
|
||||
return (s8)imm == (std::make_signed_t<T>)imm;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -2562,7 +2562,7 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main)
|
||||
m_display_container = m_display_surface->createWindowContainer(getContentParent());
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
if (fullscreen || g_emu_thread->isExclusiveFullscreen())
|
||||
{
|
||||
// On Wayland, while move/restoreGeometry can't position the window, it can influence which screen they show up on.
|
||||
// Other platforms can position windows fine, but the only thing that matters here is the screen.
|
||||
@@ -2572,13 +2572,21 @@ void MainWindow::createDisplayWidget(bool fullscreen, bool render_to_main)
|
||||
m_display_surface->setFramePosition(pos());
|
||||
else
|
||||
restoreDisplayWindowGeometryFromConfig();
|
||||
m_display_surface->showFullScreen();
|
||||
|
||||
if (fullscreen)
|
||||
m_display_surface->showFullScreen();
|
||||
else
|
||||
m_display_surface->showNormal();
|
||||
#else
|
||||
if (isVisible() && g_emu_thread->shouldRenderToMain())
|
||||
m_display_container->move(pos());
|
||||
else
|
||||
restoreDisplayWindowGeometryFromConfig();
|
||||
m_display_container->showFullScreen();
|
||||
|
||||
if (fullscreen)
|
||||
m_display_container->showFullScreen();
|
||||
else
|
||||
m_display_container->showNormal();
|
||||
#endif
|
||||
}
|
||||
else if (!render_to_main)
|
||||
|
||||
@@ -120,13 +120,6 @@ namespace GSDumpTypes
|
||||
#undef DEF_GIFReg
|
||||
// clang-format on
|
||||
|
||||
template <typename Output, typename Input, typename std::enable_if<sizeof(Input) == sizeof(Output), bool>::type = true>
|
||||
static constexpr Output BitCast(Input input)
|
||||
{
|
||||
Output output;
|
||||
memcpy(&output, &input, sizeof(input));
|
||||
return output;
|
||||
}
|
||||
template <typename Output = u32>
|
||||
static constexpr Output GetBits(u64 value, u32 shift, u32 numbits)
|
||||
{
|
||||
|
||||
@@ -262,7 +262,7 @@ public:
|
||||
template <typename T>
|
||||
typename _unique_if<T>::_unique_array_unknown_bound make_unique(size_t count)
|
||||
{
|
||||
typedef typename std::remove_extent<T>::type Base;
|
||||
typedef std::remove_extent_t<T> Base;
|
||||
return UniquePtr<T>(make_array<Base>(count));
|
||||
}
|
||||
|
||||
|
||||
@@ -2528,7 +2528,7 @@ void GSState::Move()
|
||||
if (m_env.TRXPOS.DIRX)
|
||||
{
|
||||
// Only allow it to reverse if the destination is behind the source.
|
||||
if (!intersect || (sx <= dx && (sx == dx || ((!m_env.TRXPOS.DIRY && sy >= dy) || (m_env.TRXPOS.DIRY && sy < dy)))))
|
||||
if (!intersect || sx < dx)
|
||||
{
|
||||
sx += w - 1;
|
||||
dx += w - 1;
|
||||
@@ -2538,7 +2538,7 @@ void GSState::Move()
|
||||
if (m_env.TRXPOS.DIRY)
|
||||
{
|
||||
// Only allow it to reverse if the destination is behind the source.
|
||||
if (!intersect || (sy <= dy && (sy == dy || ((!m_env.TRXPOS.DIRX && sx >= dx) || (m_env.TRXPOS.DIRX && sx < dx)))))
|
||||
if (!intersect || sy < dy)
|
||||
{
|
||||
sy += h - 1;
|
||||
dy += h - 1;
|
||||
|
||||
@@ -123,17 +123,18 @@ std::vector<GSAdapterInfo> D3D::GetAdapterInfo(IDXGIFactory5* factory)
|
||||
return adapters;
|
||||
}
|
||||
|
||||
bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const RECT& window_rect, u32 width,
|
||||
bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, HWND window_hwnd, u32 width,
|
||||
u32 height, float refresh_rate, DXGI_FORMAT format, DXGI_MODE_DESC* fullscreen_mode, IDXGIOutput** output)
|
||||
{
|
||||
// We need to find which monitor the window is located on.
|
||||
const GSVector4i client_rc_vec = GSVector4i::load<false>(&window_rect);
|
||||
// DXGI seems to use the nearest monitor if the window is out of bounds.
|
||||
const auto* monitor = MonitorFromWindow(window_hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
// The window might be on a different adapter to which we are rendering.. so we have to enumerate them all.
|
||||
// The monitor might be on a different adapter to which we are rendering.. so we have to enumerate them all.
|
||||
HRESULT hr;
|
||||
wil::com_ptr_nothrow<IDXGIOutput> first_output, intersecting_output;
|
||||
wil::com_ptr_nothrow<IDXGIOutput> first_output, monitor_output;
|
||||
|
||||
for (u32 adapter_index = 0; !intersecting_output; adapter_index++)
|
||||
for (u32 adapter_index = 0; !monitor_output; adapter_index++)
|
||||
{
|
||||
wil::com_ptr_nothrow<IDXGIAdapter1> adapter;
|
||||
hr = factory->EnumAdapters1(adapter_index, adapter.put());
|
||||
@@ -152,10 +153,9 @@ bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const
|
||||
else if (FAILED(hr) || FAILED(this_output->GetDesc(&output_desc)))
|
||||
continue;
|
||||
|
||||
const GSVector4i output_rc = GSVector4i::load<false>(&output_desc.DesktopCoordinates);
|
||||
if (!client_rc_vec.rintersect(output_rc).rempty())
|
||||
if (output_desc.Monitor == monitor)
|
||||
{
|
||||
intersecting_output = std::move(this_output);
|
||||
monitor_output = std::move(this_output);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const
|
||||
}
|
||||
}
|
||||
|
||||
if (!intersecting_output)
|
||||
if (!monitor_output)
|
||||
{
|
||||
if (!first_output)
|
||||
{
|
||||
@@ -174,7 +174,7 @@ bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const
|
||||
}
|
||||
|
||||
Console.Warning("No DXGI output found for window, using first.");
|
||||
intersecting_output = std::move(first_output);
|
||||
monitor_output = std::move(first_output);
|
||||
}
|
||||
|
||||
DXGI_MODE_DESC request_mode = {};
|
||||
@@ -184,15 +184,15 @@ bool D3D::GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const
|
||||
request_mode.RefreshRate.Numerator = static_cast<UINT>(std::floor(refresh_rate * 1000.0f));
|
||||
request_mode.RefreshRate.Denominator = 1000u;
|
||||
|
||||
if (FAILED(hr = intersecting_output->FindClosestMatchingMode(&request_mode, fullscreen_mode, nullptr)) ||
|
||||
if (FAILED(hr = monitor_output->FindClosestMatchingMode(&request_mode, fullscreen_mode, nullptr)) ||
|
||||
request_mode.Format != format)
|
||||
{
|
||||
ERROR_LOG("Failed to find closest matching mode, hr={:08X}", static_cast<unsigned>(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
*output = intersecting_output.get();
|
||||
intersecting_output->AddRef();
|
||||
*output = monitor_output.get();
|
||||
monitor_output->AddRef();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace D3D
|
||||
std::vector<GSAdapterInfo> GetAdapterInfo(IDXGIFactory5* factory);
|
||||
|
||||
// returns the fullscreen mode to use for the specified dimensions
|
||||
bool GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, const RECT& window_rect, u32 width, u32 height,
|
||||
bool GetRequestedExclusiveFullscreenModeDesc(IDXGIFactory5* factory, HWND window_hwnd, u32 width, u32 height,
|
||||
float refresh_rate, DXGI_FORMAT format, DXGI_MODE_DESC* fullscreen_mode, IDXGIOutput** output);
|
||||
|
||||
// get an adapter based on name
|
||||
|
||||
@@ -659,7 +659,7 @@ bool GSDevice11::CreateSwapChain()
|
||||
float fullscreen_refresh_rate;
|
||||
m_is_exclusive_fullscreen =
|
||||
GetRequestedExclusiveFullscreenMode(&fullscreen_width, &fullscreen_height, &fullscreen_refresh_rate) &&
|
||||
D3D::GetRequestedExclusiveFullscreenModeDesc(m_dxgi_factory.get(), client_rc, fullscreen_width,
|
||||
D3D::GetRequestedExclusiveFullscreenModeDesc(m_dxgi_factory.get(), window_hwnd, fullscreen_width,
|
||||
fullscreen_height, fullscreen_refresh_rate, swap_chain_format, &fullscreen_mode,
|
||||
fullscreen_output.put());
|
||||
|
||||
|
||||
@@ -822,7 +822,7 @@ bool GSDevice12::CreateSwapChain()
|
||||
float fullscreen_refresh_rate;
|
||||
m_is_exclusive_fullscreen =
|
||||
GetRequestedExclusiveFullscreenMode(&fullscreen_width, &fullscreen_height, &fullscreen_refresh_rate) &&
|
||||
D3D::GetRequestedExclusiveFullscreenModeDesc(m_dxgi_factory.get(), client_rc, fullscreen_width,
|
||||
D3D::GetRequestedExclusiveFullscreenModeDesc(m_dxgi_factory.get(), window_hwnd, fullscreen_width,
|
||||
fullscreen_height, fullscreen_refresh_rate, swap_chain_format, &fullscreen_mode,
|
||||
fullscreen_output.put());
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ class GSDrawScanlineCodeGenerator : public GSNewCodeGenerator
|
||||
{
|
||||
using XYm = DRAW_SCANLINE_VECTOR_REGISTER;
|
||||
|
||||
constexpr static bool isXmm = std::is_same<XYm, Xbyak::Xmm>::value;
|
||||
constexpr static bool isYmm = std::is_same<XYm, Xbyak::Ymm>::value;
|
||||
constexpr static bool isXmm = std::is_same_v<XYm, Xbyak::Xmm>;
|
||||
constexpr static bool isYmm = std::is_same_v<XYm, Xbyak::Ymm>;
|
||||
constexpr static int wordsize = 8;
|
||||
constexpr static int vecsize = isXmm ? 16 : 32;
|
||||
constexpr static int vecsizelog = isXmm ? 4 : 5;
|
||||
|
||||
@@ -26,8 +26,8 @@ class GSSetupPrimCodeGenerator : public GSNewCodeGenerator
|
||||
using Xmm = Xbyak::Xmm;
|
||||
using Ymm = Xbyak::Ymm;
|
||||
|
||||
constexpr static bool isXmm = std::is_same<XYm, Xbyak::Xmm>::value;
|
||||
constexpr static bool isYmm = std::is_same<XYm, Xbyak::Ymm>::value;
|
||||
constexpr static bool isXmm = std::is_same_v<XYm, Xbyak::Xmm>;
|
||||
constexpr static bool isYmm = std::is_same_v<XYm, Xbyak::Ymm>;
|
||||
constexpr static int vecsize = isXmm ? 16 : 32;
|
||||
|
||||
constexpr static int dsize = isXmm ? 4 : 8;
|
||||
|
||||
@@ -481,26 +481,72 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(m_physical_device, &queue_family_count, queue_family_properties.data());
|
||||
DevCon.WriteLn("%u vulkan queue families", queue_family_count);
|
||||
|
||||
// Find graphics and present queues.
|
||||
std::vector<uint32_t> queue_family_users(queue_family_count, 0);
|
||||
|
||||
m_graphics_queue_family_index = queue_family_count;
|
||||
m_present_queue_family_index = queue_family_count;
|
||||
u32 present_queue_index = 0;
|
||||
m_spin_queue_family_index = queue_family_count;
|
||||
u32 spin_queue_index = 0;
|
||||
|
||||
// Graphics Queue
|
||||
for (uint32_t i = 0; i < queue_family_count; i++)
|
||||
{
|
||||
VkBool32 graphics_supported = queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT;
|
||||
if (graphics_supported)
|
||||
if (queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||
{
|
||||
m_graphics_queue_family_index = i;
|
||||
// Quit now, no need for a present queue.
|
||||
if (!surface)
|
||||
{
|
||||
break;
|
||||
}
|
||||
queue_family_users[i]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (surface)
|
||||
// Spinwait Queue
|
||||
for (uint32_t i = 0; i < queue_family_count; i++)
|
||||
{
|
||||
if (queue_family_properties[i].queueCount == queue_family_users[i])
|
||||
continue;
|
||||
if (!(queue_family_properties[i].queueFlags & VK_QUEUE_COMPUTE_BIT))
|
||||
continue;
|
||||
if (queue_family_properties[i].timestampValidBits == 0)
|
||||
continue; // We need timing
|
||||
|
||||
if (!(queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT))
|
||||
{
|
||||
m_spin_queue_family_index = i;
|
||||
break;
|
||||
}
|
||||
else if (m_spin_queue_family_index == queue_family_count)
|
||||
m_spin_queue_family_index = i;
|
||||
}
|
||||
|
||||
if (m_spin_queue_family_index != queue_family_count)
|
||||
{
|
||||
spin_queue_index = queue_family_users[m_spin_queue_family_index];
|
||||
queue_family_users[m_spin_queue_family_index]++;
|
||||
m_spin_queue_is_graphics_queue = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No spare queue? Try the graphics queue.
|
||||
if ((queue_family_properties[m_graphics_queue_family_index].queueFlags & VK_QUEUE_COMPUTE_BIT) &&
|
||||
(queue_family_properties[m_graphics_queue_family_index].timestampValidBits != 0))
|
||||
{
|
||||
m_spin_queue_family_index = m_graphics_queue_family_index;
|
||||
spin_queue_index = 0;
|
||||
m_spin_queue_is_graphics_queue = true;
|
||||
}
|
||||
else
|
||||
m_spin_queue_is_graphics_queue = false;
|
||||
}
|
||||
|
||||
// Present Queue
|
||||
if (surface)
|
||||
{
|
||||
for (uint32_t i = 0; i < queue_family_count; i++)
|
||||
{
|
||||
if (queue_family_properties[i].queueCount == queue_family_users[i])
|
||||
continue;
|
||||
|
||||
VkBool32 present_supported;
|
||||
VkResult res = vkGetPhysicalDeviceSurfaceSupportKHR(m_physical_device, i, surface, &present_supported);
|
||||
if (res != VK_SUCCESS)
|
||||
@@ -509,35 +555,48 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
return false;
|
||||
}
|
||||
|
||||
if (present_supported)
|
||||
if (!present_supported)
|
||||
continue;
|
||||
|
||||
// Perfer aync compute queue
|
||||
if ((queue_family_properties[i].queueFlags & VK_QUEUE_COMPUTE_BIT) &&
|
||||
!(queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT))
|
||||
{
|
||||
m_present_queue_family_index = i;
|
||||
break;
|
||||
}
|
||||
else if (m_present_queue_family_index == queue_family_count)
|
||||
m_present_queue_family_index = i;
|
||||
}
|
||||
|
||||
if (m_present_queue_family_index != queue_family_count)
|
||||
{
|
||||
present_queue_index = queue_family_users[m_present_queue_family_index];
|
||||
queue_family_users[m_present_queue_family_index]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No spare queue? Try the graphics queue.
|
||||
VkBool32 present_supported;
|
||||
VkResult res = vkGetPhysicalDeviceSurfaceSupportKHR(m_physical_device, m_graphics_queue_family_index, surface, &present_supported);
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
LOG_VULKAN_ERROR(res, "vkGetPhysicalDeviceSurfaceSupportKHR failed: ");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prefer one queue family index that does both graphics and present.
|
||||
if (graphics_supported && present_supported)
|
||||
if (present_supported)
|
||||
{
|
||||
break;
|
||||
m_present_queue_family_index = m_graphics_queue_family_index;
|
||||
present_queue_index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (uint32_t i = 0; i < queue_family_count; i++)
|
||||
{
|
||||
// Pick a queue for spinning
|
||||
if (!(queue_family_properties[i].queueFlags & VK_QUEUE_COMPUTE_BIT))
|
||||
continue; // We need compute
|
||||
if (queue_family_properties[i].timestampValidBits == 0)
|
||||
continue; // We need timing
|
||||
const bool queue_is_used = i == m_graphics_queue_family_index || i == m_present_queue_family_index;
|
||||
if (queue_is_used && m_spin_queue_family_index != queue_family_count)
|
||||
continue; // Found a non-graphics queue to use
|
||||
spin_queue_index = 0;
|
||||
m_spin_queue_family_index = i;
|
||||
if (queue_is_used && queue_family_properties[i].queueCount > 1)
|
||||
spin_queue_index = 1;
|
||||
if (!(queue_family_properties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT))
|
||||
break; // Async compute queue, definitely pick this one
|
||||
}
|
||||
|
||||
// Swap spin and present to simplify queue priorities logic.
|
||||
if (!m_spin_queue_is_graphics_queue && m_present_queue_family_index == m_spin_queue_family_index)
|
||||
std::swap(spin_queue_index, present_queue_index);
|
||||
|
||||
if (m_graphics_queue_family_index == queue_family_count)
|
||||
{
|
||||
Console.Error("VK: Failed to find an acceptable graphics queue.");
|
||||
@@ -555,14 +614,16 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
device_info.flags = 0;
|
||||
device_info.queueCreateInfoCount = 0;
|
||||
|
||||
static constexpr float queue_priorities[] = {1.0f, 0.0f}; // Low priority for the spin queue
|
||||
// Low priority for the spin queue
|
||||
static constexpr float queue_priorities[] = {1.0f, 1.0f, 0.0f};
|
||||
|
||||
std::array<VkDeviceQueueCreateInfo, 3> queue_infos;
|
||||
VkDeviceQueueCreateInfo& graphics_queue_info = queue_infos[device_info.queueCreateInfoCount++];
|
||||
graphics_queue_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
graphics_queue_info.pNext = nullptr;
|
||||
graphics_queue_info.flags = 0;
|
||||
graphics_queue_info.queueFamilyIndex = m_graphics_queue_family_index;
|
||||
graphics_queue_info.queueCount = 1;
|
||||
graphics_queue_info.queueCount = queue_family_users[m_graphics_queue_family_index];
|
||||
graphics_queue_info.pQueuePriorities = queue_priorities;
|
||||
|
||||
if (surface != VK_NULL_HANDLE && m_graphics_queue_family_index != m_present_queue_family_index)
|
||||
@@ -572,21 +633,21 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
present_queue_info.pNext = nullptr;
|
||||
present_queue_info.flags = 0;
|
||||
present_queue_info.queueFamilyIndex = m_present_queue_family_index;
|
||||
present_queue_info.queueCount = 1;
|
||||
present_queue_info.queueCount = queue_family_users[m_present_queue_family_index];
|
||||
present_queue_info.pQueuePriorities = queue_priorities;
|
||||
}
|
||||
|
||||
if (m_spin_queue_family_index == m_graphics_queue_family_index)
|
||||
{
|
||||
if (spin_queue_index != 0)
|
||||
graphics_queue_info.queueCount = 2;
|
||||
if (spin_queue_index == 1)
|
||||
graphics_queue_info.pQueuePriorities = queue_priorities + 1;
|
||||
}
|
||||
else if (m_spin_queue_family_index == m_present_queue_family_index)
|
||||
{
|
||||
if (spin_queue_index != 0)
|
||||
queue_infos[1].queueCount = 2; // present queue
|
||||
if (spin_queue_index == 1)
|
||||
queue_infos[1].pQueuePriorities = queue_priorities + 1;
|
||||
}
|
||||
else
|
||||
else if (m_spin_queue_family_index != queue_family_count)
|
||||
{
|
||||
VkDeviceQueueCreateInfo& spin_queue_info = queue_infos[device_info.queueCreateInfoCount++];
|
||||
spin_queue_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
@@ -594,7 +655,7 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
spin_queue_info.flags = 0;
|
||||
spin_queue_info.queueFamilyIndex = m_spin_queue_family_index;
|
||||
spin_queue_info.queueCount = 1;
|
||||
spin_queue_info.pQueuePriorities = queue_priorities + 1;
|
||||
spin_queue_info.pQueuePriorities = queue_priorities + 2;
|
||||
}
|
||||
|
||||
device_info.pQueueCreateInfos = queue_infos.data();
|
||||
@@ -683,13 +744,11 @@ bool GSDeviceVK::CreateDevice(VkSurfaceKHR surface, bool enable_validation_layer
|
||||
vkGetDeviceQueue(m_device, m_graphics_queue_family_index, 0, &m_graphics_queue);
|
||||
if (surface)
|
||||
{
|
||||
vkGetDeviceQueue(m_device, m_present_queue_family_index, 0, &m_present_queue);
|
||||
vkGetDeviceQueue(m_device, m_present_queue_family_index, present_queue_index, &m_present_queue);
|
||||
}
|
||||
m_spinning_supported = m_spin_queue_family_index != queue_family_count &&
|
||||
queue_family_properties[m_graphics_queue_family_index].timestampValidBits > 0 &&
|
||||
m_device_properties.limits.timestampPeriod > 0;
|
||||
m_spin_queue_is_graphics_queue =
|
||||
m_spin_queue_family_index == m_graphics_queue_family_index && spin_queue_index == 0;
|
||||
|
||||
m_gpu_timing_supported = (m_device_properties.limits.timestampComputeAndGraphics != 0 &&
|
||||
queue_family_properties[m_graphics_queue_family_index].timestampValidBits > 0 &&
|
||||
|
||||
@@ -2558,13 +2558,25 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
|
||||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
BeginMenuButtons();
|
||||
|
||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||
ImGui::SetNextItemWidth(end);
|
||||
s32 dlg_value = static_cast<s32>(value.value_or(default_value));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.45f, 0.65f, 0.95f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.55f, 0.75f, 1.0f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (ImGui::SliderInt("##value", &dlg_value, min_value, max_value, format, ImGuiSliderFlags_NoInput))
|
||||
{
|
||||
if (IsEditingGameSettings(bsi) && dlg_value == default_value)
|
||||
@@ -2575,6 +2587,9 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
|
||||
SetSettingsChanged(bsi);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(7);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font, ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
@@ -2618,7 +2633,7 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
|
||||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
BeginMenuButtons();
|
||||
|
||||
@@ -2633,6 +2648,15 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
|
||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||
ImGui::SetNextItemWidth(end);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(12.0f, 10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
||||
{
|
||||
const s32 new_value = StringUtil::FromChars<s32>(str_value).value_or(dlg_value);
|
||||
@@ -2640,6 +2664,9 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
|
||||
dlg_value = new_value;
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
}
|
||||
else
|
||||
@@ -2732,13 +2759,25 @@ void FullscreenUI::DrawFloatRangeSetting(SettingsInterface* bsi, const char* tit
|
||||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
BeginMenuButtons();
|
||||
|
||||
const float end = ImGui::GetCurrentWindow()->WorkRect.GetWidth();
|
||||
ImGui::SetNextItemWidth(end);
|
||||
float dlg_value = value.value_or(default_value) * multiplier;
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.45f, 0.65f, 0.95f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.55f, 0.75f, 1.0f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (ImGui::SliderFloat("##value", &dlg_value, min_value * multiplier, max_value * multiplier, format, ImGuiSliderFlags_NoInput))
|
||||
{
|
||||
dlg_value /= multiplier;
|
||||
@@ -2751,6 +2790,9 @@ void FullscreenUI::DrawFloatRangeSetting(SettingsInterface* bsi, const char* tit
|
||||
SetSettingsChanged(bsi);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(7);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
if (MenuButtonWithoutSummary(FSUI_CSTR("OK"), true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, g_large_font, ImVec2(0.5f, 0.0f)))
|
||||
{
|
||||
@@ -2794,7 +2836,7 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
|
||||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
BeginMenuButtons();
|
||||
|
||||
@@ -2816,6 +2858,13 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
|
||||
((tmp_value.value() - std::floor(tmp_value.value())) < 0.01f) ? "%.0f" : "%f", tmp_value.value());
|
||||
}
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(12.0f, 10.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
||||
{
|
||||
const float new_value = StringUtil::FromChars<float>(str_value).value_or(dlg_value);
|
||||
@@ -2823,6 +2872,9 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
|
||||
dlg_value = new_value;
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
}
|
||||
else
|
||||
@@ -2930,7 +2982,7 @@ void FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, const char* title,
|
||||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
if (ImGui::BeginPopupModal(title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
static constexpr const char* labels[4] = {
|
||||
FSUI_NSTR("Left: "),
|
||||
@@ -2988,6 +3040,15 @@ void FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, const char* title,
|
||||
ImGui::SetNextItemWidth(end);
|
||||
ImGui::SetCursorPosY(button_pos.y);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(12.0f, 10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (ImGui::InputText("##value", str_value, std::size(str_value), ImGuiInputTextFlags_CharsDecimal))
|
||||
{
|
||||
const s32 new_value = StringUtil::FromChars<s32>(str_value).value_or(dlg_value);
|
||||
@@ -2995,6 +3056,9 @@ void FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, const char* title,
|
||||
dlg_value = new_value;
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
}
|
||||
else
|
||||
@@ -6341,18 +6405,33 @@ void FullscreenUI::DrawControllerSettingsPage()
|
||||
LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
|
||||
if (ImGui::BeginPopupModal(
|
||||
freq_label.c_str(), nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
freq_label.c_str(), nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
ImGui::SetNextItemWidth(LayoutScale(450.0f));
|
||||
if (ImGui::SliderInt("##value", &frequency, 0, 60, FSUI_CSTR("Toggle every %d frames"), ImGuiSliderFlags_NoInput))
|
||||
{
|
||||
if (frequency == 0)
|
||||
bsi->DeleteValue(section, freq_key.c_str());
|
||||
else
|
||||
bsi->SetIntValue(section, freq_key.c_str(), frequency);
|
||||
ImGui::SetNextItemWidth(LayoutScale(450.0f));
|
||||
|
||||
SetSettingsChanged(bsi);
|
||||
}
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_GrabRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.45f, 0.65f, 0.95f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.55f, 0.75f, 1.0f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (ImGui::SliderInt("##value", &frequency, 0, 60, FSUI_CSTR("Toggle every %d frames"), ImGuiSliderFlags_NoInput))
|
||||
{
|
||||
if (frequency == 0)
|
||||
bsi->DeleteValue(section, freq_key.c_str());
|
||||
else
|
||||
bsi->SetIntValue(section, freq_key.c_str(), frequency);
|
||||
|
||||
SetSettingsChanged(bsi);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(7);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
BeginMenuButtons();
|
||||
if (MenuButton("OK", nullptr, true, LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY))
|
||||
@@ -7595,7 +7674,7 @@ void FullscreenUI::DrawResumeStateSelector()
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(FSUI_CSTR("Load Resume State"), &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize))
|
||||
if (ImGui::BeginPopupModal(FSUI_CSTR("Load Resume State"), &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
const SaveStateListEntry& entry = s_save_state_selector_slots.front();
|
||||
ImGui::TextWrapped(FSUI_CSTR("A resume save state created at %s was found.\n\nDo you want to load this save and continue?"),
|
||||
@@ -8749,11 +8828,14 @@ void FullscreenUI::DrawAchievementsLoginWindow()
|
||||
ImGui::Spacing();
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(6.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(12.0f, 10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
if (s_achievements_login_logging_in)
|
||||
ImGui::BeginDisabled();
|
||||
@@ -8766,8 +8848,8 @@ void FullscreenUI::DrawAchievementsLoginWindow()
|
||||
ImGui::SetNextItemWidth(content_width);
|
||||
ImGui::InputTextWithHint("##password", FSUI_CSTR("Password"), s_achievements_login_password, sizeof(s_achievements_login_password), ImGuiInputTextFlags_Password);
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
if (s_achievements_login_logging_in)
|
||||
ImGui::EndDisabled();
|
||||
@@ -8793,7 +8875,7 @@ void FullscreenUI::DrawAchievementsLoginWindow()
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + start_x);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(6.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
|
||||
const bool can_login = !s_achievements_login_logging_in &&
|
||||
strlen(s_achievements_login_username) > 0 &&
|
||||
|
||||
@@ -2390,6 +2390,7 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
||||
return;
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING, LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||
@@ -2466,7 +2467,7 @@ void ImGuiFullscreen::DrawChoiceDialog()
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(3);
|
||||
ImGui::PopStyleVar(4);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (choice >= 0)
|
||||
@@ -2518,6 +2519,7 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
ImGui::OpenPopup(s_input_dialog_title.c_str());
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, LayoutScale(20.0f, 20.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING, LAYOUT_MENU_BUTTON_Y_PADDING));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||
@@ -2528,7 +2530,7 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
|
||||
bool is_open = true;
|
||||
if (ImGui::BeginPopupModal(s_input_dialog_title.c_str(), &is_open,
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
ResetFocusHere();
|
||||
ImGui::TextWrapped("%s", s_input_dialog_message.c_str());
|
||||
@@ -2578,10 +2580,22 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
if (s_focus_reset_queued != FocusResetType::None)
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, LayoutScale(8.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(12.0f, 10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.25f, 0.25f, 0.25f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.3f, 0.3f, 0.3f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.4f, 0.4f, 0.4f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
ImGui::InputText("##input", &s_input_dialog_text, flags,
|
||||
(s_input_dialog_filter_type != InputFilterType::None) ? input_callback : nullptr,
|
||||
(s_input_dialog_filter_type != InputFilterType::None) ? static_cast<void*>(&s_input_dialog_filter_type) : nullptr);
|
||||
|
||||
ImGui::PopStyleColor(5);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + LayoutScale(10.0f));
|
||||
|
||||
const bool ok_enabled = !s_input_dialog_text.empty();
|
||||
@@ -2613,7 +2627,7 @@ void ImGuiFullscreen::DrawInputDialog()
|
||||
GetInputDialogHelpText(s_fullscreen_footer_text);
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleVar(3);
|
||||
ImGui::PopStyleVar(4);
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
@@ -2705,7 +2719,8 @@ void ImGuiFullscreen::DrawMessageDialog()
|
||||
const char* win_id = s_message_dialog_title.empty() ? "##messagedialog" : s_message_dialog_title.c_str();
|
||||
|
||||
ImGui::SetNextWindowSize(LayoutScale(700.0f, 0.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::SetNextWindowPos((ImGui::GetIO().DisplaySize - LayoutScale(0.0f, LAYOUT_FOOTER_HEIGHT)) * 0.5f,
|
||||
ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(win_id);
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
@@ -2719,7 +2734,7 @@ void ImGuiFullscreen::DrawMessageDialog()
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, UIPopupBackgroundColor);
|
||||
|
||||
bool is_open = true;
|
||||
const u32 flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
||||
const u32 flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar |
|
||||
(s_message_dialog_title.empty() ? ImGuiWindowFlags_NoTitleBar : 0);
|
||||
std::optional<s32> result;
|
||||
|
||||
@@ -2870,7 +2885,8 @@ void ImGuiFullscreen::DrawProgressDialogs(ImVec2& position, float spacing)
|
||||
{
|
||||
const std::string popup_id = fmt::format("##progress_dialog_{}", data.id);
|
||||
ImGui::SetNextWindowSize(LayoutScale(600.0f, 0.0f));
|
||||
ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::SetNextWindowPos((ImGui::GetIO().DisplaySize - LayoutScale(0.0f, LAYOUT_FOOTER_HEIGHT)) * 0.5f,
|
||||
ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
ImGui::OpenPopup(popup_id.c_str());
|
||||
|
||||
ImGui::PushFont(g_large_font.first, g_large_font.second);
|
||||
@@ -2885,7 +2901,7 @@ void ImGuiFullscreen::DrawProgressDialogs(ImVec2& position, float spacing)
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, UISecondaryColor);
|
||||
|
||||
bool is_open = true;
|
||||
const u32 flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar;
|
||||
const u32 flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar;
|
||||
|
||||
if (ImGui::BeginPopupModal(popup_id.c_str(), &is_open, flags))
|
||||
{
|
||||
|
||||
@@ -104,7 +104,8 @@ public:
|
||||
u32 GetVersion() const { return m_version; }
|
||||
|
||||
/// Overload for integral or floating-point types. Writes bytes as-is.
|
||||
template <typename T, std::enable_if_t<std::is_integral_v<T> || std::is_floating_point_v<T>, int> = 0>
|
||||
template <typename T>
|
||||
requires std::is_integral_v<T> || std::is_floating_point_v<T>
|
||||
void Do(T* value_ptr)
|
||||
{
|
||||
if (m_mode == Mode::Read)
|
||||
@@ -120,7 +121,8 @@ public:
|
||||
}
|
||||
|
||||
/// Overload for enum types. Uses the underlying type.
|
||||
template <typename T, std::enable_if_t<std::is_enum_v<T>, int> = 0>
|
||||
template <typename T>
|
||||
requires std::is_enum_v<T>
|
||||
void Do(T* value_ptr)
|
||||
{
|
||||
using TType = std::underlying_type_t<T>;
|
||||
@@ -142,7 +144,8 @@ public:
|
||||
}
|
||||
|
||||
/// Overload for POD types, such as structs.
|
||||
template <typename T, std::enable_if_t<std::is_standard_layout_v<T> && std::is_trivial_v<T>, int> = 0>
|
||||
template <typename T>
|
||||
requires std::is_standard_layout_v<T> && std::is_trivial_v<T>
|
||||
void DoPOD(T* value_ptr)
|
||||
{
|
||||
if (m_mode == Mode::Read)
|
||||
|
||||
Reference in New Issue
Block a user