Skip to content

Conversation

@3dJan
Copy link
Owner

@3dJan 3dJan commented Oct 22, 2025

This pull request introduces several improvements across the build system, continuous integration, desktop integration, and the BeamLatticeResource implementation. The most significant changes include the addition of CodeQL static analysis to CI, improved Linux desktop integration (including icon and launcher support), and a refactor of the beam lattice acceleration structure configuration for clarity and extensibility.

Key changes:

Continuous Integration and Quality

  • Added a new CodeQL workflow (.github/workflows/codeql.yml) to perform static analysis on C/C++ code for security and code quality, with a configuration file to exclude third-party and build artifact directories (.github/codeql/codeql-config.yml). [1] [2]
  • Introduced a new reviewer chat mode for code review automation, outlining best practices and review steps (.github/chatmodes/reviewer.chatmode.md).

Build System and Packaging

  • Updated the CMake build configuration to:
    • Bump the project version to 1.2.15 (gladius/CMakeLists.txt, gladius/CMakePresets.json). [1] [2]
    • Ensure the install target depends on all targets being built, preventing incomplete packaging (gladius/CMakeLists.txt).
    • Improve RPATH handling for UNIX: fixes issues with test executables finding shared libraries in the build tree and ensures proper library bundling and runtime paths. [1] [2]
    • Enhance the installer target to depend on all desktop variants and libraries.

Linux Desktop Integration

  • Added installation of a pre-generated PNG icon and a .desktop launcher file for Linux desktop environments, enabling proper application discovery and theming. [1] [2]
  • Improved launcher script generation for correct environment variable handling and library path setup.

BeamLatticeResource Refactor

  • Refactored the BeamLatticeResource class to use a new BeamLatticeAcceleration enum instead of a boolean for selecting between BVH and Voxel acceleration structures, improving clarity and extensibility (gladius/src/BeamLatticeResource.h, gladius/src/BeamLatticeResource.cpp). [1] [2] [3] [4] [5] [6]

Minor Improvements

  • Fixed minor initialization and normalization issues in CLMath.cpp for OpenCL vector types.
  • Made binary caching enabled by default and added a setter for a two-level pipeline in CLProgram.h. [1] [2]

These changes collectively improve the project's maintainability, developer experience, packaging robustness, and code quality.

3dJan and others added 30 commits July 9, 2025 14:02
…ongithub

Update version, improve test handling
Fix failing CI build: resolve workflow syntax errors and optimize caching
…notes

Update release notes for version 1.2.13
Fix CodeQL autobuild failure by adding manual build workflow
3dJan added 27 commits October 6, 2025 09:06
… enum for acceleration type and update related methods
…mpute spatial gradients using central finite differences and mirror referenced function inputs
- Introduced the FunctionGradient node to compute the normalized gradient of a referenced function.
- Implemented necessary methods for resolving function IDs, updating inputs and outputs, and validating configurations.
- Enhanced the Assembly and Model classes to accommodate FunctionGradient nodes.
- Updated the NodeFactory to create FunctionGradient instances.
- Added UI controls for FunctionGradient in NodeView, allowing users to select scalar outputs and vector inputs.
- Implemented visitor patterns for FunctionGradient in various visitors (ToCommandStreamVisitor, ToOCLVisitor, Visitor).
- Ensured proper integration with existing nodes and error handling for invalid configurations.
…p size control

Replace the combo widgets with button-driven popups for FunctionGradient scalar/vector selection to avoid dangling references in the node editor. Use ModelEditor->showPopupMenu to open per-node popups, capture data by-value, and apply selections by updating the node, setting m_parameterChanged, and marking the model as modified when available

Replace ImGui::SeparatorText with a plain header text for the gradient section

Add a Step Size DragFloat control that clamps negative values to zero, ensures the parameter is set modifiable, sets m_parameterChanged, and marks the model modified on change
…d avoid backup during async refresh

- ToOCLVisitor: add checks and early returns for missing/unused gradient output, null assembly, missing referenced model, wrong output type, unconsumed output, missing/invalid vector input and missing step size; emit a safe float3(0.0f) fallback (inlined or as local var) instead of throwing to make OCL generation resilient
- Writer3mf: detect functions containing FunctionGradient nodes and skip 3MF serialization while logging a warning to avoid NodeTypeMap/runtime errors; add TODO for future full serialization support
- Document: comment out saveBackup() call in refreshModelAsync to prevent backups being triggered during asynchronous model refresh
…, cache lowered functions, validate configurations, wire parameters and replace FunctionGradient nodes with FunctionCall; include parameter copying, consumer rewiring, name sanitization and error reporting
…ector to ignore non-gradient nodes during detection
…creating FunctionGradient nodes from FunctionCall and run lowering pass with error reporting

