Compare commits

...

7 Commits

4 changed files with 51 additions and 1 deletions

48
README.md Normal file
View File

@ -0,0 +1,48 @@
# sdl_gpu_test
Just a little sandbox for me to try out [SDL3](https://github.com/libsdl-org/SDL/)'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](https://scons.org/) and my personal extension "[SCons++](https://git.mewin.de/mewin/scons-plus-plus)" 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](https://scoop.sh/).
Just make sure to initialise the git submodule for SCons++. Either by cloning recursively:
```shell
git clone --recurse-submodules https://git.mewin.de/mewin/sdl_gpu_test.git
```
or by updating it after cloning:
```shell
git submodule init
git submodule update
```
After that you can compile the project using SCons:
```shell
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`:
```shell
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](https://git.mewin.de/mewin/sdl_gpu_test/src/branch/master/private/sdl_gpu_test/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)

@ -1 +1 @@
Subproject commit 0a29b416391359a84cb847f57fc391da71a8e3cb
Subproject commit e3b3fd8f7cb0ff0d1973e8f719a024b81322f7d7

View File

@ -36,6 +36,7 @@ shader_files = env.Glob("#assets/shaders/glsl/*.frag") \
env.Append(CPPDEFINES = ['GLM_FORCE_DEPTH_ZERO_TO_ONE', 'GLM_FORCE_RADIANS', 'GLM_ENABLE_EXPERIMENTAL'])
prog_app = env.UnityProgram(
name = 'SDL GPU Test',
target = env['BIN_DIR'] + '/sdl_gpu_test',
source = src_files,
dependencies = {

View File

@ -15,6 +15,7 @@ src_files = Split("""
""")
prog_packer = env.UnityProgram(
name = 'Texture Packer',
target = env['BIN_DIR'] + '/texture_packer',
source = src_files,
dependencies = {