cb6d9e61d1
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.1 KiB
Markdown
55 lines
2.1 KiB
Markdown
# sokol vendoring
|
|
|
|
- **Source**: https://github.com/floooh/sokol
|
|
- **Commit pinned**: `5cc3e913258fb63d87c7728569f14005f638e315` (ver `cpp/vendor/sokol/.commit-sha`)
|
|
- **License**: Zlib (`cpp/vendor/sokol/LICENSE`)
|
|
- **Headers vendoreados** (single-header):
|
|
- `sokol_gfx.h` — graphics abstraction (GL/GLES/WebGL2/Metal/D3D11)
|
|
- `sokol_log.h` — logger callback
|
|
- `sokol_glue.h` — helpers para integracion contexto
|
|
- `sokol_app.h` — windowing/input. **NO se usa**: usamos SDL3 para windowing. Vendoreado por si una app standalone lo quiere.
|
|
- **Vendoring command**:
|
|
```
|
|
mkdir -p cpp/vendor/sokol && cd cpp/vendor/sokol && \
|
|
SHA=$(curl -s https://api.github.com/repos/floooh/sokol/commits/master | \
|
|
grep -m1 '"sha"' | cut -d'"' -f4) && \
|
|
for f in sokol_gfx.h sokol_log.h sokol_glue.h sokol_app.h LICENSE; do
|
|
curl -fsSL "https://raw.githubusercontent.com/floooh/sokol/$SHA/$f" -o "$f"
|
|
done && echo "$SHA" > .commit-sha
|
|
```
|
|
|
|
## Por qué sokol_gfx
|
|
|
|
- Single-header, ~1.2 MB texto, ~50 KB compilado strippable.
|
|
- Backends: GL 3.3, GLES3, WebGL2, Metal, D3D11. **Cubre las 4 plataformas + web** del stack gamedev (issue 0072).
|
|
- Sin dependencias externas.
|
|
- Determinista, sin estado global oculto.
|
|
- Encaja con cultura "single-file function" del registry.
|
|
|
|
## Compile-time backend selection
|
|
|
|
El backend se elige con macros:
|
|
|
|
| Macro | Backend |
|
|
|---|---|
|
|
| `SOKOL_GLCORE` | OpenGL 3.3 desktop |
|
|
| `SOKOL_GLES3` | OpenGL ES 3.0 (Android, iOS sin Metal) |
|
|
| `SOKOL_METAL` | Metal (iOS/macOS) |
|
|
| `SOKOL_D3D11` | D3D11 (Windows) |
|
|
| `SOKOL_WGPU` | WebGPU (alpha, no usar aun) |
|
|
|
|
Para WASM con `-sUSE_WEBGL2=1`: definir `SOKOL_GLES3`.
|
|
|
|
## Sokol_app NO se usa
|
|
|
|
Mantenemos `sokol_app.h` vendoreado por completitud pero el stack usa **SDL3** para windowing/input. Sokol_app duplicaria la responsabilidad y limita acceso a APIs SDL (audio, gamepad, WalletConnect deep links).
|
|
|
|
## Upgrade
|
|
|
|
```
|
|
cd cpp/vendor/sokol
|
|
SHA=$(curl -s https://api.github.com/repos/floooh/sokol/commits/master | grep -m1 '"sha"' | cut -d'"' -f4)
|
|
# Repetir el for loop del vendoring command
|
|
echo "$SHA" > .commit-sha
|
|
```
|