Skip to content

Commit

Permalink
[WIP] VL backend for the new SDL3 GPU API
Browse files Browse the repository at this point in the history
This is a very early proof-of-concept for SDL3 GPU support, for the API
mentioned in libsdl-org/SDL#9312

It's currently lacking:
- A decent cleanup and error handling.
- Proper separation from the vulkan backend (I broke the vulkan shaders
  to implement this)
- A Makefile implementation (CMake only for now)
- Some strange framebuffer bugs on hasvk/wayland/HSW -- probably a
  driver bug
- Not once tested with anything other than the Vulkan backend, which has
  a habit of allowing a lot of things other backends don't.
  • Loading branch information
sulix committed Sep 13, 2024
1 parent d1af049 commit 12f2d63
Show file tree
Hide file tree
Showing 5 changed files with 762 additions and 6 deletions.
31 changes: 31 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,37 @@ elseif(RENDERER STREQUAL "sdl3")
${SDL3_INCLUDE_DIRS}
)
add_definitions(-DWITH_SDL=3)
elseif(RENDERER STREQUAL "sdl3gpu")
message(STATUS "Using SDL3 gpu backend")
find_package(SDL3 REQUIRED)
add_custom_command(OUTPUT id_vl_vk_vert.h
COMMAND glslc -mfmt=c
${CMAKE_CURRENT_SOURCE_DIR}/src/id_vl_vk_shader.vert
-o id_vl_vk_vert.h
DEPENDS src/id_vl_vk_shader.vert
)

add_custom_command(OUTPUT id_vl_vk_frag.h
COMMAND glslc -mfmt=c
${CMAKE_CURRENT_SOURCE_DIR}/src/id_vl_vk_shader.frag
-o id_vl_vk_frag.h
DEPENDS src/id_vl_vk_shader.frag
)
set(OMNISPEAK_PLATFORM_SRCS
src/id_in_sdl3.c
src/id_sd_sdl3.c
src/id_vl_sdl3gpu.c
${CMAKE_CURRENT_BINARY_DIR}/id_vl_vk_vert.h
${CMAKE_CURRENT_BINARY_DIR}/id_vl_vk_frag.h
)
set(OMNISPEAK_PLATFORM_LIBRARIES
${SDL3_LIBRARIES}
)
include_directories(
${SDL3_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
add_definitions(-DWITH_SDL=3)
else()
message(WARNING "Using NULL platform layer.")
set(OMNISPEAK_PLATFORM_SRCS
Expand Down
4 changes: 4 additions & 0 deletions src/id_in_sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <SDL3/SDL.h>
#include <string.h>

extern SDL_Window *vl_sdl3gpu_window;
#define vl_sdl3_window vl_sdl3gpu_window


#define IN_MAX_JOYSTICKS 2

SDL_Joystick *in_joysticks[IN_MAX_JOYSTICKS];
Expand Down
Loading

0 comments on commit 12f2d63

Please sign in to comment.