Skip to content

jdolan/ObjectivelyGPU

Repository files navigation

ObjectivelyGPU

Object oriented framework for modern cross-platform graphics with SDL3 and GNU C

ObjectivelyGL is a cross-platform graphics framework for SDL3. It is built on Objectively, written in GNU C, and requires gcc or clang.

Dependencies

Shader Pipeline

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.

Installing the tools

# 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 build

Note: SDLSHADERCROSS_DXC=ON and the DirectXShaderCompiler submodule are not required. DXC is only needed for HLSL input. The SPIR-V → MSL path used here works without it.

Regenerating blobs

cd Examples
make shaders

This runs:

glslc -fshader-stage=<stage> Shader.glsl -o Shader.spv
shadercross Shader.spv -s SPIRV -d MSL -t <stage> -o Shader.msl

GLSL binding layout (SDL3 GPU descriptor set convention)

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

About

Object oriented framework for modern, cross-platform graphics with SDL_gpu. Zlib license.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages