sdl_gpu_test
Just a little sandbox for me to try out SDL3's SDL_gpu.h. Feel free to do with it whatever you want. Note however that the included assets have their own licenses.
Compiling
This project uses SCons and my personal extension "SCons++" for compilation. After installing SCons it should work out of the box on Linux and Windows 10, anything else hasn't been tested.
On Linux you should be able to get SCons from your repository on any major distribution. On Windows you can either download it from their website (https://scons.org/) or (my recommendation) install it via Scoop.
Just make sure to initialise the git submodule for SCons++. Either by cloning recursively:
git clone --recurse-submodules https://git.mewin.de/mewin/sdl_gpu_test.git
or by updating it after cloning:
git submodule init
git submodule update
After that you can compile the project using SCons:
scons -j<jobs>
This will automatically fetch and build dependencies (stored in ~/.cache/spp_cache
on Linux and %LocalAppData%\spp_cache
on Windows).
Note that as of now the SDL repository needs to be patched in order for the build to work. You first have to run SCons once to update the repo and let the build fail, then apply the patch from external/scons-plus-plus/recipes/SDL/fix_sdl3_from_worktree.patch
:
cd <spp_cache_dir>/cloned/git/SDL/b70daef4eb57
git apply <path to fix_sdl3_from_worktree.patch>
After that run the build again and everything should work just fine.
Running
After compiling you can find the executable in bin/sdl_gpu_test[.exe]
. You can either run it without any arguments to execute the latest iteration of my test application or pass the --app
parameter to choose another one. You can find the names of the apps in main.cpp or by using --app
with an invalid value :).
Further Reading
If you want to learn more about SDL_gpu.h, try the following:
- read the long comment at the beginning of SDL_gpu.h itself: https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_gpu.h
- look at the examples provided here: https://github.com/TheSpydog/SDL_gpu_examples
- read this blog entry about why there is no unified way for distributing shaders: https://moonside.games/posts/layers-all-the-way-down/
- look at this little helper for compiling your shaders for SDL_gpu.h: https://github.com/libsdl-org/SDL_gpu_shadercross (I haven't tested it myself yet)