Build: Make OpenGL/Vulkan renderers optional

And disabled on Windows/arm64.
This commit is contained in:
Connor McLaughlin 2022-07-31 01:06:40 +10:00
parent cb127b6412
commit a899ca88f2
20 changed files with 396 additions and 173 deletions

View File

@ -25,6 +25,8 @@ if(NOT ANDROID)
option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" ON)
option(BUILD_QT_FRONTEND "Build the Qt frontend" ON)
option(BUILD_REGTEST "Build regression test runner" OFF)
option(ENABLE_OPENGL "Build with OpenGL renderer" ON)
option(ENABLE_VULKAN "Build with Vulkan renderer" ON)
option(ENABLE_DISCORD_PRESENCE "Build with Discord Rich Presence support" ON)
option(ENABLE_CHEEVOS "Build with RetroAchievements support" ON)
option(USE_SDL2 "Link with SDL2 for controller support" ON)

View File

@ -130,13 +130,11 @@ Global
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{43540154-9E1E-409C-834F-B84BE5621388}.Debug|ARM64.ActiveCfg = Debug|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.Debug|ARM64.Build.0 = Debug|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.Debug|x64.ActiveCfg = Debug|x64
{43540154-9E1E-409C-834F-B84BE5621388}.Debug|x64.Build.0 = Debug|x64
{43540154-9E1E-409C-834F-B84BE5621388}.Debug|x86.ActiveCfg = Debug|Win32
{43540154-9E1E-409C-834F-B84BE5621388}.Debug|x86.Build.0 = Debug|Win32
{43540154-9E1E-409C-834F-B84BE5621388}.DebugFast|ARM64.ActiveCfg = DebugFast|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.DebugFast|ARM64.Build.0 = DebugFast|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.DebugFast|x64.ActiveCfg = DebugFast|x64
{43540154-9E1E-409C-834F-B84BE5621388}.DebugFast|x64.Build.0 = DebugFast|x64
{43540154-9E1E-409C-834F-B84BE5621388}.DebugFast|x86.ActiveCfg = DebugFast|Win32
@ -145,13 +143,11 @@ Global
{43540154-9E1E-409C-834F-B84BE5621388}.DebugUWP|x64.ActiveCfg = DebugUWP|x64
{43540154-9E1E-409C-834F-B84BE5621388}.DebugUWP|x86.ActiveCfg = DebugUWP|Win32
{43540154-9E1E-409C-834F-B84BE5621388}.Release|ARM64.ActiveCfg = Release|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.Release|ARM64.Build.0 = Release|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.Release|x64.ActiveCfg = Release|x64
{43540154-9E1E-409C-834F-B84BE5621388}.Release|x64.Build.0 = Release|x64
{43540154-9E1E-409C-834F-B84BE5621388}.Release|x86.ActiveCfg = Release|Win32
{43540154-9E1E-409C-834F-B84BE5621388}.Release|x86.Build.0 = Release|Win32
{43540154-9E1E-409C-834F-B84BE5621388}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.ReleaseLTCG|ARM64.Build.0 = ReleaseLTCG|ARM64
{43540154-9E1E-409C-834F-B84BE5621388}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64
{43540154-9E1E-409C-834F-B84BE5621388}.ReleaseLTCG|x64.Build.0 = ReleaseLTCG|x64
{43540154-9E1E-409C-834F-B84BE5621388}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|Win32
@ -700,13 +696,11 @@ Global
{4266505B-DBAF-484B-AB31-B53B9C8235B3}.ReleaseUWP|x64.ActiveCfg = ReleaseUWP|x64
{4266505B-DBAF-484B-AB31-B53B9C8235B3}.ReleaseUWP|x86.ActiveCfg = ReleaseUWP|Win32
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Debug|ARM64.ActiveCfg = Debug|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Debug|ARM64.Build.0 = Debug|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Debug|x64.ActiveCfg = Debug|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Debug|x64.Build.0 = Debug|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Debug|x86.ActiveCfg = Debug|Win32
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Debug|x86.Build.0 = Debug|Win32
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugFast|ARM64.ActiveCfg = DebugFast|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugFast|ARM64.Build.0 = DebugFast|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugFast|x64.ActiveCfg = DebugFast|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugFast|x64.Build.0 = DebugFast|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugFast|x86.ActiveCfg = DebugFast|Win32
@ -715,13 +709,11 @@ Global
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugUWP|x64.ActiveCfg = DebugUWP|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.DebugUWP|x86.ActiveCfg = DebugUWP|Win32
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Release|ARM64.ActiveCfg = Release|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Release|ARM64.Build.0 = Release|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Release|x64.ActiveCfg = Release|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Release|x64.Build.0 = Release|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Release|x86.ActiveCfg = Release|Win32
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.Release|x86.Build.0 = Release|Win32
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.ReleaseLTCG|ARM64.Build.0 = ReleaseLTCG|ARM64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.ReleaseLTCG|x64.Build.0 = ReleaseLTCG|x64
{7F909E29-4808-4BD9-A60C-56C51A3AAEC2}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|Win32

