Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The GPU API MkII #9312

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ VisualC/tests/testyuv/testyuv.bmp
VisualC-GDK/**/Layout
src/render/direct3d12/D3D12_*_One.h
src/render/direct3d12/D3D12_*_Series.h
src/gpu/d3d12/D3D12_*_One.h
src/gpu/d3d12/D3D12_*_Series.h
Directory.Build.props

# for Android
Expand Down
2 changes: 2 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
$(wildcard $(LOCAL_PATH)/src/gpu/*.c) \
$(wildcard $(LOCAL_PATH)/src/gpu/vulkan/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
Expand Down
39 changes: 39 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ endmacro()

define_sdl_subsystem(Audio)
define_sdl_subsystem(Video)
define_sdl_subsystem(Gpu DEPS SDL_VIDEO)
define_sdl_subsystem(Render DEPS SDL_VIDEO)
define_sdl_subsystem(Camera DEPS SDL_VIDEO)
define_sdl_subsystem(Joystick)
Expand Down Expand Up @@ -331,6 +332,7 @@ dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL
dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF)
set_option(SDL_RENDER_GPU "Enable the SDL_Gpu render driver" ON)
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF)
Expand All @@ -350,6 +352,7 @@ set_option(SDL_LIBUDEV "Enable libudev support" ON)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
set_option(SDL_CCACHE "Use Ccache to speed up build" OFF)
set_option(SDL_CLANG_TIDY "Run clang-tidy static analysis" OFF)
set_option(SDL_GPU_DXVK "Build SDL_Gpu with DXVK support" OFF)

set(SDL_VENDOR_INFO "" CACHE STRING "Vendor name and/or version to add to SDL_REVISION")

Expand Down Expand Up @@ -1123,6 +1126,7 @@ sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/events/*.c"
"${SDL3_SOURCE_DIR}/src/file/*.c"
"${SDL3_SOURCE_DIR}/src/filesystem/*.c"
"${SDL3_SOURCE_DIR}/src/gpu/*.c"
"${SDL3_SOURCE_DIR}/src/joystick/*.c"
"${SDL3_SOURCE_DIR}/src/haptic/*.c"
"${SDL3_SOURCE_DIR}/src/hidapi/*.c"
Expand Down Expand Up @@ -1704,6 +1708,16 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
)
endif()

if(SDL_GPU AND SDL_GPU_DXVK)
if(PKG_CONFIG_FOUND)
pkg_search_module(DXVK_NATIVE dxvk-dxgi)
if(DXVK_NATIVE_FOUND)
set(HAVE_D3D11_H TRUE)
sdl_include_directories(PRIVATE SYSTEM ${DXVK_NATIVE_INCLUDE_DIRS})
endif()
endif()
endif()

# Always compiled for Linux, unconditionally:
sdl_sources(
"${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c"
Expand Down Expand Up @@ -2363,6 +2377,10 @@ elseif(APPLE)
set(SDL_VIDEO_RENDER_METAL 1)
set(HAVE_RENDER_METAL TRUE)
endif()
if (SDL_GPU)
set(SDL_GPU_METAL 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/metal/*.m")
endif()
endif()
endif()
endif()
Expand Down Expand Up @@ -2925,6 +2943,27 @@ if(SDL_VIDEO)
endif()
endif()

if(SDL_GPU)
if(HAVE_D3D11_H)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/d3d11/*.c")
set(SDL_GPU_D3D11 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(SDL_RENDER_D3D12)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.c")
set(SDL_GPU_D3D12 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(SDL_VIDEO_VULKAN)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/vulkan/*.c")
set(SDL_GPU_VULKAN 1)
set(HAVE_SDL_GPU TRUE)
endif()
if(SDL_RENDER_GPU)
set(SDL_VIDEO_RENDER_GPU 1)
endif()
endif()

# Dummies
# configure.ac does it differently:
# if not have X
Expand Down
15 changes: 15 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir)</Command>
<Command>$(SolutionDir)..\src\gpu\d3d12\compile_shaders_xbox.bat $(SolutionDir)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
Expand Down Expand Up @@ -200,6 +201,7 @@
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir) one</Command>
<Command>$(SolutionDir)..\src\gpu\d3d12\compile_shaders_xbox.bat $(SolutionDir) one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
Expand Down Expand Up @@ -266,6 +268,7 @@
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir)</Command>
<Command>$(SolutionDir)..\src\gpu\d3d12\compile_shaders_xbox.bat $(SolutionDir)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
Expand Down Expand Up @@ -301,6 +304,7 @@
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir) one</Command>
<Command>$(SolutionDir)..\src\gpu\d3d12\compile_shaders_xbox.bat $(SolutionDir) one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
Expand Down Expand Up @@ -330,6 +334,7 @@
<ClInclude Include="..\..\include\SDL3\SDL_events.h" />
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h" />
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h" />
<ClInclude Include="..\..\include\SDL3\SDL_gpu.h" />
<ClInclude Include="..\..\include\SDL3\SDL_guid.h" />
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
Expand Down Expand Up @@ -424,6 +429,7 @@
<ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h" />
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down Expand Up @@ -865,6 +871,15 @@
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.c" />
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_std.c" />
<ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
<ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
<ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.Scarlett.x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\core\windows\version.rc" />
Expand Down
6 changes: 6 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\file\SDL_iostream.c" />
<ClCompile Include="..\..\src\filesystem\gdk\SDL_sysfilesystem.cpp" />
<ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
<ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
<ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c" />
<ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c" />
<ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
<ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
<ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
Expand Down Expand Up @@ -249,6 +253,7 @@
<ClInclude Include="..\..\include\SDL3\SDL_events.h" />
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h" />
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h" />
<ClInclude Include="..\..\include\SDL3\SDL_gpu.h" />
<ClInclude Include="..\..\include\SDL3\SDL_guid.h" />
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
Expand Down Expand Up @@ -341,6 +346,7 @@
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h">
<Filter>filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down
4 changes: 4 additions & 0 deletions VisualC-WinRT/SDL-UWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<ClInclude Include="..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\src\filesystem\SDL_sysfilesystem.h" />
<ClInclude Include="..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down Expand Up @@ -343,6 +344,9 @@
<ClCompile Include="..\src\file\SDL_iostream.c" />
<ClCompile Include="..\src\filesystem\SDL_filesystem.c" />
<ClCompile Include="..\src\filesystem\windows\SDL_sysfsops.c" />
<ClCompile Include="..\src\gpu\SDL_gpu.c "/>
<ClCompile Include="..\src\gpu\d3d11\SDL_gpu_d3d11.c "/>
<ClCompile Include="..\src\gpu\d3d12\SDL_gpu_d3d12.c "/>
<ClCompile Include="..\src\haptic\dummy\SDL_syshaptic.c" />
<ClCompile Include="..\src\haptic\SDL_haptic.c" />
<ClCompile Include="..\src\haptic\windows\SDL_dinputhaptic.c" />
Expand Down
7 changes: 7 additions & 0 deletions VisualC/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
<ClInclude Include="..\..\include\SDL3\SDL_events.h" />
<ClInclude Include="..\..\include\SDL3\SDL_filesystem.h" />
<ClInclude Include="..\..\include\SDL3\SDL_gamepad.h" />
<ClInclude Include="..\..\include\SDL3\SDL_gpu.h" />
<ClInclude Include="..\..\include\SDL3\SDL_guid.h" />
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
Expand Down Expand Up @@ -348,6 +349,8 @@
<ClInclude Include="..\..\src\events\SDL_touch_c.h" />
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h" />
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan_vkfuncs.h" />
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down Expand Up @@ -408,6 +411,10 @@
<ClCompile Include="..\..\src\dialog\SDL_dialog_utils.c" />
<ClCompile Include="..\..\src\filesystem\SDL_filesystem.c" />
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfsops.c" />
<ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
<ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
<ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c" />
<ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c" />
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c" />
<ClCompile Include="..\..\src\main\SDL_main_callbacks.c" />
<ClCompile Include="..\..\src\main\SDL_runapp.c" />
Expand Down
22 changes: 22 additions & 0 deletions VisualC/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
</Filter>
<Filter Include="time\windows">
<UniqueIdentifier>{0000d7fda065b13b0ca4ab262c380000}</UniqueIdentifier>
<Filter Include="gpu">
<UniqueIdentifier>{098fbef9-d8a0-4b3b-b57b-d157d395335d}</UniqueIdentifier>
</Filter>
<Filter Include="dialog">
<UniqueIdentifier>{00008dfdfa0190856fbf3c7db52d0000}</UniqueIdentifier>
Expand Down Expand Up @@ -907,6 +909,14 @@
</ClInclude>
<ClInclude Include="..\..\src\video\offscreen\SDL_offscreenwindow.h">
<Filter>video\offscreen</Filter>
<ClInclude Include="..\..\include\SDL3\SDL_gpu.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h">
<Filter>gpu</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan_vkfuncs.h">
<Filter>gpu</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -1562,6 +1572,18 @@
<ClCompile Include="..\..\src\video\offscreen\SDL_offscreenwindow.c">
<Filter>video\offscreen</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gpu\SDL_gpu.c">
<Filter>gpu</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c">
<Filter>gpu</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c">
<Filter>gpu</Filter>
</ClCompile>
<ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c">
<Filter>gpu</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\core\windows\version.rc" />
Expand Down
1 change: 1 addition & 0 deletions include/SDL3/SDL.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <SDL3/SDL_events.h>
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_gpu.h>
#include <SDL3/SDL_guid.h>
#include <SDL3/SDL_haptic.h>
#include <SDL3/SDL_hidapi.h>
Expand Down
Loading
Loading