GPUDevice: Move exclusive fullscreen to features

Also fixes it not enabling in D3D12 renderer.
This commit is contained in:
Stenzek 2025-01-21 19:12:41 +10:00
parent 389276bb03
commit fb3e290133
No known key found for this signature in database
9 changed files with 10 additions and 16 deletions

View File

@ -629,7 +629,7 @@ bool GPUThread::CreateDeviceOnThread(RenderAPI api, bool fullscreen, bool clear_
g_gpu_device = GPUDevice::CreateDeviceForAPI(api);
std::optional<GPUDevice::ExclusiveFullscreenMode> fullscreen_mode;
if (fullscreen && g_gpu_device && g_gpu_device->SupportsExclusiveFullscreen())
if (fullscreen && g_gpu_device && g_gpu_device->GetFeatures().exclusive_fullscreen)
{
fullscreen_mode =
GPUDevice::ExclusiveFullscreenMode::Parse(Host::GetTinyStringSettingValue("GPU", "FullscreenMode", ""));
@ -1140,7 +1140,7 @@ void GPUThread::UpdateDisplayWindowOnThread(bool fullscreen)
return;
std::optional<GPUDevice::ExclusiveFullscreenMode> fullscreen_mode;
if (fullscreen && g_gpu_device->SupportsExclusiveFullscreen())
if (fullscreen && g_gpu_device->GetFeatures().exclusive_fullscreen)
{
fullscreen_mode =
GPUDevice::ExclusiveFullscreenMode::Parse(Host::GetTinyStringSettingValue("GPU", "FullscreenMode", ""));

View File

@ -48,6 +48,7 @@ void SetD3DDebugObjectName(ID3D11DeviceChild* obj, std::string_view name)
D3D11Device::D3D11Device()
{
m_render_api = RenderAPI::D3D11;
m_features.exclusive_fullscreen = true; // set so the caller can pass a mode to CreateDeviceAndSwapChain()
}
D3D11Device::~D3D11Device()
@ -186,6 +187,7 @@ void D3D11Device::SetFeatures(FeatureMask disabled_features)
(!(disabled_features & FEATURE_MASK_COMPUTE_SHADERS) && feature_level >= D3D_FEATURE_LEVEL_11_0);
m_features.partial_msaa_resolve = false;
m_features.memory_import = false;
m_features.exclusive_fullscreen = true;
m_features.explicit_present = false;
m_features.timed_present = false;
m_features.gpu_timing = true;
@ -470,11 +472,6 @@ std::unique_ptr<GPUSwapChain> D3D11Device::CreateSwapChain(const WindowInfo& wi,
return ret;
}
bool D3D11Device::SupportsExclusiveFullscreen() const
{
return true;
}
std::string D3D11Device::GetDriverInfo() const
{
std::string ret = fmt::format("{} (Shader Model {})\n", D3DCommon::GetFeatureLevelString(m_render_api_version),

View File

@ -37,8 +37,6 @@ public:
ALWAYS_INLINE static IDXGIFactory5* GetDXGIFactory() { return GetInstance().m_dxgi_factory.Get(); }
ALWAYS_INLINE static D3D_FEATURE_LEVEL GetMaxFeatureLevel() { return GetInstance().m_max_feature_level; }
bool SupportsExclusiveFullscreen() const override;
std::string GetDriverInfo() const override;
void FlushCommands() override;

View File

@ -116,6 +116,7 @@ static constexpr const u32 s_mipmap_blit_ps[] = {
D3D12Device::D3D12Device()
{
m_render_api = RenderAPI::D3D12;
m_features.exclusive_fullscreen = true; // set so the caller can pass a mode to CreateDeviceAndSwapChain()
#ifdef ENABLE_GPU_OBJECT_NAMES
s_debug_scope_depth = 0;
@ -1346,6 +1347,7 @@ void D3D12Device::SetFeatures(D3D_FEATURE_LEVEL feature_level, FeatureMask disab
m_features.compute_shaders = !(disabled_features & FEATURE_MASK_COMPUTE_SHADERS);
m_features.partial_msaa_resolve = true;
m_features.memory_import = false;
m_features.exclusive_fullscreen = true;
m_features.explicit_present = true;
m_features.timed_present = false;
m_features.gpu_timing = true;

View File

@ -506,11 +506,6 @@ void GPUDevice::DestroyMainSwapChain()
m_main_swap_chain.reset();
}
bool GPUDevice::SupportsExclusiveFullscreen() const
{
return false;
}
void GPUDevice::OpenShaderCache(std::string_view base_path, u32 version)
{
if (m_features.shader_cache && !base_path.empty())

View File

@ -596,6 +596,7 @@ public:
bool compute_shaders : 1;
bool partial_msaa_resolve : 1;
bool memory_import : 1;
bool exclusive_fullscreen : 1;
bool explicit_present : 1;
bool timed_present : 1;
bool gpu_timing : 1;
@ -740,8 +741,6 @@ public:
std::optional<bool> exclusive_fullscreen_control, Error* error);
void DestroyMainSwapChain();
virtual bool SupportsExclusiveFullscreen() const;
virtual std::string GetDriverInfo() const = 0;
// Flushes current command buffer, but does not wait for completion.

View File

@ -385,6 +385,7 @@ void MetalDevice::SetFeatures(FeatureMask disabled_features)
m_features.geometry_shaders = false;
m_features.partial_msaa_resolve = false;
m_features.memory_import = true;
m_features.exclusive_fullscreen = false;
m_features.explicit_present = false;
m_features.timed_present = true;
m_features.shader_cache = true;

View File

@ -489,6 +489,7 @@ bool OpenGLDevice::CheckFeatures(FeatureMask disabled_features)
(!GLAD_GL_EXT_disjoint_timer_query || !glGetQueryObjectivEXT || !glGetQueryObjectui64vEXT));
m_features.partial_msaa_resolve = true;
m_features.memory_import = true;
m_features.exclusive_fullscreen = false;
m_features.explicit_present = false;
m_features.timed_present = false;

View File

@ -2455,6 +2455,7 @@ void VulkanDevice::SetFeatures(FeatureMask disabled_features, const VkPhysicalDe
m_features.partial_msaa_resolve = true;
m_features.memory_import = m_optional_extensions.vk_ext_external_memory_host;
m_features.exclusive_fullscreen = false;
m_features.explicit_present = true;
m_features.timed_present = false;
m_features.shader_cache = true;