Skip to content

Commit ffca94d

Browse files
committed
Doxxx
1 parent 3af515d commit ffca94d

6 files changed

Lines changed: 121 additions & 45 deletions

File tree

3.73 MB
Loading

Documentation/index.md

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,71 @@ Object oriented graphics framework for SDL3 and C.
66

77
## About
88

9-
[ObjectivelyGPU](https://github.com/jdolan/ObjectivelyGPU) is a cross-platform, object oriented graphics framework for the C programming language. Built on [Objectively](https://github.com/jdolan/Objectively) and [SDL3](https://libsdl.org)'s GPU API, it provides a clean, idiomatic C API for modern GPU programming across Metal, Vulkan, and Direct3D 12.
9+
[ObjectivelyGPU](https://github.com/jdolan/ObjectivelyGPU) is a cross-platform object oriented graphics framework for the C programming language. Built on [Objectively](https://github.com/jdolan/Objectively) and [SDL3_gpu](https://libsdl.org), it provides a unified API for modern GPU programming with Metal, Vulkan, and Direct3D 12.
1010

1111
## Features
1212

13-
- **macOS, iOS, Windows, Linux & Android** cross-platform support via SDL3 (Metal, Direct3D 12, Vulkan)
14-
- **RenderDevice** owns the swapchain — drive frames with a simple `beginFrame` / `endFrame` loop
15-
- **Resource objects** with automatic lifecycle: Buffer, Texture, Sampler, Shader, GraphicsPipeline, ComputePipeline
16-
- **Typed passes**: RenderPass, ComputePass, CopyPass with command-lifecycle validation
17-
- **Framebuffer** with multiple render targets, depth, and MSAA with automatic resolve
18-
- **Shaders** in every format SDL3 supports (SPIR-V, MSL, DXIL), loaded by name with automatic per-backend selection
19-
- **Mathlib**: vector, matrix, and quaternion math for 3D graphics
13+
- **Cross-platform** support for Android, iOS, macOS, Linux and Windows
14+
- **RenderDevice** owns the swapchain — drive frames with a simple `beginFrame` / `endFrame` loop and an unambiguous order of operations
15+
- **Resource objects** with automatic lifecycle — Buffer, Texture, Sampler, Shader, GraphicsPipeline and ComputePipeline initialize and tear themselves down
16+
- **Typed passes**: RenderPass, ComputePass and CopyPass with command-lifecycle validation that catches mistakes upfront
17+
- **Framebuffer** abstracts multiple render targets, depth, and MSAA with automatic resolve — convenience without forfeiting the low-level API
18+
- **Shaders** in every format SDL3 supports — SPIR-V (Vulkan), MSL (Metal) and DXIL (D3D12) — loaded by name with automatic per-backend selection; author them in any language and cross-compile with [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross), or bring your own blobs
19+
- **Mathlib** — vector, matrix, and quaternion math for 3D graphics
20+
21+
## tl;dr
22+
23+
The verbose, error-prone handling of a raw GPU API collapses into reference-counted objects and a handful of intuitive methods.
24+
25+
Uploading an image to the GPU is a single call — the staging buffer and copy pass are handled for you:
26+
27+
```c
28+
SDL_Surface *surface = IMG_Load("crate.png");
29+
Texture *texture = $(renderDevice, createTextureFromSurface, surface, SDL_GPU_TEXTUREUSAGE_SAMPLER);
30+
SDL_DestroySurface(surface);
31+
```
32+
33+
And a whole frame — acquire the swapchain, clear, draw a multisampled scene, resolve, and present:
34+
35+
```c
36+
CommandBuffer *commands = $(renderDevice, beginFrame);
37+
if (commands) {
38+
39+
const SDL_FColor clearColor = { 0.1f, 0.1f, 0.2f, 1.f };
40+
const SDL_GPUColorTargetInfo color = $(framebuffer, colorTargetInfo, 0, SDL_GPU_LOADOP_CLEAR, SDL_GPU_STOREOP_STORE, &clearColor);
41+
const SDL_GPUDepthStencilTargetInfo depth = $(framebuffer, depthTargetInfo, SDL_GPU_LOADOP_CLEAR, SDL_GPU_STOREOP_DONT_CARE, 1.f);
42+
43+
RenderPass *pass = $(commands, beginRenderPass, &color, 1, &depth);
44+
$(pass, bindPipeline, pipeline);
45+
$(pass, bindVertexBuffers, 0, &(SDL_GPUBufferBinding) { .buffer = vertexBuffer->buffer }, 1);
46+
$(pass, drawPrimitives, 36, 1, 0, 0);
47+
pass = release(pass);
48+
49+
$(renderDevice, endFrame);
50+
}
51+
```
52+
53+
The `endFrame` method resolves the multisampled `Framebuffer` and presents to the swapchain for you. No manual resolve targets, no store-op bookkeeping, no presentation plumbing.
54+
55+
## Getting Started
56+
57+
Consult the @subpage install for dependencies, building, and linking.
2058

2159
## User Guide
2260

23-
Consult the @subpage guide [User Guide] to draw your first frame.
61+
Consult the @subpage guide to draw your first frame — the render device, resource objects, framebuffers and MSAA, the typed passes, and shaders.
2462

2563
## Class Hierarchy
2664

2765
Browse the [Class Hierarchy](hierarchy.html) to navigate the full API.
2866

29-
## Examples
67+
## Project Showcase
3068

31-
![Hello — a spinning, multisampled 3D cube](Hello.gif)
69+
1. [Hello](Examples/Hello.c) renders a spinning, multisampled 3D cube.
70+
1. [HelloCompute](Examples/HelloCompute.c) animates particles with a compute shader and draws them as points.
71+
1. [ObjectivelyMVC](https://github.com/jdolan/ObjectivelyMVC) is a framework for modern game interfaces built on SDL3, Objectively and ObjectivelyGPU.
72+
1. [Quetoo](https://github.com/jdolan/quetoo) is a free first-person shooter that uses Objectively, ObjectivelyGPU and ObjectivelyMVC extensively.
3273

74+
![Hello — a spinning, multisampled 3D cube](Hello.gif)
3375
![HelloCompute — particles animated by a compute shader](HelloCompute.gif)
76+
![HelloMVC — ObjectivelyMVC](ObjectivelyMVC-Hello.gif)

Documentation/install.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Installing ObjectivelyGPU {#install}
2+
=========================
3+
4+
Dependencies, building, and linking against ObjectivelyGPU.
5+
6+
[TOC]
7+
8+
## Dependencies
9+
10+
* [Objectively](https://github.com/jdolan/Objectively) >= 2.0.0
11+
* [SDL3](https://github.com/libsdl-org/SDL) >= 3.2.0
12+
13+
## Building
14+
15+
```sh
16+
autoreconf -i
17+
./configure
18+
make && sudo make install
19+
```
20+
21+
## Linking
22+
23+
Compile and link against ObjectivelyGPU with `pkg-config`:
24+
25+
```sh
26+
gcc `pkg-config --cflags --libs ObjectivelyGPU` -o myprogram *.c
27+
```

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ GENERATE_TODOLIST = YES
1414
GENERATE_TESTLIST = YES
1515
GENERATE_BUGLIST = YES
1616
GENERATE_DEPRECATEDLIST= YES
17-
INPUT = Documentation/index.md Documentation/guide.md Sources
17+
INPUT = Documentation/index.md Documentation/guide.md Documentation/install.md Sources
1818
INPUT_ENCODING = UTF-8
1919
IMAGE_PATH = Documentation
2020
RECURSIVE = YES

ObjectivelyGPU.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@
161161
AA000000000000000000EE01 /* SDL3.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SDL3.xcframework; path = Frameworks/SDL3.xcframework; sourceTree = "<group>"; };
162162
C16D60B0E94469E649953EC5 /* ObjectivelyGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ObjectivelyGPU.h; sourceTree = "<group>"; };
163163
C862954A9DD435C1FF7CD31D /* CopyPass.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CopyPass.c; sourceTree = "<group>"; };
164+
CE1643412FF47B7D00863996 /* guide.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = guide.md; sourceTree = "<group>"; };
165+
CE1643422FF47B7D00863996 /* Hello.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = Hello.gif; sourceTree = "<group>"; };
166+
CE1643432FF47B7D00863996 /* HelloCompute.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = HelloCompute.gif; sourceTree = "<group>"; };
164167
CEA0030000000000000000F0 /* Objectively.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Objectively.framework; sourceTree = BUILT_PRODUCTS_DIR; };
165168
CEBA3F5E2FF30F1E00758CA6 /* Texture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Texture.h; sourceTree = "<group>"; };
166169
CEBA3F5F2FF30F1E00758CA6 /* Texture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Texture.c; sourceTree = "<group>"; };
@@ -343,6 +346,9 @@
343346
DOC00030000000000000001 /* Documentation */ = {
344347
isa = PBXGroup;
345348
children = (
349+
CE1643422FF47B7D00863996 /* Hello.gif */,
350+
CE1643432FF47B7D00863996 /* HelloCompute.gif */,
351+
CE1643412FF47B7D00863996 /* guide.md */,
346352
DOC00010000000000000001 /* index.md */,
347353
);
348354
path = Documentation;

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,33 @@ Object oriented graphics framework for SDL3 and C.
88
Zlib [license](./COPYING).
99

1010
## About
11-
ObjectivelyGPU is a cross-platform, object oriented graphics framework for the C programming language.
12-
Built on [Objectively](https://github.com/jdolan/Objectively) and [SDL3](https://libsdl.org)'s GPU API, it
11+
ObjectivelyGPU is a cross-platform object oriented graphics framework for the C programming language.
12+
Built on [Objectively](https://github.com/jdolan/Objectively) and [SDL_gpu](https://libsdl.org)'s GPU API, it
1313
provides a clean, idiomatic C API for modern GPU programming — targeting Metal, Vulkan, and Direct3D 12
1414
through a single interface.
1515

1616
## Features
17-
* **macOS, iOS, Windows, Linux & Android** cross-platform support via SDL3 (Metal, Direct3D 12, Vulkan)
18-
* **RenderDevice** owns the swapchain — drive frames with a simple `beginFrame` / `endFrame` loop
19-
* **Resource objects** with automatic lifecycle: Buffer, Texture, Sampler, Shader, GraphicsPipeline, ComputePipeline
20-
* **Typed passes**: RenderPass, ComputePass, CopyPass with command-lifecycle validation
21-
* **Framebuffer** with multiple render targets, depth, and MSAA with automatic resolve
22-
* **Shaders** in every format SDL3 supports — SPIR-V (Vulkan), MSL (Metal), DXIL (D3D12) — loaded by name with automatic per-backend selection; author them in any language and cross-compile with [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross), or bring your own blobs
23-
* **Mathlib**: vector, matrix, and quaternion math for 3D graphics
24-
25-
The verbose, error-prone handle juggling of a raw GPU API collapses into reference-counted objects and a
26-
handful of methods. A whole frame — acquire the swapchain, clear, draw a multisampled scene, resolve, and
27-
present — is just this:
17+
* **Cross-platform** support for Android, iOS, macOS, Linux and Windows
18+
* **RenderDevice** owns the swapchain — drive frames with a simple `beginFrame` / `endFrame` loop and an unambiguous order of operations
19+
* **Resource objects** with automatic lifecycle — Buffer, Texture, Sampler, Shader, GraphicsPipeline and ComputePipeline initialize and tear themselves down
20+
* **Typed passes**: RenderPass, ComputePass and CopyPass with command-lifecycle validation that catches mistakes upfront
21+
* **Framebuffer** abstracts multiple render targets, depth, and MSAA with automatic resolve — convenience without forfeiting the low-level API
22+
* **Shaders** loaded by name, with the formats supported by your platform
23+
* **Mathlib** — vector, matrix, and quaternion math for 3D graphics
24+
25+
## tl;dr
26+
The verbose, error-prone handling of a raw GPU API collapses into reference-counted objects and a
27+
handful of intuitive methods.
28+
29+
Uploading an image to the GPU is a single call — the staging buffer and copy pass are handled for you:
30+
31+
```c
32+
SDL_Surface *surface = IMG_Load("crate.png");
33+
Texture *texture = $(renderDevice, createTextureFromSurface, surface, SDL_GPU_TEXTUREUSAGE_SAMPLER);
34+
SDL_DestroySurface(surface);
35+
```
36+
37+
And a whole frame — acquire the swapchain, clear, draw a multisampled scene, resolve, and present:
2838
2939
```c
3040
CommandBuffer *commands = $(renderDevice, beginFrame);
@@ -44,34 +54,23 @@ if (commands) {
4454
}
4555
```
4656

47-
`endFrame` resolves the multisampled `Framebuffer` and presents to the swapchain for you — no manual
48-
resolve targets, store-op bookkeeping, or present plumbing.
57+
The `endFrame` method resolves the multisampled `Framebuffer` and presents to the swapchain for you. No manual
58+
resolve targets, no store-op bookkeeping, no presentation plumbing.
59+
60+
## Getting Started
61+
62+
Check out the **[Installation](https://jdolan.github.io/ObjectivelyGPU/install.html)** page for dependencies, building, and linking instructions.
4963

5064
## User Guide
5165

52-
Consult the **[User Guide](https://jdolan.github.io/ObjectivelyGPU/guide.html)** to draw your first frame — the
66+
Peep the **[User Guide](https://jdolan.github.io/ObjectivelyGPU/guide.html)** to draw your first frame — the
5367
render device, resource objects, framebuffers and MSAA, the typed passes, and shaders.
5468

5569
## API Documentation
5670

57-
Browse the [API Documentation](https://jdolan.github.io/ObjectivelyGPU/) to explore the library.
58-
59-
## Getting Started
60-
61-
### Dependencies
62-
63-
* [Objectively](https://github.com/jdolan/Objectively) >= 2.0.0
64-
* [SDL3](https://github.com/libsdl-org/SDL) >= 3.2.0
65-
66-
### Building
67-
68-
```sh
69-
autoreconf -i
70-
./configure
71-
make && sudo make install
72-
```
71+
Browse the [API Documentation](https://jdolan.github.io/ObjectivelyGPU/) to explore the library further.
7372

74-
## Examples & projects using ObjectivelyGPU
73+
## Project Showcase
7574

7675
1. [Hello](Examples/Hello.c) renders a spinning, multisampled 3D cube.
7776
1. [HelloCompute](Examples/HelloCompute.c) animates particles with a compute shader and draws them as points.
@@ -81,4 +80,5 @@ make && sudo make install
8180
<p align="center">
8281
<img src="Documentation/Hello.gif" width="48%" alt="Hello — a spinning, multisampled 3D cube">
8382
<img src="Documentation/HelloCompute.gif" width="48%" alt="HelloCompute — particles animated by a compute shader">
83+
<img src="Documentation/ObjectivelyMVC-Hello.gif" width="48%" alt="Hello ObjectivelyMVC - a simple in-game menu">
8484
</p>

0 commit comments

Comments
 (0)