Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b5371b7
Stripping symbols from release binaries
kunitoki Jul 3, 2026
c0649c7
Include ORE
kunitoki Jul 4, 2026
d71525b
Fix function name
kunitoki Jul 4, 2026
c27ff9f
Merge branch 'main' into dev/gpu_graphics
kunitoki Jul 7, 2026
0cbfbd3
More graphics work
kunitoki Jul 7, 2026
fff1569
More graphics context goodies
kunitoki Jul 7, 2026
208d0df
Enable rive toBlob for ORE
kunitoki Jul 7, 2026
f3bb52a
Missing cleanups
kunitoki Jul 7, 2026
25cbc8c
More graphics goodies
kunitoki Jul 7, 2026
75b8b88
Fix context
kunitoki Jul 7, 2026
c65267e
More shader bundle work
kunitoki Jul 7, 2026
14bee49
Remove spinning cube
kunitoki Jul 7, 2026
1e65ebd
More stuff
kunitoki Jul 7, 2026
09bc6e2
Added spirv_tools
kunitoki Jul 7, 2026
fe3c6e2
Improved GFX rendering
kunitoki Jul 7, 2026
a1c308a
Fix issue with undeterministic tests
kunitoki Jul 7, 2026
6e4eb1e
Merge branch 'dev/gpu_graphics_try_1' into dev/gpu_graphics_try_2
kunitoki Jul 7, 2026
e6512b7
More work on GPU
kunitoki Jul 7, 2026
acf2400
Fix stuff
kunitoki Jul 7, 2026
7171722
Compile also blur shader
kunitoki Jul 7, 2026
12eb387
Fix issue with D3D sampled texture
kunitoki Jul 7, 2026
cfcaec1
Changelog
kunitoki Jul 7, 2026
5194529
Fix issues
kunitoki Jul 7, 2026
79af482
More work
kunitoki Jul 7, 2026
8321499
More tweaks
kunitoki Jul 7, 2026
190d1f3
Fix issue
kunitoki Jul 7, 2026
ecb345e
Fix issue on gcc
kunitoki Jul 7, 2026
b4a1cbd
Fix annoying warnings in tests
kunitoki Jul 7, 2026
bcc8e83
More fixes
kunitoki Jul 7, 2026
89c21fa
Remove emdashes
kunitoki Jul 7, 2026
fbddc8d
More cleanups
kunitoki Jul 7, 2026
f3beb35
More cleanups
kunitoki Jul 7, 2026
f41edf5
More cleanups
kunitoki Jul 7, 2026
f8548e2
More cleanups
kunitoki Jul 7, 2026
3c963f9
Merge branch 'main' into dev/gpu_graphics_try_1
kunitoki Jul 7, 2026
87160e6
Improved RHI
kunitoki Jul 7, 2026
474adf4
Improved storage
kunitoki Jul 7, 2026
cf93728
Fix windows
kunitoki Jul 7, 2026
444b8fa
Fix changelog
kunitoki Jul 7, 2026
223f6ea
Forgot a size
kunitoki Jul 7, 2026
689dac6
More refactors
kunitoki Jul 7, 2026
e3184f3
More improvements
kunitoki Jul 8, 2026
d2bfe0e
Fix tools
kunitoki Jul 8, 2026
fd6512a
More tests
kunitoki Jul 8, 2026
616b5c5
Fix issues
kunitoki Jul 8, 2026
8cb7a51
Fix issue
kunitoki Jul 8, 2026
17d7f9a
More coverage
kunitoki Jul 8, 2026
c1d27a4
Test GpuPipeline compilation from shader
kunitoki Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
#### Shader Compiler (#126)

- New glslang (`thirdparty/glslang`) and SPIRV-Cross integration (`thirdparty/spirv_cross`) for shader reflection and cross-compilation (GLSL, HLSL, MSL, WGSL)
- New `ShaderBundle` class (`shading/yup_ShaderBundle.h`): RIFF binary format (`.ysl`) that stores original source, per-stage SPIR-V, all transpiled variants (GLSL/ESSL/HLSL/MSL), and full `ShaderReflection` data. Persists to / loads from `OutputStream`, `File`, and `MemoryBlock` via `saveToStream` / `loadFromStream` and friends. Lookup by stage + language via `findShader()`.
- New `ShaderBundleCompiler` class (`shading/yup_ShaderBundleCompiler.h`): drives `ShaderTranspiler` to compile + transpile multiple stage/language combinations in one call and returns a fully-populated `ShaderBundle`. Accepts a `ShaderBundleCompileRequest` with per-stage `ShaderBundleEntry` items (stage, target languages, `TranspileOptions`).
- New `BinaryOutputArchive` / `BinaryInputArchive` pair (`yup_core/serialisation/yup_BinaryArchive.h`): binary stream archives that plug into the `SerialisationTraits` system; used internally by `ShaderBundle` to serialise `ShaderReflection` data into `REFL` RIFF chunks.
- `SerialisationTraits` specialisations for all `ShaderReflection` nested types (`EntryPoint`, `WorkgroupSize`, `ResourceMember`, `ResourceBinding`, `BuiltInBinding`, `SpecializationConstant`, `ShaderReflection`) enabling binary and JSON serialisation of full reflection data. Both `ShaderBundle` and `ShaderBundleCompiler` are compiled only when `YUP_ENABLE_SHADER_TRANSPILER` is `1`.
- `TranspileOptions` now exposes `spirvOptimize` flag; wired through to `glslang::SpvOptions` (disabled by default; requires SPIRV-Tools linked into glslang to take effect).

#### macOS

Expand All @@ -25,6 +30,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Bug Fixes

- UBSAN and ASAN fixes throughout the codebase
- `GpuProgram::compile()` now correctly routes HLSL and MSL shader sources: HLSL sources are passed through the ore `ShaderModuleDesc::hlslSource` fields required by the D3D11/D3D12 backends (previously they were collapsed to GLSL, tripping the backend assertion), and the source language is mapped explicitly instead of defaulting all non-WGSL sources to GLSL.
- `GpuProgram` now binds sampled input textures through a shader-resource view (`wrapRiveTexture`) instead of the render-target-only canvas view (`wrapCanvasTexture`). On D3D the canvas view exposes no SRV, so sampling a `GpuCanvas`-backed texture (e.g. feeding a scene render into a blur post-process) previously read nothing and produced a blank result.
- `GpuRenderPass` now selects the correct texture view per usage: color attachments prefer the render-target-backed canvas view (`wrapCanvasTexture`) while sampled inputs prefer the SRV-backed rive-texture view (`wrapRiveTexture`). The RHI refactor had collapsed both into a single SRV-first path, leaving D3D color attachments with no render-target view bound (`DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET`, draws discarded) on Windows.
- Shader reflection no longer throws (caught) spirv-cross exceptions on built-in interface blocks (e.g. `gl_PerVertex`): struct member offset/stride queries are now guarded by their decorations, and built-in blocks without an `Offset` decoration are skipped instead of triggering noisy first-chance exceptions.
### Graphics RHI

- New `GpuTexture` class (`rhi/yup_GpuTexture.h`): opaque reference-counted GPU texture wrapping `rive::gpu::Texture` or `rive::gpu::RenderCanvas`. Obtained from `GpuCanvas::asTexture()` or constructed internally by `Image::fromTexture()`.
- New `GpuCanvas` class (`rhi/yup_GpuCanvas.h`): consolidated backend-agnostic offscreen GPU surface that now owns its `OffscreenTarget` directly and creates a non-owning `Graphics` lazily only when 2D drawing is requested. `commit()` finalises the 2D frame only if `getGraphics()` opened one, so canvases used purely as render targets no longer need an empty commit. API: `GpuCanvas::create()`, `getGraphics()`, `commit()`, `asTexture()`, `asImage()`, `readPixels()`, and the new `beginRenderPass(GpuFrame&, GpuRenderOptions)`.
- `Image::fromTexture(GpuTexture::Ptr)`: creates an `Image` wrapping an existing GPU texture (no CPU round-trip). Suitable for `Graphics::drawImage()`.
- `Graphics::drawTexture(GpuTexture::Ptr, Rectangle<float>)`: draws a GPU texture directly without materialising an `Image`, avoiding CPU-side ImagePixelData allocation.
- **Breaking:** `GpuProgram` has been split into focused RHI types and removed entirely:
- New `GpuPipeline` class (`rhi/yup_GpuPipeline.h`): an immutable compiled render pipeline (vertex + fragment shaders plus fixed pipeline state). `compile(ctx, vs, fs, GpuPipelineOptions)`, `compileFromBundle(ctx, ShaderBundle, GpuPipelineOptions)`, and (when `YUP_ENABLE_SHADER_TRANSPILER = 1`) `compileFromGlsl(ctx, vertexGlsl, fragmentGlsl, GpuPipelineOptions)` all return `ResultValue<GpuPipeline::Ptr>`. Pipelines carry all the backend-agnostic mirror enums/structs (`GpuVertexFormat`, `GpuPipelineOptions`, `GpuColorTarget`, `GpuDepthStencilState`, …).
- New `GpuFrame` class (`rhi/yup_GpuFrame.h`): move-only RAII GPU frame scope (`GpuFrame::begin(ctx)` → `submit()` → `waitForGPU()`). Owns the transient GPU resource pools (uniform buffers, texture views, samplers) created while encoding its passes.
- New `GpuRenderPass` class (`rhi/yup_GpuRenderPass.h`): move-only transient render-pass encoder targeting a `GpuCanvas`. Holds the mutable binding state (`setPipeline`, `setTexture`, `setUniformBuffer`, `setVertexBuffer`, `setIndexBuffer`) and encodes draws (`draw`, `drawIndexed`, `finish`). `GpuRenderOptions` (clear flag + clear color) moved here.
- New `GpuPipelineCache` class (`rhi/yup_GpuPipelineCache.h`): thread-safe compile-or-fetch cache for `GpuPipeline` keyed by a deterministic SHA1 of the selected native shader sources, entry points, pipeline options, and graphics API. LRU eviction with a configurable entry limit, mirroring `ShaderCache`.
- New `GpuBuffer` class (`rhi/yup_GpuBuffer.h`): reference-counted GPU buffer handle wrapping a backend-native ore buffer. `GpuBuffer::create(ctx, GpuBufferType, data, byteSize)` uploads immutable vertex/index/uniform data for use with `GpuRenderPass`.
- New `makeShaderBindingMapBlob(ShaderReflection, ShaderStage)` helper (`rhi/yup_ShaderBindingMap.h`): converts shader reflection data into the ore RSTB binding-map blob required by `GpuShaderSource::bindingMap`.
- GraphicsContext ore integration (`Options::enableOreContext = true`): activates the backend-native ore context. New ore-free `GraphicsContext::isGpuAvailable()` capability probe; `gpuContext()` is retained but documented `@internal` as the single backend bridge.
- **Breaking:** removed `GpuCanvas::withAttachment()`, `GpuProgram::oreContext()`, and `GpuProgram::orePipeline()`. The public `rive::ore` surface is now a single forward declaration plus one `@internal` accessor on `GraphicsContext`; every RHI header is ore-free.
- `SpinningCubeDemo` example (`examples/graphics`): rewritten to the new RHI shape — `GpuFrame` + `GpuCanvas::beginRenderPass` + `GpuRenderPass` for both the indexed cube draw and the separable two-pass blur (H+V sharing one `GpuFrame`), `isGpuAvailable()` capability probe, and live GLSL editing via `GpuPipeline::compileFromGlsl`. The default Lottie animation is now played back per-frame into an offscreen `GpuCanvas` (2D path) and sampled by the cube's fragment shader so the animation is texture-mapped onto every cube face.

---

