3DScene, RasterRender: Vulkan scene renderer, typed ray hits, throwing loader #10

Merged
ilusha merged 3 commits from 3DScene-RasterRender into master 2026-10-29 12:42:29 +03:00
Collaborator

What

Replaces the OpenGL 3D raster pipeline with a Vulkan one and cleans up the scene model around it.

3DScene

  • Scene::castRay is const and returns std::optional<RayHit>; RayTracer reuses it instead of duplicating the loop.
  • Scene::loadLua throws SceneLoadError with the failing field; Lua stack values are popped by scope guards and the state is closed on every path (fixes the leak on early exits).
  • Objects get a stable id (addObject/findObject); the editor selects by id instead of holding a pointer into the scene buffer.
  • The scene holds no GPU state anymore.

RasterRender (new)

  • RenderTarget: offscreen color/depth images with optional MSAA, registered in the device RenderTargetRegistry so a Canvas can draw them, plus readPixels().
  • GpuBuffer and GraphicsPipeline: reusable host-visible buffers and a pipeline builder shared by the scene and sketch renderers.
  • RasterRender: caches one mesh per object id and drops meshes of removed objects; the highlight is drawn in the same pass so it no longer clears the scene.

Consumers

  • 3DEditor drives a RasterRender from the application GpuDevice and shows the path-traced frame through a Canvas RGBA image instead of a GL texture.
  • Sketch3D renders strokes with a geometry-shader pipeline on a shared RenderTarget and splits the renderer from the widgets so it can be tested headless.

Verification

  • New headless GPU tests (TestRasterRender, TestSketch3D) render and read back pixels: depth shading, row orientation vs Camera::project, highlight, resize, mesh release, and stroke redraw.
  • Build failure set is unchanged from master (the 5 pre-existing Widgets SpringRect errors).
  • TestRasterRender, TestSketch3D, TestRayTracer, TestGraphicApplication pass with Vulkan validation on.
  • The 6 failing ctest cases (Threading, LinearRingBuffer) are pre-existing on master.

Not verified

  • The 3DEditorApp/Sketch3DApp executables still cannot link because Widgets does not build on master (SpringRect); only their objects are compiled here.
  • On-device Android rendering.
## What Replaces the OpenGL 3D raster pipeline with a Vulkan one and cleans up the scene model around it. ### 3DScene - `Scene::castRay` is const and returns `std::optional<RayHit>`; `RayTracer` reuses it instead of duplicating the loop. - `Scene::loadLua` throws `SceneLoadError` with the failing field; Lua stack values are popped by scope guards and the state is closed on every path (fixes the leak on early exits). - Objects get a stable id (`addObject`/`findObject`); the editor selects by id instead of holding a pointer into the scene buffer. - The scene holds no GPU state anymore. ### RasterRender (new) - `RenderTarget`: offscreen color/depth images with optional MSAA, registered in the device `RenderTargetRegistry` so a `Canvas` can draw them, plus `readPixels()`. - `GpuBuffer` and `GraphicsPipeline`: reusable host-visible buffers and a pipeline builder shared by the scene and sketch renderers. - `RasterRender`: caches one mesh per object id and drops meshes of removed objects; the highlight is drawn in the same pass so it no longer clears the scene. ### Consumers - `3DEditor` drives a `RasterRender` from the application `GpuDevice` and shows the path-traced frame through a Canvas RGBA image instead of a GL texture. - `Sketch3D` renders strokes with a geometry-shader pipeline on a shared `RenderTarget` and splits the renderer from the widgets so it can be tested headless. ## Verification - New headless GPU tests (`TestRasterRender`, `TestSketch3D`) render and read back pixels: depth shading, row orientation vs `Camera::project`, highlight, resize, mesh release, and stroke redraw. - Build failure set is unchanged from master (the 5 pre-existing Widgets `SpringRect` errors). - `TestRasterRender`, `TestSketch3D`, `TestRayTracer`, `TestGraphicApplication` pass with Vulkan validation on. - The 6 failing ctest cases (Threading, LinearRingBuffer) are pre-existing on master. ## Not verified - The `3DEditorApp`/`Sketch3DApp` executables still cannot link because `Widgets` does not build on master (`SpringRect`); only their objects are compiled here. - On-device Android rendering.
agent added 3 commits 2026-10-29 12:39:36 +03:00
- TrigCache::castRay returns std::optional<halnf> for the hit distance instead
  of writing a static hit position through static scratch variables, so ray
  casts are reentrant.
- TopologyCache::update takes its source Topology instead of holding a pointer
  that dangled whenever a Buffer moved the objects it referred to.
3DScene:
- Scene::castRay is const and returns std::optional<RayHit>; RayTracer reuses it
  instead of its own copy of the loop.
- Scene::loadLua throws SceneLoadError with the failing field; Lua stack values
  are popped by scope guards and the state is closed on every path.
- Objects get a stable id and are added through addObject/findObject.

RasterRender:
- Replaces the OpenGL renderer with a Vulkan one on GpuDevice.
- RenderTarget: offscreen color/depth images with optional MSAA, registered in
  the device RenderTargetRegistry for Canvas sampling, plus a pixel readback.
- GpuBuffer and GraphicsPipeline: reusable host-visible buffers and a
  pipeline builder shared by the scene and sketch renderers.
- The scene holds no GPU state; RasterRender caches one mesh per object id and
  drops meshes of removed objects. The highlight is drawn in the same pass so
  it no longer clears the scene.
- Tests render headless and read back pixels to verify depth shading, row
  orientation against Camera::project, the highlight, resize and mesh release.
3DEditor, Sketch3D: render through RasterRender
Some checks are pending
Windows / build (pull_request) Waiting to run
CMake on a single platform / build (pull_request) Waiting to run
CMake / build (pull_request) Waiting to run
f0283e054f
- The editor drives a RasterRender from the application GpuDevice and shows the
  path-traced frame through a Canvas RGBA image instead of a GL texture.
- Sketch3D renders strokes with a geometry-shader pipeline on a shared
  RenderTarget, caching one vertex buffer per stroke version, and splits the
  renderer from the widgets so it can be tested headless.
- Both apps pass a device to the widget that renders into the Canvas.
ilusha approved these changes 2026-10-29 12:42:21 +03:00
ilusha merged commit ae440a3c49 into master 2026-10-29 12:42:29 +03:00
ilusha deleted branch 3DScene-RasterRender 2026-10-29 12:42:29 +03:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: ilusha/Modules#10
No description provided.