Refactor/path tracer modules - #1
Merged
Merged
Conversation
Remove the external Luisa source override, document the single-source build contract, and record the active handoff checkpoint before recovering the unpublished sampling work.
Document the recovered CMake toolchain, clean dependency-free build, and 4/4 core CTest result before sampling reconstruction.
Reproduce Blender 4.5.10's 256-pattern tabulated-Sobol generator, pixel hashing, sample shuffling, and fixed path dimensions in a standalone sampling module. Lock the complete IEEE-754 table fingerprint and representative path fixtures; clean core CTest is 5/5.
Stage the Luisa-native tabulated-Sobol lowering and AST instantiation without claiming a passing device gate. Document the Ubuntu 24.04 / LLVM 22.1.8 / Embree 4.3.0 fallback environment, headless Luisa configuration, exact unverified boundary, and next-thread recovery steps.
There was a problem hiding this comment.
Pull request overview
This pull request refactors the Luisa path tracer into modular translation units, introduces a host/device tabulated-Sobol sampling implementation aligned with Blender 4.5.10 Cycles, tightens the Luisa fallback build configuration, and expands validation with focused Sobol and fallback-device tests.
Changes:
- Added a new
psycles::sampling::tabulated_sobolmodule (header + core implementation) plus a deterministic fixture test. - Added Luisa-side Cycles Sobol lowering (
include/psycles/luisa/cycles_sampler.h) and a fallback-device bit-exact validation test, and extended the Luisa compile test to instantiate the sampler kernel. - Refactored the Luisa path tracer into multiple private translation units and updated the CMake build + docs to enforce/describe the stricter fallback backend requirements.
Reviewed changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
CMakeLists.txt |
Removes external Luisa source override, enforces fallback target existence when requested, disables Luisa GUI, wires new modules/tests, and splits path tracer sources into multiple TUs. |
BUILD.md |
Updates build prerequisites and validation baseline for the fallback backend; documents new module layout and stricter fallback expectations. |
DEVELOP.md |
Updates development checkpoint narrative to reflect Sobol integration, module split, and validation gates. |
HANDOFF.md |
Adds a detailed handoff snapshot describing verified checkpoints, pins, and follow-up work. |
README.md |
Updates guidance to reflect relying on the pinned LuisaCompute submodule rather than an external override. |
include/psycles/contract/render.h |
Extends SampleRange with total to represent whole-render AA sample count for stable sampling state across progressive chunks. |
include/psycles/sampling/tabulated_sobol.h |
Introduces public host-side tabulated-Sobol API/constants and sampling helpers. |
src/sampling/tabulated_sobol.cpp |
Implements Cycles-derived tabulated-Sobol table generation + hashing/scrambling utilities. |
tests/test_tabulated_sobol.cpp |
Adds a deterministic host-side fixture test (fingerprint + specific row/bit fixtures). |
include/psycles/luisa/cycles_sampler.h |
Adds Luisa DSL lowering of Cycles’ tabulated-Sobol sampling utilities for device execution. |
tests/test_luisa_sobol_fallback.cpp |
Adds fallback-device bit-exact fixture test for Sobol sampling (device-side bitcasts + metadata checks). |
tests/test_luisa_compile.cpp |
Extends the Luisa AST compile test to also instantiate a Sobol sampler kernel. |
examples/render_luisa_demo.cpp |
Updates render invocation to populate SampleRange.total. |
examples/render_blender_scene.cpp |
Updates render invocation to populate SampleRange.total. |
src/luisa/path_tracer_internal.h |
Introduces shared private declarations/types/aliases used across the new path-tracer modules. |
src/luisa/path_tracer_types.h |
Adds LUISA_STRUCT-backed ABI structs for host/device interop used by the modularized kernel. |
src/luisa/path_tracer_common.cpp |
Implements shared helpers: packing/unpacking calls, conversions, pass helpers, and diagnostics. |
src/luisa/path_tracer_sampling.h / src/luisa/path_tracer_sampling.cpp |
Adds pixel-filter sampling callables (box/gaussian/blackman-harris). |
src/luisa/path_tracer_lighting.h / src/luisa/path_tracer_lighting.cpp |
Adds lighting/MIS helpers and emissive-triangle PDF callable construction. |
src/luisa/path_tracer_surfaces.h / src/luisa/path_tracer_surfaces.cpp |
Adds strongly-typed surface callable signatures and construction. |
src/luisa/path_tracer_shader_services.h |
Adds buffer-backed ShaderServices implementation for device-side shading queries. |
src/luisa/path_tracer_geometry.h / src/luisa/path_tracer_geometry.cpp |
Adds transparent shadow traversal callable and material/geometry fetch logic. |
src/luisa/path_tracer_environment.h / src/luisa/path_tracer_environment.cpp |
Adds environment/world evaluation callables, including Nishita and environment sun paths. |
src/luisa/path_tracer_scene.cpp |
Adds scene/material/geometry/light compilation and GPU resource upload for the modular path tracer. |
src/luisa/path_tracer_session.cpp |
Adds render-session logic for Sobol upload, progressive validation, dispatch, and pass readback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+11
| #include "path_tracer_internal.h" | ||
| #include "path_tracer_shader_services.h" | ||
|
|
||
| #include <psycles/compiler/core_nodes.h> | ||
| #include <psycles/luisa/cycles_bsdf_tables.h> | ||
| #include <psycles/luisa/cycles_nishita.h> | ||
|
|
||
| #include "cycles_shader_tables_4_5_10.inl" | ||
|
|
||
| #include <stb/stb_image.h> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request significantly updates the build and validation documentation, improves the CMake build system for reliability and reproducibility, and splits the path tracer implementation into modular translation units. The changes clarify the fallback backend requirements, enforce stricter validation, and add new focused tests for Sobol sampling and the fallback backend.
Documentation and Validation Improvements:
BUILD.mdto clarify the required versions and installation steps for LLVM, Embree, X11, and libuuid for the fallback backend, and to specify the exact LuisaCompute commit pinned (next@f42f3c6e). The fallback validation baseline is now Ubuntu 24.04 LTS with LLVM 22.1.8 and Embree 4.3.0. [1] [2]Build System and Fallback Backend:
PSYCLES_LUISA_SOURCE_DIRoverride, now always preferring the submodule or FetchContent. ThePSYCLES_FETCH_LUISA_NEXToption is now used only if the submodule is unavailable. [1] [2] [3]Path Tracer Refactoring:
src/luisa/path_tracer.cppinto multiple translation units (path_tracer_common.cpp,path_tracer_sampling.cpp, etc.) for better maintainability and modularity. [1] [2]Testing Enhancements:
psycles_tabulated_sobol_tests) and fallback backend validation (psycles_luisa_sobol_fallback_tests). These are now part of the validation gates and are registered as CTest targets. [1] [2]Core Library Updates:
src/sampling/tabulated_sobol.cppto the core library build.These changes collectively improve build reproducibility, validation rigor, and code maintainability.