Expand Down Expand Up @@ -201,6 +226,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- `yup_python`: Python bindings (from popsicle) ([#65](https://github.com/kunitoki/yup/pull/65))

#### `yup_core` Additions
- `constructAt()` / `destroyAt()` / `voidify()` in `memory/yup_Memory.h`: portable replacements for `std::construct_at` / `std::destroy_at`, used by `TypeErasedObject`
- `TypeErasedObject` now supports class template argument deduction (deduction guide sizes storage to the stored value) and move construction / assignment from a smaller-sized `TypeErasedObject`
- `SqliteDatabase` with `Statement` and `Transaction` ([#94](https://github.com/kunitoki/yup/pull/94))
- Perfetto profiling: `YUP_ENABLE_PROFILING`, `Profiler` singleton, `YUP_PROFILE_START` / `YUP_PROFILE_STOP` macros ([#20](https://github.com/kunitoki/yup/pull/20))
- `Watchdog` file watching utility ([#50](https://github.com/kunitoki/yup/pull/50))
Expand Down
9 changes: 7 additions & 2 deletions cmake/plugins/yup_plugin_args.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ endfunction()

#==============================================================================

function (_yup_audio_plugin_apply_binary_optimizations target_name)
function (_yup_apply_binary_optimizations target_name)
cmake_parse_arguments (YUP_ARG "" "" "EXPORTED_SYMBOLS" ${ARGN})

set (release_config "$<CONFIG:Release,MinSizeRel>")
Expand All @@ -73,7 +73,8 @@ function (_yup_audio_plugin_apply_binary_optimizations target_name)

if (YUP_PLATFORM_APPLE)
target_link_options (${target_name} PRIVATE
$<${release_config}:LINKER:-dead_strip>)
$<${release_config}:LINKER:-dead_strip>
$<${release_config}:LINKER:-x>)

foreach (exported_symbol ${YUP_ARG_EXPORTED_SYMBOLS})
target_link_options (${target_name} PRIVATE
Expand All @@ -99,3 +100,7 @@ function (_yup_audio_plugin_apply_binary_optimizations target_name)
endif()
endif()
endfunction()

function (_yup_audio_plugin_apply_binary_optimizations target_name)
_yup_apply_binary_optimizations (${target_name} ${ARGN})
endfunction()
2 changes: 2 additions & 0 deletions cmake/yup_standalone.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ function (yup_standalone_app)
OBJCXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)

_yup_apply_binary_optimizations (${target_name})

target_compile_features (${target_name} PRIVATE cxx_std_${target_cxx_standard})
target_include_directories (${target_name} PRIVATE ${module_include_dirs})

Expand Down
6 changes: 4 additions & 2 deletions examples/graphics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ yup_standalone_app (
yup::yup_audio_gui
yup::yup_audio_processors
yup::yup_audio_formats
yup::yup_shading
bungee_library
pffft_library
opus_library
Expand All @@ -97,14 +98,15 @@ yup_standalone_app (
libgif
glslang
spirv_cross
spirv_tools
${additional_modules}
${link_libraries})

# ==== Prepare sources
if (NOT YUP_TARGET_ANDROID)
file (GLOB_RECURSE sources
"${CMAKE_CURRENT_LIST_DIR}/source/*.cpp"
"${CMAKE_CURRENT_LIST_DIR}/source/*.h")
"${CMAKE_CURRENT_LIST_DIR}/source/examples/*.h"
"${CMAKE_CURRENT_LIST_DIR}/source/main.cpp")
source_group (TREE ${CMAKE_CURRENT_LIST_DIR}/ FILES ${sources})
target_sources (${target_name} PRIVATE ${sources})
endif()
2 changes: 1 addition & 1 deletion examples/graphics/source/examples/OffscreenRenderDemo.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class OffscreenRenderDemo : public yup::Component
auto bounds = getLocalBounds().to<float>().reduced (10.0f);
bounds.removeFromTop (75.0f); // leave room for buttons and status label

if (offscreenImage.isValid() && offscreenImage.getTexture() != nullptr)
if (offscreenImage.isValid() && offscreenImage.getGpuTexture() != nullptr)
{
// GPU-direct path: the image holds a GPU texture; drawImage samples it without CPU upload.
const auto imgW = static_cast<float> (offscreenImage.getWidth());
Expand Down
Loading
Loading