Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Notable changes per release. Releases are tagged `vX.Y.Z`; the version lives in
`CMakeLists.txt` and is available in code from `gui_core/gui_version.h`.

## [Unreleased] — 0.1.0

First public preview. The API is not stable yet.
## [Unreleased] — 1.1.0

- Immediate-mode style GUI library for C++20 on Vulkan and SDL3 (`gui_core`, `gui_controls`).
- CSS-like styling with a dark and a light theme; text shaping, bidi and font fallback through skribidi.
Expand Down Expand Up @@ -305,4 +303,5 @@ First public preview. The API is not stable yet.
- Showcase: every Hierarchy panel shows one scene, and every Files panel one set of files. An object added, deleted or moved in one Hierarchy, or a file moved or renamed in one Files panel, shows in the others; what each one opened, selected and searched stays its own.
- Fixed: a window that closed in the frame its own redraw ran, while it was resized or shown again, crashed the app: dragging a docked panel by its tab and dropping it could close the drag preview that way. The Vulkan, Direct3D 12, SDL GPU and Metal window contexts stop that redraw once the frame has closed their window, and don't present it.
- Fixed: a rich-text run's own color (`ContentRun::color` or `background`, a link's) was registered as a color style that was never let go, so a run whose color changed every frame added a style a frame. A run's color now has a style of its own, shared by the runs in that color and let go some frames after nothing draws with it. A cached panel's replay keeps the colors its text was drawn with, and one that went makes the panel draw again.
- Runs on GPUs without 16-bit shader types: GeForce GTX 750, 900 and 10 series and Radeon RX 400 and 500 series on Vulkan; GeForce GTX 900 and 10 series and Radeon R9 285, 380 and Fury and RX 400 and 500 series on Direct3D 12. The shaders read the primitives' and styles' 16-bit fields from the 32-bit words holding them, with 32-bit operations; the data and what's drawn are unchanged. The Vulkan backend no longer requires `shaderFloat16`, `shaderInt16`, `shaderInt8` or 8- and 16-bit storage, and SDL GPU's device no longer asks for the 16-bit ones.
- SDL GPU: the shaders read each color style's image once, not once for each color type, so they hold far less code. SDL GPU can't index its images, so each read is a case for every image a draw binds. A driver that compiles shaders when they're first drawn with no longer stalls: lavapipe on Windows took 15 s to draw a first frame, and now takes under 3.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(APPLE AND NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.3" CACHE STRING "The oldest macOS the programs run on")
endif()

set(TACHYON_VERSION 0.1.0)
set(TACHYON_VERSION 1.1.0)
project(TachyonUI VERSION ${TACHYON_VERSION} LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
Expand Down
44 changes: 31 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<p align="center">
<a href="https://github.com/LogicalError/TachyonUI/actions/workflows/ci.yml"><img src="https://github.com/LogicalError/TachyonUI/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="https://logicalerror.github.io/TachyonUI/"><img src="https://github.com/LogicalError/TachyonUI/actions/workflows/docs.yml/badge.svg" alt="Docs"></a>
<img src="https://img.shields.io/badge/version-0.1%20preview-A1660C" alt="Version 0.1 preview">
<img src="https://img.shields.io/badge/version-1.1-A1660C" alt="Version 1.1">
<img src="https://img.shields.io/badge/C%2B%2B-20-2F6FCF" alt="C++20">
<img src="https://img.shields.io/badge/Vulkan-1.3-A5262D" alt="Vulkan 1.3">
<img src="https://img.shields.io/badge/Metal-3-555555" alt="Metal 3">
Expand Down Expand Up @@ -43,44 +43,62 @@ in an application that already has a Vulkan, Direct3D 12 or Metal renderer.

### Windows

Renders with Vulkan by default.

- Windows x64
- Visual Studio 2026 with CMake 4.2 or newer, or Visual Studio 2022 with CMake 3.22 or newer
- The [Vulkan SDK](https://vulkan.lunarg.com/) 1.4.341 or newer, for its Slang shader compiler
(or an older SDK and a [Slang release](https://github.com/shader-slang/slang/releases) 2026.1 or newer)
- Git with [Git LFS](https://git-lfs.com/) (the fonts are stored in LFS)
- A GPU with Vulkan 1.3, on a current driver:
- NVIDIA GeForce GTX 750 or 900 series, or newer
- AMD Radeon RX 400 series, or newer
- Intel HD or UHD Graphics 500 or 600 (6th-gen Core), Iris Xe or Arc, or newer
- Optional: `-DTACHYON_D3D12=ON` adds the Direct3D 12 backend (no extra packages);
`--graphics d3d12` picks it in the showcase. It needs one of these GPUs, on a current driver:
- NVIDIA GeForce GTX 900 series, or newer
- AMD Radeon R9 285, R9 380 or R9 Fury, Radeon RX 400 series, or newer
- Intel Iris Plus (10th-gen Core "Ice Lake"), Iris Xe or Arc, or newer; not the HD or UHD
Graphics of 6th to 10th-gen Core
- Optional: `-DTACHYON_SDLGPU=ON` adds the SDL GPU backend, on SDL's Vulkan or Direct3D 12
driver (no extra packages); `--graphics sdlgpu` picks it in the showcase

### Linux

Renders with Vulkan by default.

- Linux x64
- GCC 13 or newer, or Clang 17 or newer
- CMake 3.22 or newer and Ninja
- The X11 and Wayland development packages SDL3 needs ([list for Ubuntu](.github/linux-packages.txt))
- The [Vulkan SDK](https://vulkan.lunarg.com/) 1.4.341 or newer, or your distribution's Vulkan
packages and a [Slang release](https://github.com/shader-slang/slang/releases) 2026.1 or newer
- Git with [Git LFS](https://git-lfs.com/) (the fonts are stored in LFS)
- A GPU with Vulkan 1.3, on a current driver:
- NVIDIA GeForce GTX 750 or 900 series, or newer, on NVIDIA's driver
- AMD Radeon RX 400 series, or newer, on Mesa
- Intel HD or UHD Graphics 500 or 600 (6th-gen Core), Iris Xe or Arc, or newer, on Mesa
- Optional: `-DTACHYON_SDLGPU=ON` adds the SDL GPU backend, on SDL's Vulkan driver (no extra
packages); `--graphics sdlgpu` picks it in the showcase

### macOS

Renders with Metal by default.
Renders with Metal by default.

- macOS 13.3 or newer, on Apple silicon or an Intel Mac with a Metal 3 GPU
- macOS 13.3 or newer
- Apple Clang: Xcode or just its Command Line Tools (`xcode-select --install`)
- CMake 3.22 or newer and Ninja (`brew install cmake ninja git-lfs`)
- A [Slang release](https://github.com/shader-slang/slang/releases) 2026.1 or newer for its `slangc`
(it's not in Homebrew): unpack it and put `slangc` on the `PATH`, or set `SLANGC` to it
- Git with [Git LFS](https://git-lfs.com/) (the fonts are stored in LFS)
- A GPU with Metal 3:
- every Apple silicon Mac
- on an Intel Mac: AMD Radeon Vega, Radeon 5000 or 6000 series, or Intel UHD Graphics 630, or newer
- Optional: `-DTACHYON_SDLGPU=ON` adds the SDL GPU backend, on SDL's Metal driver (no extra
packages); `--graphics sdlgpu` picks it in the showcase
- Optional: `-DTACHYON_VULKAN=ON` adds the Vulkan backend through MoltenVK (the Vulkan SDK, or
Homebrew's `vulkan-headers`, `vulkan-loader` and `molten-vk`); `--graphics vulkan` picks it in the showcase

### To run

- Windows and Linux: a GPU driver with Vulkan 1.3 and the features listed by
`VulkanDeviceContext::GetDeviceRequirements()`
- macOS: a GPU of the Metal 3 family (every Apple silicon Mac; on Intel Macs, AMD Vega,
Radeon 5000/6000 or Intel UHD 630 and newer)

## Quick start

```sh
Expand Down Expand Up @@ -142,7 +160,7 @@ If you're new to TachyonUI, the [tutorial](docs/tutorial.md) goes from an empty
app with docked panels, buttons and fields.

```cmake
find_package(TachyonUI 0.1 CONFIG REQUIRED) # after cmake --install
find_package(TachyonUI 1.1 CONFIG REQUIRED) # after cmake --install
# or: add_subdirectory(external/TachyonUI)
target_link_libraries(my_app PRIVATE TachyonUI::gui_controls)
```
Expand All @@ -165,8 +183,8 @@ The synchronization rules and code are in [Using your own Vulkan device](docs/in

## Status

**0.1 preview.** The API will still change. Windows x64 and Linux x64 are built and tested in
CI. macOS (Apple silicon) runs on Metal; CI builds it and runs the tests that need no GPU.
**1.1.** Windows x64 and Linux x64 are built and tested in CI. macOS (Apple silicon) runs on
Metal; CI builds it and runs the tests that need no GPU.

---

Expand Down
2 changes: 1 addition & 1 deletion cmake/TachyonUIConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# TachyonUI: C++ GUI library (gui_core, gui_controls).
#
# find_package(TachyonUI 0.1 CONFIG REQUIRED)
# find_package(TachyonUI 1.1 CONFIG REQUIRED)
# target_link_libraries(my_app PRIVATE TachyonUI::gui_controls)
#
# Provides:
Expand Down
4 changes: 2 additions & 2 deletions docs/integration/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ cmake --install build --config Release --prefix <prefix>
A program using the package then needs no TachyonUI source or build tree:

```cmake
find_package(TachyonUI 0.1 CONFIG REQUIRED)
find_package(TachyonUI 1.1 CONFIG REQUIRED)
target_link_libraries(my_app PRIVATE TachyonUI::gui_controls)
```

Expand All @@ -144,7 +144,7 @@ target_link_libraries(my_app PRIVATE TachyonUI::gui_controls)
```cmake
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release)
set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL Release)
find_package(TachyonUI 0.1 CONFIG REQUIRED)
find_package(TachyonUI 1.1 CONFIG REQUIRED)
```

- A minimal program using the package: `tests/package_consumer`.
Expand Down
12 changes: 3 additions & 9 deletions docs/integration/sdlgpu-device.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ app.Initialize(options);

- The GUI's shaders are built as SPIR-V (for Vulkan), on Windows DXIL (for Direct3D 12), and on
macOS Metal source (MSL, for Metal). The device must take one of them.
- On Vulkan, the shaders use features SDL doesn't turn on by itself:
- 16-bit storage and 16-bit types
- draw parameters
- On Vulkan, the shaders use a feature SDL doesn't turn on by itself: draw parameters.
- `SDLGPUGraphicsContext::ApplyDeviceRequirements(props)` sets all of that on the properties
you create the device with:

Expand All @@ -47,12 +45,8 @@ SDL_DestroyProperties(props);
```

- It sets the Vulkan options property (`SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER`).
- If you set Vulkan options of your own, they replace it. Then turn these on in yours, with
Vulkan 1.2:
- `storageBuffer16BitAccess`, `uniformAndStorageBuffer16BitAccess` and
`shaderDrawParameters` (Vulkan 1.1 features)
- `shaderFloat16` (Vulkan 1.2)
- `shaderInt16` (Vulkan 1.0)
- If you set Vulkan options of your own, they replace it. Then turn on `shaderDrawParameters`
(a Vulkan 1.1 feature) in yours, with Vulkan 1.2.
- `SDLGPUGraphicsContext::CheckDeviceSupport(device, &problems)` checks a device. It lists what
the device lacks, one line each:

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ target_link_libraries(my_app PRIVATE TachyonUI::gui_controls)
the program.
- As a subproject, TachyonUI builds only its libraries, not its examples or tests.
- For an installed TachyonUI, replace `add_subdirectory` with
`find_package(TachyonUI 0.1 CONFIG REQUIRED)`; see
`find_package(TachyonUI 1.1 CONFIG REQUIRED)`; see
[Adding the library to a build](../integration/build.md).

## Building
Expand Down
21 changes: 7 additions & 14 deletions src/gui_core/graphics/sdlgpu/sdlgpu_graphics_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,27 +162,20 @@ namespace tachyon::sdlgpu

void SDLGPUGraphicsContext::ApplyDeviceRequirements(SDL_PropertiesID props)
{
// On Vulkan, what the shaders use that SDL's device doesn't enable by itself: the 16-bit
// types, and the draw parameters SV_VertexID is built from (VertexIndex - BaseVertex).
// SDL reads them when the device is made; they live as long as the program.
// On Vulkan, what the shaders use that SDL's device doesn't enable by itself: the draw
// parameters SV_VertexID is built from (VertexIndex - BaseVertex). SDL reads them when the
// device is made; they live as long as the program.
struct Vulkan
{
VkPhysicalDeviceVulkan12Features features12{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES };
VkPhysicalDeviceVulkan11Features features11{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES };
VkPhysicalDeviceFeatures features10{};
SDL_GPUVulkanOptions options{};

Vulkan()
{
features12.shaderFloat16 = VK_TRUE;
features11.pNext = &features12;
features11.shaderDrawParameters = VK_TRUE;
features11.storageBuffer16BitAccess = VK_TRUE;
features11.uniformAndStorageBuffer16BitAccess = VK_TRUE;
features10.shaderInt16 = VK_TRUE;
options.vulkan_api_version = VK_API_VERSION_1_2;
options.feature_list = &features11;
options.vulkan_10_physical_device_features = &features10;
features11.shaderDrawParameters = VK_TRUE;
// The Vulkan 1.1 features struct is Vulkan 1.2's.
options.vulkan_api_version = VK_API_VERSION_1_2;
options.feature_list = &features11;
}
};
static Vulkan vulkan;
Expand Down
10 changes: 4 additions & 6 deletions src/gui_core/graphics/sdlgpu/sdlgpu_graphics_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ namespace tachyon::sdlgpu

/// Sets on `props` what the GUI's shaders need of a device a host makes with
/// SDL_CreateGPUDeviceWithProperties: the shader formats they're built in (SPIR-V, and
/// DXIL on Windows), and on Vulkan the features they use (16-bit storage and types,
/// draw parameters), as SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER. Options of
/// the host's own replace those: then enable storageBuffer16BitAccess,
/// uniformAndStorageBuffer16BitAccess and shaderDrawParameters (Vulkan 1.1),
/// shaderFloat16 (1.2) and shaderInt16 (1.0) in them, with Vulkan 1.2. What it points to
/// lives as long as the program.
/// DXIL on Windows), and on Vulkan the feature they use (draw parameters), as
/// SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER. Options of the host's own replace
/// those: then enable shaderDrawParameters (Vulkan 1.1) in them, with Vulkan 1.2. What it
/// points to lives as long as the program.
static void ApplyDeviceRequirements(SDL_PropertiesID props);
/// Whether `device` takes the GUI's shaders; what it lacks, one line each, in
/// `problems`. SDL can't tell which Vulkan features a device has: one made without
Expand Down
13 changes: 1 addition & 12 deletions src/gui_core/graphics/vulkan/vk_graphics_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,17 +1150,12 @@ tachyon::vulkan::VulkanDeviceContext::DeviceRequirements tachyon::vulkan::Vulkan
requirements.features12.descriptorBindingPartiallyBound = true;
requirements.features12.descriptorBindingVariableDescriptorCount = true;
requirements.features12.runtimeDescriptorArray = true;
requirements.features12.storageBuffer8BitAccess = true;
requirements.features12.uniformAndStorageBuffer8BitAccess = true;
requirements.features12.shaderSampledImageArrayNonUniformIndexing = true;
requirements.features12.shaderInt8 = true;
requirements.features12.shaderFloat16 = true;
requirements.features12.timelineSemaphore = true; // AddFrameWait

// No 16- or 8-bit types: the shaders read packed fields as 32-bit words (all_common.slang).
requirements.features11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
requirements.features11.storageBuffer16BitAccess = true;

requirements.features.shaderInt16 = true;
requirements.features.shaderInt64 = true; // the shaders' buffer addresses
requirements.features.robustBufferAccess = true;

Expand Down Expand Up @@ -1201,15 +1196,9 @@ bool tachyon::vulkan::VulkanDeviceContext::CheckPhysicalDeviceSupport(VkPhysical
TACHYON_REQUIRE_FEATURE(features12, descriptorBindingPartiallyBound);
TACHYON_REQUIRE_FEATURE(features12, descriptorBindingVariableDescriptorCount);
TACHYON_REQUIRE_FEATURE(features12, runtimeDescriptorArray);
TACHYON_REQUIRE_FEATURE(features12, storageBuffer8BitAccess);
TACHYON_REQUIRE_FEATURE(features12, uniformAndStorageBuffer8BitAccess);
TACHYON_REQUIRE_FEATURE(features12, shaderSampledImageArrayNonUniformIndexing);
TACHYON_REQUIRE_FEATURE(features12, shaderInt8);
TACHYON_REQUIRE_FEATURE(features12, shaderFloat16);
TACHYON_REQUIRE_FEATURE(features12, timelineSemaphore);
TACHYON_REQUIRE_FEATURE(features11, storageBuffer16BitAccess);
#undef TACHYON_REQUIRE_FEATURE
if (required.features.shaderInt16 && !have.features.shaderInt16) missing("features.shaderInt16");
if (required.features.shaderInt64 && !have.features.shaderInt64) missing("features.shaderInt64");
if (required.features.robustBufferAccess && !have.features.robustBufferAccess) missing("features.robustBufferAccess");

Expand Down
61 changes: 61 additions & 0 deletions tests/built_in_resources_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,67 @@ namespace
EXPECT_EQ(dxil, std::size(kPrimitiveSpecs) * 2 * backends);
}

// The shaders keep their 16-bit fields packed in 32-bit words and do their math in 32 bits,
// so they run on GPUs without 16-bit shader types: SPIR-V declares no 16- or 8-bit capability.
TEST(BuiltInShaders, TheSPIRVNeedsNo16Or8BitTypes)
{
constexpr uint32_t kMagic = 0x07230203, kOpCapability = 17;
// Float16, Int16, Int8; 16-bit storage (buffer, uniform, push constant, in/out); 8-bit storage.
constexpr uint32_t kNarrow[] = { 9, 22, 39, 4433, 4434, 4435, 4436, 4448, 4449, 4450 };
size_t modules = 0;
for (const detail::EmbeddedFile& file : detail::EmbeddedShaderFiles())
{
if (!file.key.ends_with(".spv"))
continue;
++modules;
std::vector<uint32_t> words(file.data.size() / 4);
std::memcpy(words.data(), file.data.data(), words.size() * 4);
ASSERT_GT(words.size(), 5u) << file.key;
ASSERT_EQ(words[0], kMagic) << file.key;
for (size_t i = 5; i < words.size();)
{
const uint32_t opcode = words[i] & 0xFFFFu, count = words[i] >> 16;
ASSERT_GT(count, 0u) << file.key;
if (opcode == kOpCapability && count == 2)
EXPECT_EQ(std::ranges::count(kNarrow, words[i + 1]), 0) << file.key << " declares capability " << words[i + 1];
i += count;
}
}
if (modules == 0) GTEST_SKIP() << "built without a backend that runs SPIR-V";
}

// Nor does the DXIL ask for native 16-bit operations (the "SFI0" part's feature flags).
TEST(BuiltInShaders, TheDXILNeedsNoNative16BitOps)
{
constexpr uint64_t kNative16BitOps = 0x40000; // D3D_SHADER_REQUIRES_NATIVE_16BIT_OPS
size_t modules = 0;
for (const detail::EmbeddedFile& file : detail::EmbeddedShaderFiles())
{
if (!file.key.ends_with(".dxil"))
continue;
++modules;
auto read32 = [&](size_t at) { uint32_t v = 0; std::memcpy(&v, file.data.data() + at, 4); return v; };
// DXBC, a 16-byte hash, a version, the container's size, the part count, then each
// part's offset; a part is its four letters, its size and its data.
ASSERT_GE(file.data.size(), 32u) << file.key;
const uint32_t parts = read32(28);
bool found = false;
for (uint32_t p = 0; p < parts; ++p)
{
const uint32_t at = read32(32 + 4 * p);
ASSERT_LE(size_t(at) + 16, file.data.size()) << file.key;
if (std::memcmp(file.data.data() + at, "SFI0", 4) != 0)
continue;
uint64_t flags = 0;
std::memcpy(&flags, file.data.data() + at + 8, 8);
EXPECT_EQ(flags & kNative16BitOps, 0u) << file.key << " needs native 16-bit operations";
found = true;
}
(void)found; // a shader that needs nothing extra has no SFI0 part
}
if (modules == 0) GTEST_SKIP() << "built without a backend that runs DXIL";
}

TEST(BuiltInResources, OnlyAtAFolderBoundary)
{
EXPECT_TRUE(FindBuiltInResource("styles.css").empty());
Expand Down
2 changes: 1 addition & 1 deletion tests/package_consumer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(TachyonUI 0.1 CONFIG REQUIRED)
find_package(TachyonUI 1.1 CONFIG REQUIRED)

add_executable(package_consumer main.cpp)
target_link_libraries(package_consumer PRIVATE TachyonUI::gui_controls)
Expand Down
Loading
Loading