View File

@ -16,16 +16,6 @@ add_library(common
file_system.h
image.cpp
image.h
gl/context.cpp
gl/context.h
gl/program.cpp
gl/program.h
gl/shader_cache.cpp
gl/shader_cache.h
gl/stream_buffer.cpp
gl/stream_buffer.h
gl/texture.cpp
gl/texture.h
hash_combine.h
heap_array.h
heterogeneous_containers.h
@ -58,28 +48,6 @@ add_library(common
timer.cpp
timer.h
types.h
vulkan/builders.cpp
vulkan/builders.h
vulkan/context.cpp
vulkan/context.h
vulkan/loader.h
vulkan/loader.cpp
vulkan/shader_cache.cpp
vulkan/shader_cache.h
vulkan/shader_compiler.cpp
vulkan/shader_compiler.h
vulkan/staging_buffer.cpp
vulkan/staging_buffer.h
vulkan/staging_texture.cpp
vulkan/staging_texture.h
vulkan/stream_buffer.cpp
vulkan/stream_buffer.h
vulkan/swap_chain.cpp
vulkan/swap_chain.h
vulkan/texture.cpp
vulkan/texture.h
vulkan/util.cpp
vulkan/util.h
window_info.cpp
window_info.h
)
@ -87,7 +55,7 @@ add_library(common
target_include_directories(common PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(common PUBLIC fmt Threads::Threads vulkan-headers)
target_link_libraries(common PRIVATE glad stb libchdr glslang zlib minizip "${CMAKE_DL_LIBS}")
target_link_libraries(common PRIVATE stb libchdr zlib minizip "${CMAKE_DL_LIBS}")
if(WIN32)
target_sources(common PRIVATE
@ -115,8 +83,6 @@ if(WIN32)
d3d11/stream_buffer.h
d3d11/texture.cpp
d3d11/texture.h
gl/context_wgl.cpp
gl/context_wgl.h
thirdparty/StackWalker.cpp
thirdparty/StackWalker.h
win32_progress_callback.cpp
@ -132,14 +98,18 @@ endif()
if(USE_X11)
target_sources(common PRIVATE
gl/x11_window.cpp
gl/x11_window.h
gl/x11_window.cpp
gl/x11_window.h
)
target_compile_definitions(common PRIVATE "-DUSE_X11=1")
target_include_directories(common PRIVATE "${X11_INCLUDE_DIR}" "${X11_Xrandr_INCLUDE_PATH}")
target_link_libraries(common PRIVATE "${X11_LIBRARIES}" "${X11_Xrandr_LIB}")
endif()
if(USE_WAYLAND)
target_compile_definitions(common PRIVATE "-DUSE_WAYLAND=1")
endif()
if(USE_DRMKMS)
target_sources(common PRIVATE
drm_display.cpp
@ -148,71 +118,128 @@ if(USE_DRMKMS)
target_link_libraries(common PUBLIC Libdrm::Libdrm)
endif()
if(USE_EGL)
if(ENABLE_OPENGL)
target_sources(common PRIVATE
gl/context_egl.cpp
gl/context_egl.h
gl/context.cpp
gl/context.h
gl/program.cpp
gl/program.h
gl/shader_cache.cpp
gl/shader_cache.h
gl/stream_buffer.cpp
gl/stream_buffer.h
gl/texture.cpp
gl/texture.h
)
target_compile_definitions(common PRIVATE "-DUSE_EGL=1")
target_compile_definitions(common PUBLIC "WITH_OPENGL=1")
target_link_libraries(common PRIVATE glad)
if(WIN32)
target_sources(common PRIVATE
gl/context_wgl.cpp
gl/context_wgl.h
)
endif()
if(USE_EGL)
target_sources(common PRIVATE
gl/context_egl.cpp
gl/context_egl.h
)
target_compile_definitions(common PRIVATE "-DUSE_EGL=1")
if(USE_X11)
target_sources(common PRIVATE
gl/context_egl_x11.cpp
gl/context_egl_x11.h
)
# We set EGL_NO_X11 because otherwise X comes in with its macros and breaks
# a bunch of files from compiling, if we include the EGL headers. This just
# makes the data types opaque, we can still use it with X11 if needed.
target_compile_definitions(common PRIVATE "-DEGL_NO_X11=1")
endif()
if(ANDROID AND USE_EGL)
target_sources(common PRIVATE
gl/context_egl_android.cpp
gl/context_egl_android.h
)
endif()
if(USE_DRMKMS)
target_compile_definitions(common PRIVATE "-DUSE_GBM=1")
target_sources(common PRIVATE
gl/context_egl_gbm.cpp
gl/context_egl_gbm.h
)
target_link_libraries(common PUBLIC GBM::GBM)
endif()
if(USE_FBDEV)
target_compile_definitions(common PRIVATE "-DUSE_FBDEV=1")
target_sources(common PRIVATE
gl/context_egl_fbdev.cpp
gl/context_egl_fbdev.h
)
endif()
endif()
if(USE_X11)
target_sources(common PRIVATE
gl/context_egl_x11.cpp
gl/context_egl_x11.h
gl/context_glx.cpp
gl/context_glx.h
)
# We set EGL_NO_X11 because otherwise X comes in with its macros and breaks
# a bunch of files from compiling, if we include the EGL headers. This just
# makes the data types opaque, we can still use it with X11 if needed.
target_compile_definitions(common PRIVATE "-DEGL_NO_X11=1")
target_compile_definitions(common PRIVATE "-DUSE_GLX=1")
endif()
if(ANDROID AND USE_EGL)
if(USE_WAYLAND)
target_sources(common PRIVATE
gl/context_egl_android.cpp
gl/context_egl_android.h
gl/context_egl_wayland.cpp
gl/context_egl_wayland.h
)
endif()
if(USE_DRMKMS)
target_compile_definitions(common PRIVATE "-DUSE_GBM=1")
if(APPLE)
target_sources(common PRIVATE
gl/context_egl_gbm.cpp
gl/context_egl_gbm.h
)
target_link_libraries(common PUBLIC GBM::GBM)
endif()
if(USE_FBDEV)
target_compile_definitions(common PRIVATE "-DUSE_FBDEV=1")
target_sources(common PRIVATE
gl/context_egl_fbdev.cpp
gl/context_egl_fbdev.h
gl/context_agl.mm
gl/context_agl.h
)
endif()
endif()
if(USE_X11)
if(ENABLE_VULKAN)
target_sources(common PRIVATE
gl/context_glx.cpp
gl/context_glx.h
vulkan/builders.cpp
vulkan/builders.h
vulkan/context.cpp
vulkan/context.h
vulkan/loader.h
vulkan/loader.cpp
vulkan/shader_cache.cpp
vulkan/shader_cache.h
vulkan/shader_compiler.cpp
vulkan/shader_compiler.h
vulkan/staging_buffer.cpp
vulkan/staging_buffer.h
vulkan/staging_texture.cpp
vulkan/staging_texture.h
vulkan/stream_buffer.cpp
vulkan/stream_buffer.h
vulkan/swap_chain.cpp
vulkan/swap_chain.h
vulkan/texture.cpp
vulkan/texture.h
vulkan/util.cpp
vulkan/util.h
)
target_compile_definitions(common PRIVATE "-DUSE_GLX=1")
target_compile_definitions(common PUBLIC "WITH_VULKAN=1")
target_link_libraries(common PRIVATE glslang)
if(APPLE)
# Needed for Vulkan Swap Chain.
target_link_libraries(common PRIVATE "objc")
endif()
endif()
if(USE_WAYLAND)
target_sources(common PRIVATE
gl/context_egl_wayland.cpp
gl/context_egl_wayland.h
)
target_compile_definitions(common PRIVATE "-DUSE_WAYLAND=1")
endif()
if(APPLE)
# Needed for Vulkan Swap Chain.
target_link_libraries(common PRIVATE "objc")
target_sources(common PRIVATE
gl/context_agl.mm
gl/context_agl.h
)
endif()
if(ENABLE_CHEEVOS)
target_sources(common PRIVATE

View File

@ -2,13 +2,16 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)dep\fmt\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan\include;$(SolutionDir)dep\stb\include;$(SolutionDir)dep\glslang;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\minizip\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="('$(BuildingForUWP)'!='true' And '$(Platform)'!='ARM64')">WITH_OPENGL=1;WITH_VULKAN=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="('$(BuildingForUWP)'!='true' And '$(Platform)'!='ARM64')">$(SolutionDir)dep\glad\include;$(SolutionDir)dep\vulkan\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)dep\fmt\include;$(SolutionDir)dep\stb\include;$(SolutionDir)dep\glslang;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\minizip\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>$(RootBuildDir)fmt\fmt.lib;$(RootBuildDir)glad\glad.lib;$(RootBuildDir)glslang\glslang.lib;$(RootBuildDir)zlib\zlib.lib;$(RootBuildDir)minizip\minizip.lib;$(RootBuildDir)lzma\lzma.lib;d3dcompiler.lib;d3d11.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="('$(BuildingForUWP)'!='true' And '$(Platform)'!='ARM64')">$(RootBuildDir)glad\glad.lib;$(RootBuildDir)glslang\glslang.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(RootBuildDir)fmt\fmt.lib;$(RootBuildDir)zlib\zlib.lib;$(RootBuildDir)minizip\minizip.lib;$(RootBuildDir)lzma\lzma.lib;d3dcompiler.lib;d3d11.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -25,15 +25,27 @@
<ClInclude Include="error.h" />
<ClInclude Include="fifo_queue.h" />
<ClInclude Include="file_system.h" />
<ClInclude Include="gl\context.h" />
<ClInclude Include="gl\context_wgl.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM' Or '$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
<ClInclude Include="gl\context.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\context_wgl.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\loader.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\program.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\shader_cache.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\stream_buffer.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\texture.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gl\loader.h" />
<ClInclude Include="gl\program.h" />
<ClInclude Include="gl\shader_cache.h" />
<ClInclude Include="gl\stream_buffer.h" />
<ClInclude Include="gl\texture.h" />
<ClInclude Include="hash_combine.h" />
<ClInclude Include="heap_array.h" />
<ClInclude Include="http_downloader.h" />
@ -67,18 +79,42 @@
<ClInclude Include="timer.h" />
<ClInclude Include="types.h" />
<ClInclude Include="minizip_helpers.h" />
<ClInclude Include="vulkan\builders.h" />
<ClInclude Include="vulkan\context.h" />
<ClInclude Include="vulkan\entry_points.h" />
<ClInclude Include="vulkan\loader.h" />
<ClInclude Include="vulkan\shader_cache.h" />
<ClInclude Include="vulkan\shader_compiler.h" />
<ClInclude Include="vulkan\staging_buffer.h" />
<ClInclude Include="vulkan\staging_texture.h" />
<ClInclude Include="vulkan\stream_buffer.h" />
<ClInclude Include="vulkan\swap_chain.h" />
<ClInclude Include="vulkan\texture.h" />
<ClInclude Include="vulkan\util.h" />
<ClInclude Include="vulkan\builders.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\context.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\entry_points.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\loader.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\shader_cache.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\shader_compiler.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\staging_buffer.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\staging_texture.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\stream_buffer.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\swap_chain.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\texture.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="vulkan\util.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="win32_progress_callback.h">
<ExcludedFromBuild Condition="'$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
@ -103,14 +139,24 @@
<ClCompile Include="d3d12\texture.cpp" />
<ClCompile Include="d3d12\util.cpp" />
<ClCompile Include="file_system.cpp" />
<ClCompile Include="gl\context.cpp" />
<ClCompile Include="gl\context_wgl.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM' Or '$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
<ClCompile Include="gl\context.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl\context_wgl.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl\program.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl\shader_cache.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl\stream_buffer.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl\texture.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gl\program.cpp" />
<ClCompile Include="gl\shader_cache.cpp" />
<ClCompile Include="gl\stream_buffer.cpp" />
<ClCompile Include="gl\texture.cpp" />
<ClCompile Include="http_downloader.cpp" />
<ClCompile Include="http_downloader_uwp.cpp">
<ExcludedFromBuild Condition="'$(BuildingForUWP)'!='true'">true</ExcludedFromBuild>
@ -132,17 +178,39 @@
</ClCompile>
<ClCompile Include="threading.cpp" />
<ClCompile Include="timer.cpp" />
<ClCompile Include="vulkan\builders.cpp" />
<ClCompile Include="vulkan\context.cpp" />
<ClCompile Include="vulkan\loader.cpp" />
<ClCompile Include="vulkan\shader_cache.cpp" />
<ClCompile Include="vulkan\shader_compiler.cpp" />
<ClCompile Include="vulkan\staging_buffer.cpp" />
<ClCompile Include="vulkan\staging_texture.cpp" />
<ClCompile Include="vulkan\stream_buffer.cpp" />
<ClCompile Include="vulkan\swap_chain.cpp" />
<ClCompile Include="vulkan\texture.cpp" />
<ClCompile Include="vulkan\util.cpp" />
<ClCompile Include="vulkan\builders.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\context.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\loader.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\shader_cache.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\shader_compiler.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\staging_buffer.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\staging_texture.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\stream_buffer.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\swap_chain.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\texture.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="vulkan\util.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="win32_progress_callback.cpp">
<ExcludedFromBuild Condition="'$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
@ -152,7 +220,9 @@
<Natvis Include="bitfield.natvis" />
</ItemGroup>
<ItemGroup>
<None Include="vulkan\entry_points.inl" />
<None Include="vulkan\entry_points.inl">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</None>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{EE054E08-3799-4A59-A422-18259C105FFD}</ProjectGuid>

View File

@ -11,7 +11,7 @@ Log_SetChannel(GL::Context);
#if defined(_WIN32) && !defined(_M_ARM64)
#include "context_wgl.h"
#elif defined(__APPLE__) && !defined(LIBERTRO)
#elif defined(__APPLE__)
#include "context_agl.h"
#endif

View File

@ -40,12 +40,8 @@ add_library(core
gpu_commands.cpp
gpu_hw.cpp
gpu_hw.h
gpu_hw_opengl.cpp
gpu_hw_opengl.h
gpu_hw_shadergen.cpp
gpu_hw_shadergen.h
gpu_hw_vulkan.cpp
gpu_hw_vulkan.h
gpu_sw.cpp
gpu_sw.h
gpu_sw_backend.cpp
@ -121,7 +117,7 @@ set(RECOMPILER_SRCS
target_include_directories(core PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(core PUBLIC Threads::Threads common util zlib)
target_link_libraries(core PRIVATE glad stb xxhash imgui rapidjson tinyxml2)
target_link_libraries(core PRIVATE stb xxhash imgui rapidjson tinyxml2)
if(WIN32)
target_sources(core PRIVATE
@ -133,6 +129,21 @@ if(WIN32)
target_link_libraries(core PRIVATE winmm.lib)
endif()
if(ENABLE_OPENGL)
target_sources(core PRIVATE
gpu_hw_opengl.cpp
gpu_hw_opengl.h
)
target_link_libraries(core PRIVATE glad)
endif()
if(ENABLE_VULKAN)
target_sources(core PRIVATE
gpu_hw_vulkan.cpp
gpu_hw_vulkan.h
)
endif()
if(${CPU_ARCH} STREQUAL "x64")
target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../dep/xbyak/xbyak")
target_compile_definitions(core PUBLIC "WITH_RECOMPILER=1" "WITH_MMAP_FASTMEM=1")

View File

@ -38,7 +38,9 @@
<ClCompile Include="gpu_hw_d3d11.cpp" />
<ClCompile Include="gpu_hw_d3d12.cpp" />
<ClCompile Include="gpu_hw_shadergen.cpp" />
<ClCompile Include="gpu_hw_vulkan.cpp" />
<ClCompile Include="gpu_hw_vulkan.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="gpu_sw.cpp" />
<ClCompile Include="gpu_sw_backend.cpp" />
<ClCompile Include="gte.cpp" />
@ -46,7 +48,9 @@
<ClCompile Include="gdb_protocol.cpp" />
<ClCompile Include="gpu.cpp" />
<ClCompile Include="gpu_hw.cpp" />
<ClCompile Include="gpu_hw_opengl.cpp" />
<ClCompile Include="gpu_hw_opengl.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="host.cpp" />
<ClCompile Include="host_display.cpp" />
<ClCompile Include="host_interface_progress_callback.cpp" />
@ -104,7 +108,9 @@
<ClInclude Include="gpu_hw_d3d11.h" />
<ClInclude Include="gpu_hw_d3d12.h" />
<ClInclude Include="gpu_hw_shadergen.h" />
<ClInclude Include="gpu_hw_vulkan.h" />
<ClInclude Include="gpu_hw_vulkan.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gpu_sw.h" />
<ClInclude Include="gpu_sw_backend.h" />
<ClInclude Include="gpu_types.h" />
@ -114,7 +120,9 @@
<ClInclude Include="gdb_protocol.h" />
<ClInclude Include="gpu.h" />
<ClInclude Include="gpu_hw.h" />
<ClInclude Include="gpu_hw_opengl.h" />
<ClInclude Include="gpu_hw_opengl.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="gte_types.h" />
<ClInclude Include="host.h" />
<ClInclude Include="host_display.h" />

View File

@ -150,17 +150,23 @@ public:
float ComputeVerticalFrequency() const;
float GetDisplayAspectRatio() const;
#ifdef _WIN32
// gpu_hw_d3d11.cpp
static std::unique_ptr<GPU> CreateHardwareD3D11Renderer();
// gpu_hw_d3d12.cpp
static std::unique_ptr<GPU> CreateHardwareD3D12Renderer();
#endif
#ifdef WITH_OPENGL
// gpu_hw_opengl.cpp
static std::unique_ptr<GPU> CreateHardwareOpenGLRenderer();
#endif
#ifdef WITH_VULKAN
// gpu_hw_vulkan.cpp
static std::unique_ptr<GPU> CreateHardwareVulkanRenderer();
#endif
// gpu_sw.cpp
static std::unique_ptr<GPU> CreateSoftwareRenderer();

View File

@ -805,12 +805,23 @@ static constexpr auto s_gpu_renderer_names = make_array(
#ifdef _WIN32
"D3D11", "D3D12",
#endif
"Vulkan", "OpenGL", "Software");
#ifdef WITH_VULKAN
"Vulkan",
#endif
#ifdef WITH_OPENGL
"OpenGL",
#endif
"Software");
static constexpr auto s_gpu_renderer_display_names = make_array(
#ifdef _WIN32
TRANSLATABLE("GPURenderer", "Hardware (D3D11)"), TRANSLATABLE("GPURenderer", "Hardware (D3D12)"),
#endif
TRANSLATABLE("GPURenderer", "Hardware (Vulkan)"), TRANSLATABLE("GPURenderer", "Hardware (OpenGL)"),
#ifdef WITH_VULKAN
TRANSLATABLE("GPURenderer", "Hardware (Vulkan)"),
#endif
#ifdef WITH_OPENGL
TRANSLATABLE("GPURenderer", "Hardware (OpenGL)"),
#endif
TRANSLATABLE("GPURenderer", "Software"));
std::optional<GPURenderer> Settings::ParseRendererName(const char* str)

View File

@ -358,10 +358,16 @@ struct Settings
static const char* GetMultitapModeDisplayName(MultitapMode mode);
// Default to D3D11 on Windows as it's more performant and at this point, less buggy.
#ifdef _WIN32
#if defined(_WIN32) && defined(_M_ARM64)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareD3D12;
#elif defined(_WIN32)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareD3D11;
#else
#elif defined(WITH_OPENGL)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareOpenGL;
#elif defined(WITH_VULKAN)
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::HardwareVulkan;
#else
static constexpr GPURenderer DEFAULT_GPU_RENDERER = GPURenderer::Software;
#endif
static constexpr GPUTextureFilter DEFAULT_GPU_TEXTURE_FILTER = GPUTextureFilter::Nearest;
static constexpr GPUDownsampleMode DEFAULT_GPU_DOWNSAMPLE_MODE = GPUDownsampleMode::Disabled;

View File

@ -1,9 +1,13 @@
#include "shadergen.h"
#include "common/assert.h"
#include "common/gl/loader.h"
#include "common/log.h"
#include <cstdio>
#include <cstring>
#ifdef WITH_OPENGL
#include "common/gl/loader.h"
#endif
Log_SetChannel(ShaderGen);
ShaderGen::ShaderGen(HostDisplay::RenderAPI render_api, bool supports_dual_source_blend)
@ -11,8 +15,10 @@ ShaderGen::ShaderGen(HostDisplay::RenderAPI render_api, bool supports_dual_sourc
m_glsl(render_api != HostDisplay::RenderAPI::D3D11 && render_api != HostDisplay::RenderAPI::D3D12),
m_supports_dual_source_blend(supports_dual_source_blend), m_use_glsl_interface_blocks(false)
{
#if defined(WITH_OPENGL) || defined(WITH_VULKAN)
if (m_glsl)
{
#ifdef WITH_OPENGL
if (m_render_api == HostDisplay::RenderAPI::OpenGL || m_render_api == HostDisplay::RenderAPI::OpenGLES)
SetGLSLVersionString();
@ -26,16 +32,25 @@ ShaderGen::ShaderGen(HostDisplay::RenderAPI render_api, bool supports_dual_sourc
if (std::strcmp(gl_vendor, "ATI Technologies Inc.") == 0)
m_use_glsl_interface_blocks = false;
}
#else
m_use_glsl_interface_blocks = true;
m_use_glsl_binding_layout = true;
#endif
}
#endif
}
ShaderGen::~ShaderGen() = default;
bool ShaderGen::UseGLSLBindingLayout()
{
#ifdef WITH_OPENGL
return (GLAD_GL_ES_VERSION_3_1 || GLAD_GL_VERSION_4_3 ||
(GLAD_GL_ARB_explicit_attrib_location && GLAD_GL_ARB_explicit_uniform_location &&
GLAD_GL_ARB_shading_language_420pack));
#else
return true;
#endif
}
void ShaderGen::DefineMacro(std::stringstream& ss, const char* name, bool enabled)
@ -43,6 +58,7 @@ void ShaderGen::DefineMacro(std::stringstream& ss, const char* name, bool enable
ss << "#define " << name << " " << BoolToUInt32(enabled) << "\n";
}
#ifdef WITH_OPENGL
void ShaderGen::SetGLSLVersionString()
{
const char* glsl_version = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
@ -85,6 +101,7 @@ void ShaderGen::SetGLSLVersionString()
(glsl_es && major_version >= 3) ? " es" : "");
m_glsl_version_string = buf;
}
#endif
void ShaderGen::WriteHeader(std::stringstream& ss)
{
@ -93,6 +110,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
else if (m_render_api == HostDisplay::RenderAPI::Vulkan)
ss << "#version 450 core\n\n";
#ifdef WITH_OPENGL
// Extension enabling for OpenGL.
if (m_render_api == HostDisplay::RenderAPI::OpenGLES)
{
@ -130,6 +148,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
if (!GLAD_GL_VERSION_4_3 && !GLAD_GL_ES_VERSION_3_1 && GLAD_GL_ARB_shader_storage_buffer_object)
ss << "#extension GL_ARB_shader_storage_buffer_object : require\n";
}
#endif
DefineMacro(ss, "API_OPENGL", m_render_api == HostDisplay::RenderAPI::OpenGL);
DefineMacro(ss, "API_OPENGL_ES", m_render_api == HostDisplay::RenderAPI::OpenGLES);
@ -137,6 +156,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
DefineMacro(ss, "API_D3D12", m_render_api == HostDisplay::RenderAPI::D3D12);
DefineMacro(ss, "API_VULKAN", m_render_api == HostDisplay::RenderAPI::Vulkan);
#ifdef WITH_OPENGL
if (m_render_api == HostDisplay::RenderAPI::OpenGLES)
{
ss << "precision highp float;\n";
@ -151,6 +171,7 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
ss << "\n";
}
#endif
if (m_glsl)
{
@ -315,7 +336,12 @@ void ShaderGen::DeclareTextureBuffer(std::stringstream& ss, const char* name, u3
const char* ShaderGen::GetInterpolationQualifier(bool interface_block, bool centroid_interpolation,
bool sample_interpolation, bool is_out) const
{
if (m_glsl && interface_block && (!IsVulkan() && !GLAD_GL_ARB_shading_language_420pack))
#ifdef WITH_OPENGL
const bool shading_language_420pack = GLAD_GL_ARB_shading_language_420pack;
#else
const bool shading_language_420pack = false;
#endif
if (m_glsl && interface_block && (!IsVulkan() && !shading_language_420pack))
{
return (sample_interpolation ? (is_out ? "sample out " : "sample in ") :
(centroid_interpolation ? (is_out ? "centroid out " : "centroid in ") : ""));

View File

@ -24,7 +24,10 @@ protected:
const char* GetInterpolationQualifier(bool interface_block, bool centroid_interpolation, bool sample_interpolation,
bool is_out) const;
#ifdef WITH_OPENGL
void SetGLSLVersionString();
#endif
void DefineMacro(std::stringstream& ss, const char* name, bool enabled);
void WriteHeader(std::stringstream& ss);
void WriteUniformBufferDeclaration(std::stringstream& ss, bool push_constant_on_vulkan);

View File

@ -1457,13 +1457,17 @@ bool System::CreateGPU(GPURenderer renderer)
{
switch (renderer)
{
#ifdef WITH_OPENGL
case GPURenderer::HardwareOpenGL:
g_gpu = GPU::CreateHardwareOpenGLRenderer();
break;
#endif
#ifdef WITH_VULKAN
case GPURenderer::HardwareVulkan:
g_gpu = GPU::CreateHardwareVulkanRenderer();
break;
#endif
#ifdef _WIN32
case GPURenderer::HardwareD3D11:

View File

@ -58,8 +58,12 @@ enum class GPURenderer : u8
HardwareD3D11,
HardwareD3D12,
#endif
#ifdef WITH_VULKAN
HardwareVulkan,
#endif
#ifdef WITH_OPENGL
HardwareOpenGL,
#endif
Software,
Count
};

View File

@ -8,11 +8,13 @@
#include <QtWidgets/QMessageBox>
// For enumerating adapters.
#include "frontend-common/vulkan_host_display.h"
#ifdef _WIN32
#include "frontend-common/d3d11_host_display.h"
#include "frontend-common/d3d12_host_display.h"
#endif
#ifdef WITH_VULKAN
#include "frontend-common/vulkan_host_display.h"
#endif
DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* parent)
: QWidget(parent), m_dialog(dialog)
@ -206,11 +208,12 @@ void DisplaySettingsWidget::populateGPUAdaptersAndResolutions()
aml = FrontendCommon::D3D12HostDisplay::StaticGetAdapterAndModeList();
break;
#endif
#ifdef WITH_VULKAN
case GPURenderer::HardwareVulkan:
aml = FrontendCommon::VulkanHostDisplay::StaticGetAdapterAndModeList(nullptr);
threaded_presentation_supported = true;
break;
#endif
case GPURenderer::Software:
thread_supported = true;

View File

@ -21,9 +21,7 @@
#include "frontend-common/imgui_manager.h"
#include "frontend-common/imgui_overlays.h"
#include "frontend-common/input_manager.h"
#include "frontend-common/opengl_host_display.h"
#include "frontend-common/sdl_audio_stream.h"
#include "frontend-common/vulkan_host_display.h"
#include "imgui.h"
#include "mainwindow.h"
#include "qtprogresscallback.h"
@ -58,6 +56,14 @@ Log_SetChannel(EmuThread);
#include <ShlObj.h>
#endif
#ifdef WITH_OPENGL
#include "frontend-common/opengl_host_display.h"
#endif
#ifdef WITH_VULKAN
#include "frontend-common/vulkan_host_display.h"
#endif
#ifdef WITH_CHEEVOS
#include "frontend-common/achievements.h"
#endif
@ -824,17 +830,18 @@ bool EmuThread::acquireHostDisplay(HostDisplay::RenderAPI api)
switch (api)
{
#ifdef WITH_VULKAN
case HostDisplay::RenderAPI::Vulkan:
g_host_display = std::make_unique<FrontendCommon::VulkanHostDisplay>();
break;
#endif
#ifdef WITH_OPENGL
case HostDisplay::RenderAPI::OpenGL:
case HostDisplay::RenderAPI::OpenGLES:
#ifndef _WIN32
default:
#endif
g_host_display = std::make_unique<FrontendCommon::OpenGLHostDisplay>();
break;
#endif
#ifdef _WIN32
case HostDisplay::RenderAPI::D3D12:
@ -842,10 +849,21 @@ bool EmuThread::acquireHostDisplay(HostDisplay::RenderAPI api)
break;
case HostDisplay::RenderAPI::D3D11:
default:
g_host_display = std::make_unique<FrontendCommon::D3D11HostDisplay>();
break;
#endif
default:
#if defined(_WIN32) && defined(_M_ARM64)
g_host_display = std::make_unique<FrontendCommon::D3D12HostDisplay>();
#elif defined(_WIN32)
g_host_display = std::make_unique<FrontendCommon::D3D11HostDisplay>();
#elif defined(WITH_OPENGL)
g_host_display = std::make_unique<FrontendCommon::OpenGLHostDisplay>();
#elif defined(WITH_VULKAN)
g_host_display = std::make_unique<FrontendCommon::VulkanHostDisplay>();
#endif
break;
}
if (!createDisplayRequested(m_is_fullscreen, m_is_rendering_to_main))

View File

@ -20,27 +20,19 @@ add_library(frontend-common
input_source.h
imgui_fullscreen.cpp
imgui_fullscreen.h
imgui_impl_opengl3.cpp
imgui_impl_opengl3.h
imgui_impl_vulkan.cpp
imgui_impl_vulkan.h
imgui_manager.cpp
imgui_manager.h
imgui_overlays.cpp
imgui_overlays.h
opengl_host_display.cpp
opengl_host_display.h
postprocessing_chain.cpp
postprocessing_chain.h
postprocessing_shader.cpp
postprocessing_shader.h
postprocessing_shadergen.cpp
postprocessing_shadergen.h
vulkan_host_display.cpp
vulkan_host_display.h
)
target_link_libraries(frontend-common PUBLIC core common glad cubeb imgui tinyxml2 rapidjson scmversion)
target_link_libraries(frontend-common PUBLIC core common cubeb imgui tinyxml2 rapidjson scmversion)
if(WIN32)
target_sources(frontend-common PRIVATE
@ -64,6 +56,25 @@ if(WIN32)
target_link_libraries(frontend-common PRIVATE d3d11.lib dxgi.lib)
endif()
if(ENABLE_OPENGL)
target_sources(frontend-common PRIVATE
opengl_host_display.cpp
opengl_host_display.h
imgui_impl_opengl3.cpp
imgui_impl_opengl3.h
)
target_link_libraries(frontend-common PRIVATE glad)
endif()
if(ENABLE_VULKAN)
target_sources(frontend-common PRIVATE
imgui_impl_vulkan.cpp
imgui_impl_vulkan.h
vulkan_host_display.cpp
vulkan_host_display.h
)
endif()
if(APPLE)
find_library(IOK_LIBRARY IOKit REQUIRED)
target_link_libraries(frontend-common PRIVATE "${IOK_LIBRARY}")

View File

@ -17,14 +17,20 @@
<ClCompile Include="imgui_fullscreen.cpp" />
<ClCompile Include="imgui_impl_dx11.cpp" />
<ClCompile Include="imgui_impl_dx12.cpp" />
<ClCompile Include="imgui_impl_opengl3.cpp" />
<ClCompile Include="imgui_impl_vulkan.cpp" />
<ClCompile Include="imgui_impl_opengl3.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="imgui_impl_vulkan.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="imgui_manager.cpp" />
<ClCompile Include="imgui_overlays.cpp" />
<ClCompile Include="inhibit_screensaver.cpp" />
<ClCompile Include="input_manager.cpp" />
<ClCompile Include="input_source.cpp" />
<ClCompile Include="opengl_host_display.cpp" />
<ClCompile Include="opengl_host_display.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="postprocessing_chain.cpp" />
<ClCompile Include="postprocessing_shader.cpp" />
<ClCompile Include="postprocessing_shadergen.cpp" />
@ -35,7 +41,9 @@
<ExcludedFromBuild Condition="'$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sdl_input_source.cpp" />
<ClCompile Include="vulkan_host_display.cpp" />
<ClCompile Include="vulkan_host_display.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="win32_raw_input_source.cpp" />
<ClCompile Include="xaudio2_audio_stream.cpp" />
<ClCompile Include="xinput_source.cpp" />
@ -55,14 +63,20 @@
<ClInclude Include="imgui_fullscreen.h" />
<ClInclude Include="imgui_impl_dx11.h" />
<ClInclude Include="imgui_impl_dx12.h" />
<ClInclude Include="imgui_impl_opengl3.h" />
<ClInclude Include="imgui_impl_vulkan.h" />
<ClInclude Include="imgui_impl_opengl3.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="imgui_impl_vulkan.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="imgui_manager.h" />
<ClInclude Include="imgui_overlays.h" />
<ClInclude Include="inhibit_screensaver.h" />
<ClInclude Include="input_manager.h" />
<ClInclude Include="input_source.h" />
<ClInclude Include="opengl_host_display.h" />
<ClInclude Include="opengl_host_display.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="postprocessing_chain.h" />
<ClInclude Include="postprocessing_shader.h" />
<ClInclude Include="postprocessing_shadergen.h" />
@ -73,7 +87,9 @@
<ExcludedFromBuild Condition="'$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="sdl_input_source.h" />
<ClInclude Include="vulkan_host_display.h" />
<ClInclude Include="vulkan_host_display.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64' Or '$(BuildingForUWP)'=='true'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="win32_raw_input_source.h" />
<ClInclude Include="xaudio2_audio_stream.h" />
<ClInclude Include="xinput_source.h" />

View File

@ -2949,6 +2949,7 @@ void FullscreenUI::DrawDisplaySettingsPage()
break;
#endif
#ifdef WITH_VULKAN
case GPURenderer::HardwareVulkan:
{
DrawToggleSetting("Threaded Presentation",
@ -2956,6 +2957,7 @@ void FullscreenUI::DrawDisplaySettingsPage()
"ThreadedPresentation", true);
}
break;
#endif
case GPURenderer::Software:
{