GPUDevice: Move exclusive fullscreen to features
Also fixes it not enabling in D3D12 renderer.
This commit is contained in:
parent
389276bb03
commit
fb3e290133
|
@ -629,7 +629,7 @@ bool GPUThread::CreateDeviceOnThread(RenderAPI api, bool fullscreen, bool clear_
|
||||||
g_gpu_device = GPUDevice::CreateDeviceForAPI(api);
|
g_gpu_device = GPUDevice::CreateDeviceForAPI(api);
|
||||||
|
|
||||||
std::optional<GPUDevice::ExclusiveFullscreenMode> fullscreen_mode;
|
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 =
|
fullscreen_mode =
|
||||||
GPUDevice::ExclusiveFullscreenMode::Parse(Host::GetTinyStringSettingValue("GPU", "FullscreenMode", ""));
|
GPUDevice::ExclusiveFullscreenMode::Parse(Host::GetTinyStringSettingValue("GPU", "FullscreenMode", ""));
|
||||||
|
@ -1140,7 +1140,7 @@ void GPUThread::UpdateDisplayWindowOnThread(bool fullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::optional<GPUDevice::ExclusiveFullscreenMode> fullscreen_mode;
|
std::optional<GPUDevice::ExclusiveFullscreenMode> fullscreen_mode;
|
||||||
if (fullscreen && g_gpu_device->SupportsExclusiveFullscreen())
|
if (fullscreen && g_gpu_device->GetFeatures().exclusive_fullscreen)
|
||||||
{
|
{
|
||||||
fullscreen_mode =
|
fullscreen_mode =
|
||||||
GPUDevice::ExclusiveFullscreenMode::Parse(Host::GetTinyStringSettingValue("GPU", "FullscreenMode", ""));
|
GPUDevice::ExclusiveFullscreenMode::Parse(Host::GetTinyStringSettingValue("GPU", "FullscreenMode", ""));
|
||||||
|
|
|
@ -48,6 +48,7 @@ void SetD3DDebugObjectName(ID3D11DeviceChild* obj, std::string_view name)
|
||||||
D3D11Device::D3D11Device()
|
D3D11Device::D3D11Device()
|
||||||
{
|
{
|
||||||
m_render_api = RenderAPI::D3D11;
|
m_render_api = RenderAPI::D3D11;
|
||||||
|
m_features.exclusive_fullscreen = true; // set so the caller can pass a mode to CreateDeviceAndSwapChain()
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11Device::~D3D11Device()
|
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);
|
(!(disabled_features & FEATURE_MASK_COMPUTE_SHADERS) && feature_level >= D3D_FEATURE_LEVEL_11_0);
|
||||||
m_features.partial_msaa_resolve = false;
|
m_features.partial_msaa_resolve = false;
|
||||||
m_features.memory_import = false;
|
m_features.memory_import = false;
|
||||||
|
m_features.exclusive_fullscreen = true;
|
||||||
m_features.explicit_present = false;
|
m_features.explicit_present = false;
|
||||||
m_features.timed_present = false;
|
m_features.timed_present = false;
|
||||||
m_features.gpu_timing = true;
|
m_features.gpu_timing = true;
|
||||||
|
@ -470,11 +472,6 @@ std::unique_ptr<GPUSwapChain> D3D11Device::CreateSwapChain(const WindowInfo& wi,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool D3D11Device::SupportsExclusiveFullscreen() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string D3D11Device::GetDriverInfo() const
|
std::string D3D11Device::GetDriverInfo() const
|
||||||
{
|
{
|
||||||
std::string ret = fmt::format("{} (Shader Model {})\n", D3DCommon::GetFeatureLevelString(m_render_api_version),
|
std::string ret = fmt::format("{} (Shader Model {})\n", D3DCommon::GetFeatureLevelString(m_render_api_version),
|
||||||
|
|
|
@ -37,8 +37,6 @@ public:
|
||||||
ALWAYS_INLINE static IDXGIFactory5* GetDXGIFactory() { return GetInstance().m_dxgi_factory.Get(); }
|
ALWAYS_INLINE static IDXGIFactory5* GetDXGIFactory() { return GetInstance().m_dxgi_factory.Get(); }
|
||||||
ALWAYS_INLINE static D3D_FEATURE_LEVEL GetMaxFeatureLevel() { return GetInstance().m_max_feature_level; }
|
ALWAYS_INLINE static D3D_FEATURE_LEVEL GetMaxFeatureLevel() { return GetInstance().m_max_feature_level; }
|
||||||
|
|
||||||
bool SupportsExclusiveFullscreen() const override;
|
|
||||||
|
|
||||||
std::string GetDriverInfo() const override;
|
std::string GetDriverInfo() const override;
|
||||||
|
|
||||||
void FlushCommands() override;
|
void FlushCommands() override;
|
||||||
|
|
|
@ -116,6 +116,7 @@ static constexpr const u32 s_mipmap_blit_ps[] = {
|
||||||
D3D12Device::D3D12Device()
|
D3D12Device::D3D12Device()
|
||||||
{
|
{
|
||||||
m_render_api = RenderAPI::D3D12;
|
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
|
#ifdef ENABLE_GPU_OBJECT_NAMES
|
||||||
s_debug_scope_depth = 0;
|
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.compute_shaders = !(disabled_features & FEATURE_MASK_COMPUTE_SHADERS);
|
||||||
m_features.partial_msaa_resolve = true;
|
m_features.partial_msaa_resolve = true;
|
||||||
m_features.memory_import = false;
|
m_features.memory_import = false;
|
||||||
|
m_features.exclusive_fullscreen = true;
|
||||||
m_features.explicit_present = true;
|
m_features.explicit_present = true;
|
||||||
m_features.timed_present = false;
|
m_features.timed_present = false;
|
||||||
m_features.gpu_timing = true;
|
m_features.gpu_timing = true;
|
||||||
|
|
|
@ -506,11 +506,6 @@ void GPUDevice::DestroyMainSwapChain()
|
||||||
m_main_swap_chain.reset();
|
m_main_swap_chain.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPUDevice::SupportsExclusiveFullscreen() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GPUDevice::OpenShaderCache(std::string_view base_path, u32 version)
|
void GPUDevice::OpenShaderCache(std::string_view base_path, u32 version)
|
||||||
{
|
{
|
||||||
if (m_features.shader_cache && !base_path.empty())
|
if (m_features.shader_cache && !base_path.empty())
|
||||||
|
|
|
@ -596,6 +596,7 @@ public:
|
||||||
bool compute_shaders : 1;
|
bool compute_shaders : 1;
|
||||||
bool partial_msaa_resolve : 1;
|
bool partial_msaa_resolve : 1;
|
||||||
bool memory_import : 1;
|
bool memory_import : 1;
|
||||||
|
bool exclusive_fullscreen : 1;
|
||||||
bool explicit_present : 1;
|
bool explicit_present : 1;
|
||||||
bool timed_present : 1;
|
bool timed_present : 1;
|
||||||
bool gpu_timing : 1;
|
bool gpu_timing : 1;
|
||||||
|
@ -740,8 +741,6 @@ public:
|
||||||
std::optional<bool> exclusive_fullscreen_control, Error* error);
|
std::optional<bool> exclusive_fullscreen_control, Error* error);
|
||||||
void DestroyMainSwapChain();
|
void DestroyMainSwapChain();
|
||||||
|
|
||||||
virtual bool SupportsExclusiveFullscreen() const;
|
|
||||||
|
|
||||||
virtual std::string GetDriverInfo() const = 0;
|
virtual std::string GetDriverInfo() const = 0;
|
||||||
|
|
||||||
// Flushes current command buffer, but does not wait for completion.
|
// Flushes current command buffer, but does not wait for completion.
|
||||||
|
|
|
@ -385,6 +385,7 @@ void MetalDevice::SetFeatures(FeatureMask disabled_features)
|
||||||
m_features.geometry_shaders = false;
|
m_features.geometry_shaders = false;
|
||||||
m_features.partial_msaa_resolve = false;
|
m_features.partial_msaa_resolve = false;
|
||||||
m_features.memory_import = true;
|
m_features.memory_import = true;
|
||||||
|
m_features.exclusive_fullscreen = false;
|
||||||
m_features.explicit_present = false;
|
m_features.explicit_present = false;
|
||||||
m_features.timed_present = true;
|
m_features.timed_present = true;
|
||||||
m_features.shader_cache = true;
|
m_features.shader_cache = true;
|
||||||
|
|
|
@ -489,6 +489,7 @@ bool OpenGLDevice::CheckFeatures(FeatureMask disabled_features)
|
||||||
(!GLAD_GL_EXT_disjoint_timer_query || !glGetQueryObjectivEXT || !glGetQueryObjectui64vEXT));
|
(!GLAD_GL_EXT_disjoint_timer_query || !glGetQueryObjectivEXT || !glGetQueryObjectui64vEXT));
|
||||||
m_features.partial_msaa_resolve = true;
|
m_features.partial_msaa_resolve = true;
|
||||||
m_features.memory_import = true;
|
m_features.memory_import = true;
|
||||||
|
m_features.exclusive_fullscreen = false;
|
||||||
m_features.explicit_present = false;
|
m_features.explicit_present = false;
|
||||||
m_features.timed_present = false;
|
m_features.timed_present = false;
|
||||||
|
|
||||||
|
|
|
@ -2455,6 +2455,7 @@ void VulkanDevice::SetFeatures(FeatureMask disabled_features, const VkPhysicalDe
|
||||||
|
|
||||||
m_features.partial_msaa_resolve = true;
|
m_features.partial_msaa_resolve = true;
|
||||||
m_features.memory_import = m_optional_extensions.vk_ext_external_memory_host;
|
m_features.memory_import = m_optional_extensions.vk_ext_external_memory_host;
|
||||||
|
m_features.exclusive_fullscreen = false;
|
||||||
m_features.explicit_present = true;
|
m_features.explicit_present = true;
|
||||||
m_features.timed_present = false;
|
m_features.timed_present = false;
|
||||||
m_features.shader_cache = true;
|
m_features.shader_cache = true;
|
||||||
|
|
Loading…
Reference in New Issue