mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-17 08:05:46 -04:00
HostDisplay: Add virtual method for getting resolutions
This commit is contained in:
@ -256,7 +256,7 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
|
||||
u32 adapter_index;
|
||||
if (!adapter_name.empty())
|
||||
{
|
||||
AdapterInfo adapter_info = GetAdapterInfo(temp_dxgi_factory.Get());
|
||||
AdapterAndModeList adapter_info(GetAdapterAndModeList(temp_dxgi_factory.Get()));
|
||||
for (adapter_index = 0; adapter_index < static_cast<u32>(adapter_info.adapter_names.size()); adapter_index++)
|
||||
{
|
||||
if (adapter_name == adapter_info.adapter_names[adapter_index])
|
||||
@ -795,19 +795,19 @@ void D3D11HostDisplay::RenderSoftwareCursor(s32 left, s32 top, s32 width, s32 he
|
||||
m_context->Draw(3, 0);
|
||||
}
|
||||
|
||||
D3D11HostDisplay::AdapterInfo D3D11HostDisplay::GetAdapterInfo()
|
||||
HostDisplay::AdapterAndModeList D3D11HostDisplay::StaticGetAdapterAndModeList()
|
||||
{
|
||||
ComPtr<IDXGIFactory> dxgi_factory;
|
||||
HRESULT hr = CreateDXGIFactory(IID_PPV_ARGS(dxgi_factory.GetAddressOf()));
|
||||
if (FAILED(hr))
|
||||
return {};
|
||||
|
||||
return GetAdapterInfo(dxgi_factory.Get());
|
||||
return GetAdapterAndModeList(dxgi_factory.Get());
|
||||
}
|
||||
|
||||
D3D11HostDisplay::AdapterInfo D3D11HostDisplay::GetAdapterInfo(IDXGIFactory* dxgi_factory)
|
||||
HostDisplay::AdapterAndModeList D3D11HostDisplay::GetAdapterAndModeList(IDXGIFactory* dxgi_factory)
|
||||
{
|
||||
AdapterInfo adapter_info;
|
||||
AdapterAndModeList adapter_info;
|
||||
ComPtr<IDXGIAdapter> current_adapter;
|
||||
while (SUCCEEDED(dxgi_factory->EnumAdapters(static_cast<UINT>(adapter_info.adapter_names.size()),
|
||||
current_adapter.ReleaseAndGetAddressOf())))
|
||||
@ -873,6 +873,11 @@ D3D11HostDisplay::AdapterInfo D3D11HostDisplay::GetAdapterInfo(IDXGIFactory* dxg
|
||||
return adapter_info;
|
||||
}
|
||||
|
||||
HostDisplay::AdapterAndModeList D3D11HostDisplay::GetAdapterAndModeList()
|
||||
{
|
||||
return GetAdapterAndModeList(m_dxgi_factory.Get());
|
||||
}
|
||||
|
||||
bool D3D11HostDisplay::SetPostProcessingChain(const std::string_view& config)
|
||||
{
|
||||
if (config.empty())
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
virtual bool SupportsFullscreen() const override;
|
||||
virtual bool IsFullscreen() override;
|
||||
virtual bool SetFullscreen(bool fullscreen, u32 width, u32 height, float refresh_rate) override;
|
||||
virtual AdapterAndModeList GetAdapterAndModeList() override;
|
||||
virtual void DestroyRenderSurface() override;
|
||||
|
||||
virtual bool SetPostProcessingChain(const std::string_view& config) override;
|
||||
@ -68,17 +69,12 @@ public:
|
||||
|
||||
virtual bool Render() override;
|
||||
|
||||
struct AdapterInfo
|
||||
{
|
||||
std::vector<std::string> adapter_names;
|
||||
std::vector<std::string> fullscreen_modes;
|
||||
};
|
||||
static AdapterInfo GetAdapterInfo();
|
||||
static AdapterAndModeList StaticGetAdapterAndModeList();
|
||||
|
||||
protected:
|
||||
static constexpr u32 DISPLAY_UNIFORM_BUFFER_SIZE = 16;
|
||||
|
||||
static AdapterInfo GetAdapterInfo(IDXGIFactory* dxgi_factory);
|
||||
static AdapterAndModeList GetAdapterAndModeList(IDXGIFactory* dxgi_factory);
|
||||
|
||||
virtual bool CreateResources() override;
|
||||
virtual void DestroyResources() override;
|
||||
|
@ -510,6 +510,11 @@ bool OpenGLHostDisplay::SetFullscreen(bool fullscreen, u32 width, u32 height, fl
|
||||
return false;
|
||||
}
|
||||
|
||||
HostDisplay::AdapterAndModeList OpenGLHostDisplay::GetAdapterAndModeList()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void OpenGLHostDisplay::DestroyRenderSurface()
|
||||
{
|
||||
if (!m_gl_context)
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
virtual bool SupportsFullscreen() const override;
|
||||
virtual bool IsFullscreen() override;
|
||||
virtual bool SetFullscreen(bool fullscreen, u32 width, u32 height, float refresh_rate) override;
|
||||
virtual AdapterAndModeList GetAdapterAndModeList() override;
|
||||
virtual void DestroyRenderSurface() override;
|
||||
|
||||
virtual bool SetPostProcessingChain(const std::string_view& config) override;
|
||||
|
@ -139,6 +139,11 @@ bool VulkanHostDisplay::SetFullscreen(bool fullscreen, u32 width, u32 height, fl
|
||||
return false;
|
||||
}
|
||||
|
||||
HostDisplay::AdapterAndModeList VulkanHostDisplay::GetAdapterAndModeList()
|
||||
{
|
||||
return StaticGetAdapterAndModeList();
|
||||
}
|
||||
|
||||
void VulkanHostDisplay::DestroyRenderSurface()
|
||||
{
|
||||
m_window_info = {};
|
||||
@ -747,12 +752,15 @@ void VulkanHostDisplay::RenderSoftwareCursor(s32 left, s32 top, s32 width, s32 h
|
||||
vkCmdDraw(cmdbuffer, 3, 1, 0, 0);
|
||||
}
|
||||
|
||||
std::vector<std::string> VulkanHostDisplay::EnumerateAdapterNames()
|
||||
HostDisplay::AdapterAndModeList VulkanHostDisplay::StaticGetAdapterAndModeList()
|
||||
{
|
||||
if (g_vulkan_context)
|
||||
return Vulkan::Context::EnumerateGPUNames(g_vulkan_context->GetVulkanInstance());
|
||||
AdapterAndModeList ret;
|
||||
|
||||
if (Vulkan::LoadVulkanLibrary())
|
||||
if (g_vulkan_context)
|
||||
{
|
||||
ret.adapter_names = Vulkan::Context::EnumerateGPUNames(g_vulkan_context->GetVulkanInstance());
|
||||
}
|
||||
else if (Vulkan::LoadVulkanLibrary())
|
||||
{
|
||||
Common::ScopeGuard lib_guard([]() { Vulkan::UnloadVulkanLibrary(); });
|
||||
|
||||
@ -762,7 +770,7 @@ std::vector<std::string> VulkanHostDisplay::EnumerateAdapterNames()
|
||||
Common::ScopeGuard instance_guard([&instance]() { vkDestroyInstance(instance, nullptr); });
|
||||
|
||||
if (Vulkan::LoadVulkanInstanceFunctions(instance))
|
||||
return Vulkan::Context::EnumerateGPUNames(instance);
|
||||
ret.adapter_names = Vulkan::Context::EnumerateGPUNames(instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
virtual bool SupportsFullscreen() const override;
|
||||
virtual bool IsFullscreen() override;
|
||||
virtual bool SetFullscreen(bool fullscreen, u32 width, u32 height, float refresh_rate) override;
|
||||
virtual AdapterAndModeList GetAdapterAndModeList() override;
|
||||
virtual void DestroyRenderSurface() override;
|
||||
|
||||
virtual bool SetPostProcessingChain(const std::string_view& config) override;
|
||||
@ -64,7 +65,7 @@ public:
|
||||
|
||||
virtual bool Render() override;
|
||||
|
||||
static std::vector<std::string> EnumerateAdapterNames();
|
||||
static AdapterAndModeList StaticGetAdapterAndModeList();
|
||||
|
||||
protected:
|
||||
struct PushConstants
|
||||
|
Reference in New Issue
Block a user