sdl_gpu_examples

repository·main·Indexed 19 days ago

https://github.com/thespydog/sdl_gpu_examples

A collection of demonstration examples for the SDL_GPU API, showcasing the use of the GPU abstraction layer in SDL3. Includes instructions for building the examples with CMake and compiling HLSL shaders using SDL_shadercross.

Tokens
411
Snippets
2
Records
2
Agent score
18%

What's inside sdl_gpu_examples

  1. Compile shaders using SDL_shadercross

    main

    The shaders in this repository are written in HLSL. They are compiled offline from Content/Shaders/Source to Content/Shaders/Compiled using SDL_shadercross.

    To build the shaders manually:

    1. Install SDL_shadercross.
    2. Navigate to the shader source directory.
    3. Execute compile.sh.
    # Navigate to shader source and run the compilation script
    cd Content/Shaders/Source
    ./compile.sh
  2. Build SDL and SDL_gpu_examples

    main

    To use these examples, you must first build the SDL library from source, then build the examples while pointing to your SDL build directory using the SDL3_DIR CMake variable.

    1. Build SDL:

      • Clone the SDL repository.
      • Create a build directory and run cmake .. followed by make.
    2. Build SDL_gpu_examples:

      • Clone the SDL_gpu_examples repository.
      • Create a build directory.
      • Run cmake .. -DSDL3_DIR="full/path/to/SDL/build" (replace with your actual SDL build path).
      • Run make or use your preferred IDE.
    # Build SDL
    git clone https://github.com/libsdl-org/SDL
    cd SDL
    mkdir build
    cd build
    cmake ..
    make
    
    # Build SDL_gpu_examples
    cd ../..
    git clone https://github.com/TheSpydog/SDL_gpu_examples
    cd SDL_gpu_examples
    mkdir build
    cd build
    cmake .. -DSDL3_DIR="/path/to/SDL/build"
    make