ObjectivelyGL is a cross-platform graphics framework for SDL3. It is built on Objectively, written in GNU C, and requires gcc or clang.
- Objectively >= 2.0.0
- SDL3 >= 3.2.0
ObjectivelyGPU uses a GLSL → SPIR-V → MSL pipeline for cross-platform shader support:
- GLSL (Vulkan 4.5) is the source language for all shaders
- glslc (from shaderc) compiles GLSL to SPIR-V
- shadercross (from SDL_shadercross) converts SPIR-V to MSL, using SDL3-aware buffer slot assignments
Both SPIR-V and MSL blobs are versioned in the repository. Normal builds never invoke these tools. Run make shaders after editing a .glsl file to regenerate the blobs.
# glslc (part of shaderc)
brew install shaderc
# shadercross — build from source (SPIR-V → MSL path; no DXC needed)
git clone https://github.com/libsdl-org/SDL_shadercross
cd SDL_shadercross
git submodule update --init --recursive external/SPIRV-Cross external/SPIRV-Headers external/SPIRV-Tools
cmake -S . -B build \
-DSDLSHADERCROSS_VENDORED=ON \
-DSDLSHADERCROSS_SPIRVCROSS_SHARED=OFF \
-DSDLSHADERCROSS_CLI=ON \
-DSDLSHADERCROSS_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
sudo cmake --install buildNote:
SDLSHADERCROSS_DXC=ONand theDirectXShaderCompilersubmodule are not required. DXC is only needed for HLSL input. The SPIR-V → MSL path used here works without it.
cd Examples
make shadersThis runs:
glslc -fshader-stage=<stage> Shader.glsl -o Shader.spv
shadercross Shader.spv -s SPIRV -d MSL -t <stage> -o Shader.msl
| Stage | Set | Binding | Usage |
|---|---|---|---|
| Vertex | 0 | 0+ | Vertex samplers / storage bufs |
| Vertex | 1 | 0+ | Vertex uniform buffers |
| Fragment | 2 | 0+ | Fragment samplers / storage |
| Fragment | 3 | 0+ | Fragment uniform buffers |
| Compute | 1 | 0+ | Read-write storage buffers |
| Compute | 2 | 0+ | Compute uniform buffers |