| Age | Commit message (Collapse) | Author |
|
Resolves critical shader composition and format mismatch issues, enabling the
circle mask + rotating cube demonstration at 2.0s-4.0s in the timeline.
**Key Fixes:**
1. **Shader Function Name** (masked_cube.wgsl):
- Fixed call to `ray_box_intersection()` (was incorrectly `ray_box()`)
- Updated return value handling to use `RayBounds` struct (`.hit`, `.t_entry`, `.t_exit`)
- Removed unused `sky_tex` binding to match pipeline layout expectations (5 bindings → 4)
2. **Shader Lifetime Issue** (rotating_cube_effect.h/cc):
- Added `std::string composed_shader_` member to persist shader source
- Prevents use-after-free when WebGPU asynchronously parses shader code
3. **Format Mismatch** (circle_mask_effect.cc):
- Changed compute pipeline format from hardcoded `RGBA8Unorm` to `ctx_.format` (Bgra8UnormSrgb)
- Matches auxiliary texture format created by `MainSequence::register_auxiliary_texture()`
- Added depth stencil state to render pipeline to match scene pass requirements:
* Format: Depth24Plus
* depthWriteEnabled: False (no depth writes needed)
* depthCompare: Always (always pass depth test)
4. **WebGPU Descriptor Initialization** (circle_mask_effect.cc):
- Added `depthSlice = WGPU_DEPTH_SLICE_UNDEFINED` for non-Windows builds
- Ensures proper initialization of render pass color attachments
5. **Test Coverage** (test_demo_effects.cc):
- Updated EXPECTED_SCENE_COUNT: 6 → 8 (added CircleMaskEffect, RotatingCubeEffect)
- Marked both effects as requiring 3D pipeline setup (skipped in basic tests)
**Technical Details:**
- **Auxiliary Texture Flow**: CircleMaskEffect generates mask (1.0 inside, 0.0 outside) →
RotatingCubeEffect samples mask to render only inside circle → GaussianBlurEffect post-processes
- **Pipeline Format Matching**: All pipelines targeting same render pass must use matching formats:
* Color: Bgra8UnormSrgb (system framebuffer format)
* Depth: Depth24Plus (scene pass depth buffer)
- **ShaderComposer Integration**: Relies on `InitShaderComposer()` (called in `gpu.cc:372`)
registering snippets: `common_uniforms`, `math/sdf_utils`, `ray_box`, etc.
**Effect Behavior:**
- Runs from 2.0s to 4.0s in demo timeline
- CircleMaskEffect (priority 0): Draws green outside circle, transparent inside
- RotatingCubeEffect (priority 1): Renders bump-mapped cube inside circle
- GaussianBlurEffect (priority 2): Post-process blur on entire composition
**Test Results:**
- All 33 tests pass (100%)
- No WebGPU validation errors
- Demo runs cleanly with `--seek 2.0`
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
|
|
Split src/gpu/demo_effects.cc into individual .cc files for each effect
and created separate files for post-processing helpers and WGSL shaders.
Updated src/gpu/demo_effects.h to be a central header for all effect-related
declarations and adjusted CMakeLists.txt accordingly.
|
|
|
|
|
|
- Enabled AllowShortFunctionsOnASingleLine: All
- Enabled AllowShortBlocksOnASingleLine: Always
- Enabled AllowShortIfStatementsOnASingleLine: Always
- Enabled AllowShortLoopsOnASingleLine: true
- Set MaxEmptyLinesToKeep: 1
- Applied formatting to all source files.
|
|
- Fixed 'Invalid sample count 0' and 'Invalid anisotropic clamp: 0' by ensuring explicit pipeline and sampler states.
- Resolved WGSL parsing errors by replacing swizzle assignments in compute shaders.
- Fixed 'Texture destroyed' error in render_frame by reordering command submission and resource presentation/release.
- Added WGPU_DEPTH_SLICE_UNDEFINED for Windows compatibility and ensured consistent resolveTarget initialization.
- Cleaned up PassthroughEffect bind group layout mismatch and redundant string helper definitions.
- Verified all tests pass and applied consistent formatting.
|
|
Fixes seq_compiler build for Windows cross-compilation. Moves common WebGPU compatibility shims to gpu.h. Applies project-wide coding style via clang-format. Verified on both macOS (native) and Windows (cross-compile).
|
|
Completes the multi-pass rendering engine and implements all requested effects: MovingEllipse, ParticleSpray, GaussianBlur, Solarize, Distort, and ChromaAberration. Includes WGSL shaders for all effects and logic for time-varying parameters via uniforms.
|
|
Implements a post-processing pipeline using offscreen framebuffers. Adds stubs for MovingEllipse, ParticleSpray, GaussianBlur, Solarize, Distort, and ChromaAberration effects. Updates MainSequence to orchestrate the scene pass and post-processing chain.
|
|
Adds a 'seq_compiler' tool that converts a text-based timeline (assets/demo.seq) into a generated C++ file. This allows editing effect sequences and timing without modifying engine code. Replaces manual sequence creation with a generated 'LoadTimeline' function.
|
|
Refactors the rendering pipeline into a modular Sequence/Effect system. 'MainSequence' manages the final frame rendering and a list of 'Sequence' layers. 'Sequence' manages a timeline of 'Effect' objects (start/end/priority). Concrete effects (Heptagon, Particles) are moved to 'demo_effects.cc'. Updates main loop to pass beat and aspect ratio.
|