Conversation
Initial generated C++
Organizational changes.
There was a problem hiding this comment.
Pull request overview
Adds an initial set of C++ runtime documentation pages to the docs site, covering core concepts (File/Artboard/Scene), rendering backends, the render loop, state machines/inputs, data binding, and asset loading, and wires them into the left-nav.
Changes:
- Added a new
runtimes/cpp/doc section with pages for getting started, rendering, state machines, data binding, asset loading, and external renderer integration. - Documented the GPU
RenderContextlifecycle (beginFrame/flush), resize handling, and fixed-timestep simulation guidance. - Updated
docs.jsonto expose the new C++ section in the “Runtimes” navigation.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| runtimes/cpp/index.mdx | Adds C++ runtime overview page and entry-point links. |
| runtimes/cpp/getting-started.mdx | Adds build + first render-loop walkthrough. |
| runtimes/cpp/file-and-artboard.mdx | Adds file import, artboard querying/instancing, layout sizing, and lifetime guidance. |
| runtimes/cpp/state-machines.mdx | Adds scene lifecycle, pointer forwarding, input access, and state-change introspection. |
| runtimes/cpp/data-binding.mdx | Adds ViewModel runtime/instance/property usage docs and examples. |
| runtimes/cpp/asset-loading.mdx | Adds FileAssetLoader guidance with sync/async examples and caveats. |
| runtimes/cpp/rendering-loop.mdx | Adds detailed beginFrame/flush sequencing, frame descriptors, and operational notes. |
| runtimes/cpp/renderers.mdx | Adds per-backend RenderContext setup snippets (D3D11/12, Metal, Vulkan, GL/WebGL). |
| runtimes/cpp/external-renderer.mdx | Documents implementing Renderer/Factory to plug into custom backends. |
| docs.json | Adds the new C++ pages to the Runtimes sidebar nav. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| { | ||
| "group": "Runtimes", | ||
| "pages": [ | ||
| { |
There was a problem hiding this comment.
Can you put this after Unity?
There was a problem hiding this comment.
Architecturally I think it makes sense to have core first followed by the wrappers. At least as a dev, that's how I would expect it to flow. Happy to discuss and hear your thoughts.
There was a problem hiding this comment.
Agreed, but it's also the most complex, the most intimidating, and the least likely for someone to use.
| This is the hook you use to react in C++ to states the designer set up — log | ||
| analytics, play a sound, fire a callback into your engine. | ||
|
|
||
| ## Linear animations directly |
There was a problem hiding this comment.
Linear animations directly
Not recommended.
Please use Title Case.
This title is a bit of a fragment. Can we do somethig like:
-Running Linear animations directly
- Linear Animations
- Running Linear Animations
There was a problem hiding this comment.
Changed. Should all titles have Title Case?
| [Renderer](/runtimes/cpp/external-renderer) — including Rive's own GPU | ||
| [Renderer](/runtimes/cpp/renderers) (Metal, Vulkan, D3D11, D3D12, OpenGL/WebGL). |
| @@ -0,0 +1,129 @@ | |||
| --- | |||
| title: "State Machines" | |||
| description: "Advance scenes and forward pointer events." | |||
| - `build_rive.sh` (no args) — debug build for the host. | ||
| - `build_rive.sh release clean` — clean rebuild. | ||
| - `build_rive.sh ninja release` — use Ninja instead of make. | ||
| - `build_rive.sh ios release` / `build_rive.sh android release` — |
| D3DContextOptions options; | ||
| options.isIntel = adapterDesc.VendorId == 0x163C || | ||
| adapterDesc.VendorId == 0x8086 || | ||
| adapterDesc.VendorId == 0x8087; | ||
|
|
||
| std::unique_ptr<RenderContext> rc = | ||
| RenderContextD3DImpl::MakeContext(device, context, options); | ||
|
|
||
| auto* impl = rc->static_impl_cast<RenderContextD3DImpl>(); | ||
| rcp<RenderTargetD3D> target = impl->makeRenderTarget(width, height); | ||
|
|
||
| // Each frame: bind the current backbuffer to the render target. | ||
| target->setTargetTexture(backbufferTexture); | ||
| ``` | ||
|
|
||
| Swap-chain notes: | ||
| - Set `BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_UNORDERED_ACCESS`. | ||
| - Use `DXGI_FORMAT_R8G8B8A8_UNORM` (or the `_SRGB` variant); other formats | ||
| may force the renderer onto an offscreen path. | ||
| - Set `options.isIntel = true` on Intel HD Graphics — works around a driver | ||
| bug in pixel-local-storage emulation. | ||
|
|
||
| For a working reference, see Rive's | ||
| [`tests/player`](https://github.com/rive-app/rive-runtime/tree/main/tests/player) | ||
| sample app and the D3D-specific wiring in | ||
| [`tests/common/offscreen_rendertarget_d3d.cpp`](https://github.com/rive-app/rive-runtime/blob/main/tests/common/offscreen_rendertarget_d3d.cpp). | ||
| </Tab> | ||
|
|
||
| <Tab title="D3D12"> | ||
| Header: `rive/renderer/d3d12/render_context_d3d12_impl.hpp` | ||
|
|
||
| ```cpp | ||
| #include "rive/renderer/d3d12/render_context_d3d12_impl.hpp" | ||
|
|
||
| using namespace rive::gpu; | ||
|
|
||
| ComPtr<ID3D12Device> device; | ||
| ComPtr<ID3D12GraphicsCommandList> initList; // recording state | ||
|
|
||
| D3DContextOptions options; | ||
| std::unique_ptr<RenderContext> rc = | ||
| RenderContextD3D12Impl::MakeContext(device, initList.Get(), options); | ||
|
|
||
| auto* impl = rc->static_impl_cast<RenderContextD3D12Impl>(); | ||
| rcp<RenderTargetD3D12> target = impl->makeRenderTarget(width, height); | ||
| ``` |
This is mostly Claude generated. I've made some changes to the output but this need a good once-over by someone familiar with the C++ API.