This page walks through initialization using the hello_triangle example. The sample exists in both C++ and C and demonstrates the same startup flow.
CMake Configuration (from hello_triangle)
Example target setup links core + platform targets, with static/shared variants.
# Static variant
target_link_libraries(my_app_cpp
PUBLIC wis::wisdom wis::wisdom-platform SDL3::SDL3)
# Shared variant
target_link_libraries(my_app_cpp_shared
PUBLIC wis::wisdom-shared wis::wisdom-platform-shared SDL3::SDL3)
# Header-interface variant
target_link_libraries(my_app_cpp_headers
PUBLIC wis::wisdom-headers wis::wisdom-platform-headers SDL3::SDL3)
The real example also builds C and C++ executables side-by-side and reuses shared backend helpers.
Initialization Flow
High-level startup sequence used by hello_triangle:
- Create platform extension helper (SDL backend wrapper).
- Create
Instance with debug settings and platform extension.
- Create
Surface from the window.
- Query adapters and create
Device.
- Create queue, swapchain, fence, heaps, and command objects.
- Note
- Once
Device is created, you usually do not need to keep Instance alive for frame execution. Device keeps the required internal references. Keep Instance only when you plan to re-enumerate adapters and rebuild device selection.
C++ initialization snippet
#include <wisdom/wisdom.hpp>
#include <wisdom/wisdom_platform.hpp>
wis::DebugDesc debug_desc{ .enable_debug_layer = true, .callback = log_callback };
wis::InstanceExtensionHeader* extensions[] = { platform.Extension() };
wrapper
wis::Result result;
wis::Instance instance = wis::CreateInstance(&debug_desc, wis::span{extensions}, result);
wis::Surface surface = platform.CreateWindowSurface(window);
wis::AdapterQuery adapters = instance.QueryAdapters(wis::AdapterPreference::Performance, result);
wis::DeviceRequirements requirements{};
requirements.queue_descs = { queue_descs, 1 };
wis::Device device = adapters.CreateDevice(0, requirements, result);
C initialization snippet
#include <wisdom/wisdom.h>
.enable_debug_layer = true,
.callback = log_callback,
};
platform wrapper
Both paths continue with queue/swapchain/pipeline creation as shown in examples/hello_triangle.