- Add functionCallControls to create a FunctionGradient from a FunctionCall (set function id, register inputs/outputs, copy parameter links or values, mark outputs used)
- Add "Create Function Gradient" button invocation in node content rendering
- Add "Lower Function Gradients" button and logic in functionGradientControls to run nodes::LowerFunctionGradient, collect/report errors, update assembly/model state and notify ModelEditor
- Add m_lowerGradientMessage and m_lowerGradientMessageIsError members for feedback display
- Add necessary include for nodes/LowerFunctionGradient and <exception>
- Wrap lowering/creation operations in try/catch and surface messages; set m_parameterChanged/m_modelChanged when modifications occur
…n UI, run lowering pass during assembly flattening, and fix mask wiring in lowering
…t lowering, reuse and error reporting; add ToOclVisitor fallback test to FunctionGradient_tests
…rough lowering and OCL emission

- Add FieldNames::Gradient and FieldNames::Magnitude constants
- Extend FunctionGradient type rule to include Gradient (float3) and Magnitude (float)
- Preserve and create Gradient and Magnitude output ports in FunctionGradient::updateInternalOutputs
- In LowerFunctionGradient, register Gradient and Magnitude inputs on synthesized end node and wire:
  - raw gradient -> mask -> Gradient input (Multiplication)
  - length -> mask -> Magnitude input (Multiplication)
- In ToOclVisitor, emit raw gradient and magnitude outputs (support inlining where possible or emit defined variables)
…xtension, lowering, and NormalizeDistanceField

Add comprehensive architecture and design documents to thegreatplan:
- gladius/thegreatplan/3mf-volumetric-implementation.md: describe 3MF volumetric & implicit namespaces, node graph model, pipeline, data types, and integration guidance
- gladius/thegreatplan/FunctionGradientExtension.md: document FunctionGradient extension (raw gradient and magnitude outputs), codegen/inlining behavior, masking/zero-gradient handling, and tests
- gladius/thegreatplan/FunctionGradientLowering.md: specify LowerFunctionGradient pass, function synthesis, caching, replacement algorithm, helpers, edge cases, and tests
- gladius/thegreatplan/NormalizeDistanceFieldNode.md: propose NormalizeDistanceField node, lowering approach using FunctionGradient.magnitude, API/UX, testing and rollout plan
- gladius/thegreatplan/more_ideas.md: add brief notes for mesh→beam-lattice importer and gradient node idea

Provide implementation notes, testing strategy, and rollout guidance to enable subsequent implementation and integration
…nt and magnitude outputs

Add assertions and new tests to verify FunctionGradient exposes Gradient and Magnitude outputs
and that ToOclVisitor emits gradient/magnitude-related variables when those outputs are used.
Update LowerFunctionGradient_tests to expect lowered functions to include Gradient and Magnitude
outputs so lowering and OCL emission behavior are validated
…I, and 3MF/OCL support

- Introduce NormalizeDistanceField node (DerivedNodes.h / DerivedNodes.cpp)
  - mirror referenced function inputs as arguments, provide FunctionId and StepSize params
  - add selection/validation helpers and getters/setters for configuration

- Implement LowerNormalizeDistanceField lowering pass (new LowerNormalizeDistanceField.{h,cpp})
  - find NormalizeDistanceField nodes, create helper functions that mirror referenced inputs
  - compose normalization by creating helper FunctionCall, FunctionGradient, Max (epsilon), and Division nodes
  - rewire consumers to normalized output, remove original NormalizeDistanceField node
  - add error reporting, sanitization, parameter copying and linking utilities

- Wire lowering into assembly flattening (Document.cpp)
  - run LowerNormalizeDistanceField after LowerFunctionGradient and before OptimizeOutputs

- UI: add creation and lowering controls in NodeView (NodeView.h / NodeView.cpp)
  - allow creating a NormalizeDistanceField from a FunctionCall and lowering selected nodes interactively
  - add status messaging for lowering results

- Visitor and OCL: add visitor hook and annotate ToOCL fallback output
  - add NormalizeDistanceField visit methods (Visitor.h / Visitor.cpp)
  - add nodesfwd entries and FieldNames for new params
  - annotate FunctionGradient fallback in ToOCLVisitor output for diagnostics

- 3MF: mark import/export behavior for unsupported nodes
  - add TODO comments in Importer3mf for NormalizeDistanceField/FunctionGradient import
  - update Writer3mf to detect and skip functions containing FunctionGradient or NormalizeDistanceField with a warning

- Misc: add helper declarations and plumbing to support new node and lowering
…g, UI, OCL and tests

