Settings: Expose exclusive fullscreen control
This commit is contained in:
@ -64,7 +64,7 @@ bool D3D11Device::HasSurface() const
|
||||
}
|
||||
|
||||
bool D3D11Device::CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features)
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features)
|
||||
{
|
||||
std::unique_lock lock(s_instance_mutex);
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features) override;
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features) override;
|
||||
void DestroyDevice() override;
|
||||
|
||||
private:
|
||||
|
||||
@ -117,7 +117,7 @@ D3D12Device::ComPtr<ID3D12RootSignature> D3D12Device::CreateRootSignature(const
|
||||
}
|
||||
|
||||
bool D3D12Device::CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features)
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features)
|
||||
{
|
||||
std::unique_lock lock(s_instance_mutex);
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features) override;
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features) override;
|
||||
void DestroyDevice() override;
|
||||
|
||||
bool ReadPipelineCache(const std::string& filename) override;
|
||||
|
||||
@ -258,7 +258,7 @@ bool GPUDevice::IsSameRenderAPI(RenderAPI lhs, RenderAPI rhs)
|
||||
|
||||
bool GPUDevice::Create(const std::string_view& adapter, const std::string_view& shader_cache_path,
|
||||
u32 shader_cache_version, bool debug_device, bool vsync, bool threaded_presentation,
|
||||
FeatureMask disabled_features)
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features)
|
||||
{
|
||||
m_vsync_enabled = vsync;
|
||||
m_debug_device = debug_device;
|
||||
@ -269,7 +269,7 @@ bool GPUDevice::Create(const std::string_view& adapter, const std::string_view&
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CreateDevice(adapter, threaded_presentation, disabled_features))
|
||||
if (!CreateDevice(adapter, threaded_presentation, exclusive_fullscreen_control, disabled_features))
|
||||
{
|
||||
Log_ErrorPrintf("Failed to create device.");
|
||||
return false;
|
||||
|
||||
@ -536,7 +536,8 @@ public:
|
||||
virtual RenderAPI GetRenderAPI() const = 0;
|
||||
|
||||
bool Create(const std::string_view& adapter, const std::string_view& shader_cache_path, u32 shader_cache_version,
|
||||
bool debug_device, bool vsync, bool threaded_presentation, FeatureMask disabled_features);
|
||||
bool debug_device, bool vsync, bool threaded_presentation,
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features);
|
||||
void Destroy();
|
||||
|
||||
virtual bool HasSurface() const = 0;
|
||||
@ -651,7 +652,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual bool CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features) = 0;
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features) = 0;
|
||||
virtual void DestroyDevice() = 0;
|
||||
|
||||
std::string GetShaderCacheBaseName(const std::string_view& type) const;
|
||||
@ -775,7 +776,8 @@ struct GLAutoPop
|
||||
#define GL_INS(msg) g_gpu_device->InsertDebugMessage(msg)
|
||||
#define GL_OBJECT_NAME(obj, name) (obj)->SetDebugName(name)
|
||||
|
||||
#define GL_SCOPE_FMT(...) GLAutoPop gl_auto_pop((g_gpu_device->PushDebugGroup(SmallString::from_format(__VA_ARGS__)), 0))
|
||||
#define GL_SCOPE_FMT(...) \
|
||||
GLAutoPop gl_auto_pop((g_gpu_device->PushDebugGroup(SmallString::from_format(__VA_ARGS__)), 0))
|
||||
#define GL_PUSH_FMT(...) g_gpu_device->PushDebugGroup(SmallString::from_format(__VA_ARGS__))
|
||||
#define GL_INS_FMT(...) g_gpu_device->InsertDebugMessage(SmallString::from_format(__VA_ARGS__))
|
||||
#define GL_OBJECT_NAME_FMT(obj, ...) (obj)->SetDebugName(SmallString::from_format(__VA_ARGS__))
|
||||
|
||||
@ -257,7 +257,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features) override;
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features) override;
|
||||
void DestroyDevice() override;
|
||||
|
||||
private:
|
||||
|
||||
@ -121,6 +121,7 @@ void MetalDevice::SetVSync(bool enabled)
|
||||
}
|
||||
|
||||
bool MetalDevice::CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
std::optional<bool> exclusive_fullscreen_control,
|
||||
FeatureMask disabled_features)
|
||||
{
|
||||
@autoreleasepool
|
||||
|
||||
@ -307,7 +307,7 @@ bool OpenGLDevice::HasSurface() const
|
||||
}
|
||||
|
||||
bool OpenGLDevice::CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features)
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features)
|
||||
{
|
||||
m_gl_context = GL::Context::Create(m_window_info);
|
||||
if (!m_gl_context)
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features) override;
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features) override;
|
||||
void DestroyDevice() override;
|
||||
|
||||
bool ReadPipelineCache(const std::string& filename) override;
|
||||
|
||||
@ -1836,12 +1836,11 @@ bool VulkanDevice::HasSurface() const
|
||||
}
|
||||
|
||||
bool VulkanDevice::CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features)
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features)
|
||||
{
|
||||
std::unique_lock lock(s_instance_mutex);
|
||||
bool enable_debug_utils = m_debug_device;
|
||||
bool enable_validation_layer = m_debug_device;
|
||||
std::optional<bool> exclusive_fullscreen_control;
|
||||
|
||||
if (!Vulkan::LoadVulkanLibrary())
|
||||
{
|
||||
@ -1953,9 +1952,11 @@ bool VulkanDevice::CreateDevice(const std::string_view& adapter, bool threaded_p
|
||||
if (threaded_presentation)
|
||||
StartPresentThread();
|
||||
|
||||
m_exclusive_fullscreen_control = exclusive_fullscreen_control;
|
||||
|
||||
if (surface != VK_NULL_HANDLE)
|
||||
{
|
||||
m_swap_chain = VulkanSwapChain::Create(m_window_info, surface, m_vsync_enabled, exclusive_fullscreen_control);
|
||||
m_swap_chain = VulkanSwapChain::Create(m_window_info, surface, m_vsync_enabled, m_exclusive_fullscreen_control);
|
||||
if (!m_swap_chain)
|
||||
{
|
||||
Log_ErrorPrintf("Failed to create swap chain");
|
||||
@ -2174,8 +2175,7 @@ bool VulkanDevice::UpdateWindow()
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: exclusive fullscreen control
|
||||
m_swap_chain = VulkanSwapChain::Create(m_window_info, surface, m_vsync_enabled, std::nullopt);
|
||||
m_swap_chain = VulkanSwapChain::Create(m_window_info, surface, m_vsync_enabled, m_exclusive_fullscreen_control);
|
||||
if (!m_swap_chain)
|
||||
{
|
||||
Log_ErrorPrintf("Failed to create swap chain");
|
||||
|
||||
@ -218,7 +218,7 @@ public:
|
||||
|
||||
protected:
|
||||
bool CreateDevice(const std::string_view& adapter, bool threaded_presentation,
|
||||
FeatureMask disabled_features) override;
|
||||
std::optional<bool> exclusive_fullscreen_control, FeatureMask disabled_features) override;
|
||||
void DestroyDevice() override;
|
||||
|
||||
bool ReadPipelineCache(const std::string& filename) override;
|
||||
@ -428,6 +428,7 @@ private:
|
||||
VkPhysicalDeviceProperties m_device_properties = {};
|
||||
VkPhysicalDeviceDriverPropertiesKHR m_device_driver_properties = {};
|
||||
OptionalExtensions m_optional_extensions = {};
|
||||
std::optional<bool> m_exclusive_fullscreen_control;
|
||||
|
||||
std::unique_ptr<VulkanSwapChain> m_swap_chain;
|
||||
std::unique_ptr<VulkanTexture> m_null_texture;
|
||||
|
||||
Reference in New Issue
Block a user