https://github.com/jsoulier/sdl_gpud
Embeddable immediate-mode debug drawing API for SDL3 GPU
https://github.com/jsoulier/sdl_gpud
c cpp dxil glsl msl sdl sdl2 sdl3 shaders spv
Last synced: 2 months ago
JSON representation
Embeddable immediate-mode debug drawing API for SDL3 GPU
- Host: GitHub
- URL: https://github.com/jsoulier/sdl_gpud
- Owner: jsoulier
- License: unlicense
- Created: 2025-02-23T21:59:15.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-02-25T02:32:54.000Z (2 months ago)
- Last Synced: 2025-02-25T03:28:57.337Z (2 months ago)
- Topics: c, cpp, dxil, glsl, msl, sdl, sdl2, sdl3, shaders, spv
- Language: C
- Homepage:
- Size: 9.69 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# SDL GPUD
An immediate-mode debug drawing tool for SDL3 GPU

### Features
- Vulkan, Direct3D12 and Metal support
- 2D and 3D primitives
- 2D text rendering
- And more soon...### Using SDL GPUD
SDL GPUD consists of two headers:
- `sdl_gpud.h` (Implementation)
- `sdl_gpud_shaders.h` (Precompiled SPV, DXIL, and MSL shaders)To use SDL GPUD, copy these two headers into your project and in **one C** file add:
```c
#define SDL_GPUD_IMPL
#include "sdl_gpud.h"
```See the following for a basic example (or [main.cpp](main.cpp)):
```c++
if (!SDL_InitGPUD(/* ... */)) {
/* Handle errors */
}while (true) {
/* Acquire command buffer and swapchain texture */
/* Do regular drawing... */SDL_SetGPUDColor({1.0f, 0.0f, 0.0f, 1.0f});
SDL_DrawGPUDLine({0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 100.0f});
SDL_SetGPUDColor({0.0f, 1.0f, 0.0f, 1.0f});
SDL_DrawGPUDLine({0.0f, 0.0f, 0.0f}, {0.0f, 100.0f, 0.0f});
SDL_SetGPUDColor({0.0f, 0.0f, 1.0f, 1.0f});
SDL_DrawGPUDLine({0.0f, 0.0f, 0.0f}, {100.0f, 0.0f, 0.0f});/* Submit draw commands */
SDL_SubmitGPUD(/* ... */);
SDL_SubmitGPUCommandBuffer(/* ... */);
}SDL_QuitGPUD();
```