- Importer3mf: map new 3MF node types (BeamLattice, FunctionGradient, NormalizeDistance) and allow dynamic inputs for FunctionCall/FunctionGradient/NormalizeDistance; initialize parameters (FunctionId/StepSize) and read selected scalar/vector names for implicit nodes
- Writer3mf: add serialization for FunctionGradient nodes (emit scalar/vector selection, function resource and step constant) and update unsupported-node detection to skip NormalizeDistanceField until serialization is implemented
- nodes/DerivedNodes: rename FunctionGradient vector output to NormalizedGradient and update type rules/ports and NormalizeDistanceField outputs to use Result per spec
- nodes/LowerFunctionGradient: wire normalized gradient output through lowering, register mirrored NormalizedGradient input and rewire consumers accordingly
- nodes/OptimizeOutputs & nodes/ToOCLVisitor: update consumers and inlining logic to reference NormalizedGradient
- nodes/nodesfwd: add FieldNames::NormalizedGradient and adjust StepSize identifier
- ui/NodeView: implement full NormalizeDistanceField configuration UI (select scalar output, select vector input, step size control, validation, and lowering button) with diagnostics and guarded lowering
- tests: add NormalizeDistanceField unit tests covering inputs/outputs, defaults, lowering behavior (helper function, FunctionGradient creation, Division node), category and description
- vcpkg overlay: update lib3mf REF and SHA to volumetric_beamlattice_gradient branch
- docs: remove obsolete 3mf-volumetric-implementation.md

Ensure consistency across nodes and lowering for normalized gradient handling and preserve backward compatibility where applicable
Update CPACK_PACKAGE_VERSION_PATCH in CMakeLists, installDir in CMakePresets.json, revision in src/version.h, and version-string in vcpkg.json
Copilot AI review requested due to automatic review settings October 22, 2025 08:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces comprehensive improvements spanning build infrastructure, CI/CD pipelines, desktop integration, and a significant refactor of the implicit modeling node system. The primary focus is on extending volumetric capabilities with new gradient computation features and distance field normalization.

Key changes:

  • Added CodeQL static analysis workflow for automated security and code quality scanning
  • Implemented Linux desktop integration (icons, launchers) and improved packaging robustness
  • Introduced FunctionGradient and NormalizeDistanceField nodes with graph-based lowering transformations
  • Extended test infrastructure with OpenCL availability detection and parameterized integration tests
  • Enhanced UI capabilities including function extraction, navigation history, and multi-monitor spanning support

Reviewed Changes

Copilot reviewed 93 out of 101 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
release_notes.md Updated release notes for version 1.2.13 with slice view improvements
gladius/vcpkg.json, gladius/src/version.h Version bump to 1.2.15
gladius/vcpkg-overlay-ports/lib3mflinux_/* Removed Linux-specific lib3mf overlay (now using unified version)
gladius/vcpkg-overlay-ports/lib3mf/portfile.cmake Updated lib3mf reference branch for volumetric beam lattice gradient support
gladius/thegreatplan/*.md Added implementation plans for gradient node, distance field normalization, and feature ideas
gladius/tests/unittests/opencl_test_helper.h New helper macro for skipping tests when OpenCL is unavailable
gladius/tests/unittests/*_tests.cpp Multiple test files updated with OpenCL availability checks and new test coverage
gladius/tests/integrationtests/testdata.h Updated test data file reference
gladius/tests/integrationtests/GladiusLib_tests.cpp Refactored to parameterized tests scanning all available 3MF files
gladius/tests/integrationtests/CMakeLists.txt Added CONFIGURE_DEPENDS to test file globbing
gladius/src/ui/*.cpp/h Extensive UI enhancements: function extraction dialog, navigation history, gradient/normalize controls
gladius/src/nodes/*.cpp/h Core node system extensions: FunctionGradient, NormalizeDistanceField, OutputPortReferenceAnalyzer, lowering transformations
gladius/src/compute/Rendering.cpp Fixed brace-enclosed initializer syntax
gladius/src/io/ImageStackExporter.cpp Fixed implicit narrowing conversion warning


inputData.resize(distmap.getData().size());
if (inputData.size() != m_columnCountWorld * m_rowCountWorld)
if (inputData.size() != static_cast<size_t>(m_columnCountWorld) * m_rowCountWorld)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit cast to size_t only applies to m_columnCountWorld. If m_rowCountWorld is also a signed type, the multiplication could still produce a signed result before comparison with size_t. Consider casting the entire multiplication: static_cast<size_t>(m_columnCountWorld) * static_cast<size_t>(m_rowCountWorld).

Suggested change
if (inputData.size() != static_cast<size_t>(m_columnCountWorld) * m_rowCountWorld)
if (inputData.size() != static_cast<size_t>(m_columnCountWorld) * static_cast<size_t>(m_rowCountWorld))

Copilot uses AI. Check for mistakes.
@3dJan 3dJan merged commit ed3e0f1 into develop Oct 22, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants