Skip to content

feat: Added Metal binding allocator to supports multiple descriptor sets. - #10

Merged
ajeetsinghyadav merged 9 commits into
mainfrom
VNE_SHADERC_DESCRIPTOR_SET_FIXES
Jul 14, 2026
Merged

ajeetsinghyadav merged 9 commits into
mainfrom
VNE_SHADERC_DESCRIPTOR_SET_FIXES

Conversation

@ajeetsinghyadav

@ajeetsinghyadav ajeetsinghyadav commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

Description

Release notes: Use a Conventional Commits–style PR title (e.g. feat: add X, fix: resolve Y, docs: update Z) so release-please can include this change in the changelog. If you squash-merge, use the PR title as the commit message.

Checklist

  • Project builds (e.g. cmake -B build/static and cmake --build build/static, or platform script with -l static).
  • Tests pass (e.g. ctest --test-dir build/static or script -a test).
  • Code is formatted (e.g. run clang-format as configured for this repo); CI clang-format will check.
  • Docs updated if you changed behavior or public API.

Additional notes

Summary by CodeRabbit

  • New Features
    • Added deterministic, program-wide Metal resource binding allocation for consistent cross-stage shader bindings.
    • Added a toggle to switch between shared (program-wide) and stage-local Metal binding maps.
    • Improved shader cache invalidation when stages or Metal layout inputs change.
    • Preserved canonical Vulkan-style set/binding identity in WGSL pipeline reflection.
  • Bug Fixes
    • Improved Metal binding-limit overflow detection and reporting.
    • Updated release packaging/install flow for the vnesc artifact.
  • Documentation
    • Refreshed README and guidance text for consistent, ASCII-friendly formatting.
  • Tests
    • Added coverage for Metal binding allocation, cache keying, and overflow behavior.

- Added `metal_binding_allocator.h` and `metal_binding_allocator.cpp` to implement a new allocator that maps Vulkan `(set, binding)` pairs to Metal indices, addressing Metal's fixed resource limits.
- Updated `ShaderPipelineBuilder` to utilize the new allocator for program-wide resource management, ensuring consistent Metal index assignments across shader stages.
- Enhanced `ShaderArtifactCache` to include a fingerprint for the Metal binding map, improving cache key generation.
- Introduced unit tests in `metal_binding_allocator_test.cpp` to validate the allocator's functionality and overflow error reporting for Metal's resource limits.
- Refactored related components to support the new allocator, including updates to `spirvcross_cross_compiler` and `spirvcross_reflector` for seamless integration with Metal resource bindings.
- Removed decorative comment lines in CMake files for improved readability and consistency.
- Updated comments to be more concise and clear, enhancing the overall clarity of the build configuration.
- Adjusted formatting in various CMake files to maintain a uniform style across the project.
…cture

- Updated CMake files to include clearer and more structured comments, enhancing readability and maintainability.
- Consolidated and organized sections within CMakeLists.txt and related files for better clarity on project structure and dependencies.
- Improved formatting consistency across various CMake files, ensuring a uniform style throughout the project.
- Added detailed comments for build options, dependencies, and installation rules to facilitate easier understanding for future contributors.
… files

- Adjusted formatting in various configuration files, including CMake and GitHub workflows, to ensure consistent use of symbols (e.g., replacing `→` with `->`).
- Enhanced comments for better readability and understanding, particularly in CMake files and documentation.
- Improved the structure of the `.pre-commit-config.yaml` file for clarity on hook definitions.
- Updated README and documentation files to maintain uniformity in style and formatting across the project.
@ajeetsinghyadav ajeetsinghyadav self-assigned this Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6617db90-7434-4c62-ae7d-b28ecd297300

📥 Commits

Reviewing files that changed from the base of the PR and between 8a8127a and d00ba27.

📒 Files selected for processing (2)
  • .github/copilot-instructions.md
  • tests/shader_pipeline_builder_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/shader_pipeline_builder_test.cpp

📝 Walkthrough

Walkthrough

This PR adds deterministic program-wide Metal binding allocation, integrates it with shader reflection, MSL cross-compilation, cache fingerprints, and pipeline builds, and adds tests for allocator limits, cache invalidation, cross-stage Metal consistency, and WGSL reflection. It also updates build configuration, release packaging, documentation, and repository metadata.

Changes

Metal binding pipeline

Layer / File(s) Summary
Allocator contract and public integration
include/vertexnova/sc/metal_binding_allocator.h, include/vertexnova/sc/sc_types.h, include/vertexnova/sc/shader_reflector.h, include/vertexnova/sc/shader_pipeline_builder.h
Adds deterministic Metal resource allocation APIs, program-wide allocator plumbing, cache fingerprint inputs, and a dense-map pipeline switch.
Allocator implementation and MSL remapping
src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp, src/vertexnova/sc/reflector/spirvcross_reflector.cpp, src/vertexnova/sc/crosscompiler/spirvcross_cross_compiler.cpp
Reflects resource keys, assigns stable indices, validates Metal limits, fingerprints layouts, and applies allocator-generated MSL bindings.
Cache-aware pipeline execution
src/vertexnova/sc/shader_artifact_cache.cpp, src/vertexnova/sc/shader_pipeline_builder.cpp
Adds source-level program fingerprints to Metal cache keys and separates cache lookup from reflection and backend compilation so missed stages can share one allocator.
Validation coverage
tests/metal_binding_allocator_test.cpp, tests/shader_artifact_cache_test.cpp, tests/shader_pipeline_builder_test.cpp
Tests deterministic allocation, overflow reporting, fingerprint-sensitive keys, cache-hit reuse, cross-stage Metal slots, and WGSL binding identity.

Build and repository updates

Layer / File(s) Summary
Build, dependency, and release configuration
.github/workflows/*, CMakeLists.txt, cmake/*, src/CMakeLists.txt, tests/CMakeLists.txt, tools/shader_compiler_cli/CMakeLists.txt
Updates VNE_SC CMake flags, dependency override handling, installation components, release packaging, and test registration.
Documentation and repository presentation
README.md, docs/*, examples/*, scripts/*, tools/*, .github/*, CHANGELOG.md
Normalizes punctuation, section formatting, metadata headers, and repository guidance.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding a Metal binding allocator to support multiple descriptor sets.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch VNE_SHADERC_DESCRIPTOR_SET_FIXES

Comment @coderabbitai help to get the list of available commands.

- Replaced `VNE_TEMPLATE_CI` and `VNE_TEMPLATE_LIB_TYPE` with `VNE_SC_CI` in GitHub workflows to align with the new vnesc naming conventions.
- Adjusted CMake installation rules to focus on the `vnesc` target, removing unnecessary interface targets and ensuring only relevant binaries are installed.
- Enhanced comments in workflow files for better clarity on build configurations and installation processes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/vertexnova/sc/shader_pipeline_builder.cpp (1)

66-165: 🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Metal fingerprint requirement forces compile+validate to always run before cache lookup, defeating the point of the artifact cache.

Because metal_fingerprint (used in the cache key at Line 154) can only be computed once every stage's SPIR-V exists, Phase A now unconditionally calls front_end_->compile() and validator_->validate() for all stages before Phase B's cache->lookup() ever runs — even for a full cache hit. Previously (per the PR's own description) each stage did a cache lookup before compiling. CacheHitSkipsRecompilation still passes because it only compares resulting SPIR-V, not whether recompilation actually happened, so this regression isn't caught by tests.

Consider decoupling the cache key from data that requires compiling first (e.g., a lightweight pre-key from req.source/macros, with the Metal fingerprint folded in only for a post-hoc integrity check), or accept the trade-off explicitly and document/test it, since as written the cache no longer saves front-end compile/validate cost for MSL builds.

Secondary, lower-priority nits in this same block:

  • StageWork::from_cache (Line 72) is set nowhere and read nowhere — dead field.
  • The comment at Line 161 ("Keep freshly compiled SPIR-V if cache somehow lacked it...") doesn't match the code below it, which just moves the cached artifact wholesale.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/vertexnova/sc/shader_pipeline_builder.cpp` around lines 66 - 165, The
cache key currently depends on metal_fingerprint, forcing compile and validation
before cache lookup and eliminating cache savings for MSL builds; redesign the
lookup flow so cache hits can be identified without compiling every stage first,
or explicitly preserve and document this trade-off with regression coverage.
While updating this block, remove the unused StageWork::from_cache field and
revise the cache-hit comment to accurately describe moving the cached artifact
wholesale.
.github/workflows/codeql.yml (1)

45-79: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Broken YAML: steps: list items lost one space of indentation.

Every - name:/- uses: marker in this block sits at 5 spaces while its nested keys (run:, with:, uses:) sit at 8 spaces. That requires the dash at 6 spaces (so name/uses line up with the nested keys' column), not 5. This breaks YAML parsing — actionlint and YAMLlint both report a syntax error at line 46 ("mapping values are not allowed in this context"), and the same misalignment repeats at every step in this job (lines 49, 56, 61, 67, 76), so the entire analyze job is unparsable and this workflow will fail to run.

🐛 Proposed fix: restore the missing space before each step marker
     steps:
-     - name: Use HTTPS for GitHub (CI runners have no SSH key)
+      - name: Use HTTPS for GitHub (CI runners have no SSH key)
        run: git config --global url."https://github.com/".insteadOf "git@github.com:"

       # vnecmake via submodule; Khronos/gtest via FetchContent at cmake configure.
-     - uses: actions/checkout@v4
+      - uses: actions/checkout@v4
        with:
          submodules: recursive

       # No build cache: CodeQL must trace a full build. Restoring a cached build
       # would let cmake --build skip most compilations, so CodeQL would miss
       # compilation units and analysis would be incomplete.
-     - name: Install build dependencies
+      - name: Install build dependencies
        run: |
          sudo apt-get update -qq
          sudo apt-get install -y build-essential cmake

-     - name: Initialize CodeQL
+      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: cpp
          queries: security-extended

-     - name: Build (traced by CodeQL)
+      - name: Build (traced by CodeQL)
        run: |
          cmake -B build/static -S . \
            ...

-     - name: Perform CodeQL Analysis
+      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3
        with:
          category: "/language:cpp"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/codeql.yml around lines 45 - 79, Fix the indentation of
every step marker in the CodeQL workflow job by adding one leading space before
each “- name:” and “- uses:” entry, including the checkout, dependency
installation, initialization, build, and analysis steps. Keep each step’s nested
run, with, and uses keys aligned beneath its marker so the steps list parses as
valid YAML.

Source: Linters/SAST tools

🧹 Nitpick comments (4)
src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp (1)

122-171: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate resource-collection logic between the single-compiler constructor and fromProgram.

Lines 126-141 and 160-166 repeat the same six collect() calls (uniform/storage buffers, sampled/separate/storage images, separate samplers). If a new SPIR-V resource category is added later, it's easy to update one site and forget the other, silently breaking one of the two allocation paths.

♻️ Proposed fix: extract a shared collection helper
+void collectAll(const spirv_cross::Compiler& compiler,
+                std::vector<Key>& buffers,
+                std::vector<Key>& textures,
+                std::vector<Key>& combined,
+                std::vector<Key>& separate) {
+    const spirv_cross::ShaderResources res = compiler.get_shader_resources();
+    collect(compiler, res.uniform_buffers, buffers);
+    collect(compiler, res.storage_buffers, buffers);
+    collect(compiler, res.sampled_images, textures);
+    collect(compiler, res.separate_images, textures);
+    collect(compiler, res.storage_images, textures);
+    collect(compiler, res.sampled_images, combined);
+    collect(compiler, res.separate_samplers, separate);
+}

Then call collectAll(compiler, buffers, textures, combined, separate); from both the constructor and the fromProgram loop body.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp` around lines 122
- 171, Extract the repeated resource collection calls into a shared collectAll
helper accepting a compiler and the buffers, textures, combined, and separate
vectors. Replace both the constructor’s six collect calls and the equivalent
calls inside fromProgram’s loop with collectAll, preserving the existing
resource-category mappings.
tests/metal_binding_allocator_test.cpp (1)

72-86: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Overflow test only covers pure separate-sampler overflow, not the mixed combined+separate path.

This test only creates separate_samplers (no combined image-samplers), so it can't catch the highest(sampler_index_) ordering bug flagged in metal_binding_allocator.cpp (see that file's review). Consider adding a case that mixes combined image-samplers with separate samplers to exercise that path once the underlying allocator issue is fixed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/metal_binding_allocator_test.cpp` around lines 72 - 86, Extend
MetalBindingAllocatorTest.OverflowReportsSamplerLimit to include both combined
image-samplers and separate samplers in the same shader, exercising
sampler-index ordering through MetalBindingAllocator::fromProgram and
overflowError. Preserve the existing assertion that overflowError reports a
non-empty message containing “sampler,” while ensuring the mixed bindings exceed
the sampler limit.
include/vertexnova/sc/sc_types.h (1)

145-161: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add migration guidance for the new borrowed field.

CrossCompileRequest::metal_program_map changes a public aggregate and carries a raw pointer valid only during ShaderPipelineBuilder::build(). Add a migration note explaining the lifetime restriction and that copied requests must not be retained or used asynchronously with this pointer.

Based on learnings, public API and core behavior changes should include rationale and migration notes in the PR description.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@include/vertexnova/sc/sc_types.h` around lines 145 - 161, Add migration
documentation for CrossCompileRequest::metal_program_map, stating that it is a
non-owning pointer valid only during ShaderPipelineBuilder::build(). Explicitly
instruct callers not to retain, copy for later use, or process requests
asynchronously while this pointer is set, and include the rationale for the
public aggregate/API change in the project’s appropriate migration or PR
documentation.

Source: Learnings

include/vertexnova/sc/metal_binding_allocator.h (1)

79-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document missing-key behavior for buffer()/texture()/sampler().

Unlike overflowError()/fingerprint(), these accessors have no doc comment describing what happens when (set, binding) isn't in the map (throw? assert? sentinel value?). Since these are called per-resource by the cross-compiler/reflector, an undocumented contract here risks silent mis-binding if a caller passes an unassigned key.

📝 Proposed doc addition
+    /// `@returns` the Metal `[[buffer]]` index for `(set, binding)`.
+    /// `@pre` `(set, binding)` must be a key produced during construction; behavior for
+    ///      an unknown key is <describe: throws / asserts / returns sentinel>.
     [[nodiscard]] std::uint32_t buffer(std::uint32_t set, std::uint32_t binding) const;
+    /// `@returns` the Metal `[[texture]]` index for `(set, binding)`. Same precondition as `@ref` buffer.
     [[nodiscard]] std::uint32_t texture(std::uint32_t set, std::uint32_t binding) const;
+    /// `@returns` the Metal `[[sampler]]` index for `(set, binding)`. Same precondition as `@ref` buffer.
     [[nodiscard]] std::uint32_t sampler(std::uint32_t set, std::uint32_t binding) const;

As per coding guidelines, "Use names that reveal intent, keep functions small, and add brief documentation comments to public APIs when behavior is not obvious."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@include/vertexnova/sc/metal_binding_allocator.h` around lines 79 - 81,
Document the missing-key behavior for the public accessors buffer(), texture(),
and sampler() in metal_binding_allocator.h, explicitly stating whether each
throws, asserts, or returns a sentinel when (set, binding) is absent. Keep the
documentation brief and consistent with the existing overflowError() and
fingerprint() API comments.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/copilot-instructions.md:
- Around line 9-11: Update the BLOCKER, MAJOR, and MINOR list items in the
surrounding instruction list to use consistent two-space indentation, preserving
their nested-list structure and resolving the markdownlint MD005 violation.

In @.github/workflows/build-reusable.yml:
- Around line 78-79: Correct the indentation of the workflow step sequence in
the build workflow: align the “Use HTTPS for GitHub” step marker and all later
“- name” and “- uses” entries with the surrounding steps: sequence. Preserve
each step’s existing commands and configuration.

In @.github/workflows/ci.yml:
- Around line 55-59: Fix YAML sequence indentation across all affected sites: in
.github/workflows/ci.yml at lines 55-59, 109-122, 134-146, 176-177, 289-299,
309-313, 326-331, and 359-360, align every - name: and - uses: marker with its
nested mapping keys; in .pre-commit-config.yaml at lines 6-13, align - repo:
local, hooks:, and - id: clang-format with their child keys; and in
.github/workflows/release-please.yml at lines 48-58, 95-106, and 108-155, align
matrix entries and publish steps consistently. Preserve each existing key and
value while restoring valid sibling indentation.

In @.github/workflows/delete-merged-branch.yml:
- Around line 32-33: Correct the YAML indentation of the “Delete branch” step so
its “- name” entry aligns with the workflow’s other steps and its nested env
block remains properly scoped. Preserve the existing step configuration and
commands.

In `@cmake/Dependencies.cmake`:
- Around line 37-46: Update _vne_sc_apply_override to clear the corresponding
FETCHCONTENT_SOURCE_DIR_<DEP> cache entry when _cache_var is unset, empty, or
points to a directory without CMakeLists.txt. Preserve the existing forced cache
assignment and status message for valid local overrides, and ensure invalid or
removed paths cannot retain stale FetchContent locations.

In `@src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp`:
- Around line 61-66: Update lookup() to report a missing Key{set, binding}
instead of returning 0U. Preserve the existing value for found entries, and use
the surrounding allocator’s established assertion or error-reporting mechanism
so mismatched compiler and allocation inputs fail visibly rather than aliasing
index 0.
- Around line 68-70: Update highest() to compute and return the maximum mapped
value by iterating over all entries, rather than returning the value at
m.rbegin(). Preserve the existing 0U result for an empty map, and ensure
overflowError() receives the true highest index for sampler_index_ and other
maps.

In `@src/vertexnova/sc/reflector/spirvcross_reflector.cpp`:
- Around line 110-123: Update the catch-all branch in the reflected resource
mapping around ReflectedResourceType so texture-only resources such as
eSampledImage and eStorageImage assign only metal.texture; remove the
metal.sampler assignment while preserving sampler mapping for eSampler and
eCombinedImageSampler.

In `@src/vertexnova/sc/shader_artifact_cache.cpp`:
- Around line 160-163: The public ShaderArtifactCache::makeKey API removed the
existing three-argument symbol, breaking ABI compatibility for previously built
shared-library clients. Restore a three-argument overload that forwards to the
four-argument makeKey with the appropriate default fingerprint, or explicitly
document the ABI break in the release notes if removal is intentional.

---

Outside diff comments:
In @.github/workflows/codeql.yml:
- Around line 45-79: Fix the indentation of every step marker in the CodeQL
workflow job by adding one leading space before each “- name:” and “- uses:”
entry, including the checkout, dependency installation, initialization, build,
and analysis steps. Keep each step’s nested run, with, and uses keys aligned
beneath its marker so the steps list parses as valid YAML.

In `@src/vertexnova/sc/shader_pipeline_builder.cpp`:
- Around line 66-165: The cache key currently depends on metal_fingerprint,
forcing compile and validation before cache lookup and eliminating cache savings
for MSL builds; redesign the lookup flow so cache hits can be identified without
compiling every stage first, or explicitly preserve and document this trade-off
with regression coverage. While updating this block, remove the unused
StageWork::from_cache field and revise the cache-hit comment to accurately
describe moving the cached artifact wholesale.

---

Nitpick comments:
In `@include/vertexnova/sc/metal_binding_allocator.h`:
- Around line 79-81: Document the missing-key behavior for the public accessors
buffer(), texture(), and sampler() in metal_binding_allocator.h, explicitly
stating whether each throws, asserts, or returns a sentinel when (set, binding)
is absent. Keep the documentation brief and consistent with the existing
overflowError() and fingerprint() API comments.

In `@include/vertexnova/sc/sc_types.h`:
- Around line 145-161: Add migration documentation for
CrossCompileRequest::metal_program_map, stating that it is a non-owning pointer
valid only during ShaderPipelineBuilder::build(). Explicitly instruct callers
not to retain, copy for later use, or process requests asynchronously while this
pointer is set, and include the rationale for the public aggregate/API change in
the project’s appropriate migration or PR documentation.

In `@src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp`:
- Around line 122-171: Extract the repeated resource collection calls into a
shared collectAll helper accepting a compiler and the buffers, textures,
combined, and separate vectors. Replace both the constructor’s six collect calls
and the equivalent calls inside fromProgram’s loop with collectAll, preserving
the existing resource-category mappings.

In `@tests/metal_binding_allocator_test.cpp`:
- Around line 72-86: Extend
MetalBindingAllocatorTest.OverflowReportsSamplerLimit to include both combined
image-samplers and separate samplers in the same shader, exercising
sampler-index ordering through MetalBindingAllocator::fromProgram and
overflowError. Preserve the existing assertion that overflowError reports a
non-empty message containing “sampler,” while ensuring the mixed bindings exceed
the sampler limit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 25c52242-5b97-4687-a30d-2f219f693a3e

📥 Commits

Reviewing files that changed from the base of the PR and between 100cbd3 and 8f5359e.

📒 Files selected for processing (74)
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/copilot-instructions.md
  • .github/workflows/build-reusable.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/delete-merged-branch.yml
  • .github/workflows/release-please.yml
  • .pre-commit-config.yaml
  • CHANGELOG.md
  • CMakeLists.txt
  • README.md
  • cmake/CompilerOptions.cmake
  • cmake/Dependencies.cmake
  • cmake/InstallRules.cmake
  • cmake/VnescShaders.cmake
  • docs/vertexnova/sc/offline_pipeline.md
  • docs/vertexnova/sc/separate_samplers.md
  • docs/vertexnova/template/diagrams/README.md
  • examples/CMakeLists.txt
  • examples/README.md
  • examples/common/logging_guard.h
  • examples/glsl/01_hello_compiler/CMakeLists.txt
  • examples/glsl/02_triangle_bundle/CMakeLists.txt
  • examples/glsl/03_textured_pipeline_spec/CMakeLists.txt
  • examples/glsl/CMakeLists.txt
  • include/vertexnova/sc/metal_binding_allocator.h
  • include/vertexnova/sc/sc_result.h
  • include/vertexnova/sc/sc_types.h
  • include/vertexnova/sc/shader_artifact_cache.h
  • include/vertexnova/sc/shader_bundle.h
  • include/vertexnova/sc/shader_compiler_factory.h
  • include/vertexnova/sc/shader_cross_compiler.h
  • include/vertexnova/sc/shader_pipeline_builder.h
  • include/vertexnova/sc/shader_pipeline_spec.h
  • include/vertexnova/sc/shader_reflector.h
  • include/vertexnova/sc/shader_validator.h
  • include/vertexnova/sc/vnesc.h
  • scripts/README.md
  • scripts/build_linux.sh
  • scripts/clang_formatter.py
  • scripts/generate-docs.sh
  • src/CMakeLists.txt
  • src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
  • src/vertexnova/sc/crosscompiler/spirvcross_cross_compiler.cpp
  • src/vertexnova/sc/crosscompiler/spirvcross_cross_compiler.h
  • src/vertexnova/sc/crosscompiler/tint_cross_compiler.h
  • src/vertexnova/sc/frontend/dxc_frontend.h
  • src/vertexnova/sc/frontend/glslang_frontend.cpp
  • src/vertexnova/sc/frontend/glslang_frontend.h
  • src/vertexnova/sc/frontend/slang_frontend.h
  • src/vertexnova/sc/gpu_layout_tools.cpp
  • src/vertexnova/sc/reflector/spirvcross_reflector.cpp
  • src/vertexnova/sc/reflector/spirvcross_reflector.h
  • src/vertexnova/sc/shader_artifact_cache.cpp
  • src/vertexnova/sc/shader_bundle.cpp
  • src/vertexnova/sc/shader_pipeline_builder.cpp
  • src/vertexnova/sc/shader_reflection_binary.cpp
  • src/vertexnova/sc/validator/noop_validator.cpp
  • src/vertexnova/sc/validator/noop_validator.h
  • tests/CMakeLists.txt
  • tests/fixtures/glslang_frontend_test_fixture.h
  • tests/fixtures/shader_pipeline_builder_test_fixture.h
  • tests/fixtures/shader_sources_fixture.h
  • tests/metal_binding_allocator_test.cpp
  • tests/shader_artifact_cache_test.cpp
  • tests/shader_cross_compiler_test.cpp
  • tests/shader_pipeline_builder_test.cpp
  • tests/shader_pipeline_spec_includes_test.cpp
  • tools/README.md
  • tools/compile_shaders.py
  • tools/download_naga.py
  • tools/shader_compiler_cli/CMakeLists.txt
  • tools/shader_compiler_cli/main.cpp

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/workflows/build-reusable.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/delete-merged-branch.yml Outdated
Comment thread cmake/Dependencies.cmake
Comment thread src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
Comment thread src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
Comment thread src/vertexnova/sc/reflector/spirvcross_reflector.cpp
Comment on lines +160 to +163
std::string ShaderArtifactCache::makeKey(const CompileRequest& req,
const std::vector<CrossTarget>& targets,
const MetalBindingLayout& metal_layout) {
const MetalBindingLayout& metal_layout,
std::uint64_t metal_program_fingerprint) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== candidate files =='
git ls-files | rg '(^|/)shader_artifact_cache\.(h|hpp|cpp|cc|cxx)$|(^|/)ABI|(^|/)version|(^|/)release|(^|/)docs|README'

echo
echo '== locate makeKey =='
rg -n "makeKey\\(" src include . -g '!**/build/**' -g '!**/dist/**'

echo
echo '== inspect shader_artifact_cache files =='
for f in src/vertexnova/sc/shader_artifact_cache.cpp src/vertexnova/sc/shader_artifact_cache.h src/vertexnova/sc/shader_artifact_cache.hpp; do
  if [[ -f "$f" ]]; then
    echo "--- $f (lines around makeKey) ---"
    rg -n -C 4 "makeKey\\(" "$f" || true
  fi
done

echo
echo '== search ABI policy mentions =='
rg -n "ABI|binary compat|backward compat|breaking release|mangled|symbol" . -g '!**/build/**' -g '!**/dist/**' -g '!**/.git/**' | head -n 200

Repository: vertexnova/vneshaderc

Length of output: 35632


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo 'hello'

Repository: vertexnova/vneshaderc

Length of output: 165


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,180p' include/vertexnova/sc/shader_artifact_cache.h
echo
sed -n '140,220p' src/vertexnova/sc/shader_artifact_cache.cpp
echo
sed -n '1,140p' docs/vertexnova/template/template.md

Repository: vertexnova/vneshaderc

Length of output: 8879


Preserve the 3-arg symbol or call out the ABI break. This public header now exposes only the 4-arg makeKey, so binaries built against the old overload will stop linking in shared-library builds. Add a 3-arg forwarding overload or document the breaking change in the release notes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/vertexnova/sc/shader_artifact_cache.cpp` around lines 160 - 163, The
public ShaderArtifactCache::makeKey API removed the existing three-argument
symbol, breaking ABI compatibility for previously built shared-library clients.
Restore a three-argument overload that forwards to the four-argument makeKey
with the appropriate default fingerprint, or explicitly document the ABI break
in the release notes if removal is intentional.

Source: Learnings

…gram fingerprinting

- Introduced a new method `makeProgramFingerprint` in `ShaderArtifactCache` to generate a deterministic fingerprint based on compile inputs, improving cache key generation for Metal dense program maps.
- Updated `ShaderPipelineBuilder` to utilize the new fingerprinting method, allowing cache lookups to occur before compilation, thus optimizing the shader pipeline process.
- Enhanced comments and documentation for clarity on the fingerprinting mechanism and its implications for cache management.
- Added unit tests to validate the functionality of the new fingerprinting method and ensure correct behavior across different shader stages.
…and consistency

- Adjusted formatting in various GitHub workflow files to ensure consistent indentation and style.
- Enhanced comments for better readability and understanding of the CI processes.
- Updated the `.pre-commit-config.yaml` file to reflect the new project name and improve hook definitions.
- Consolidated and organized steps within workflows to streamline the CI pipeline and enhance maintainability.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/shader_pipeline_builder_test.cpp (1)

225-229: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not skip arbitrary pipeline failures.

At Line 225, a failed result is not evidence that WGSL is unavailable: WGSL cross-compile failures are already non-fatal. This skip can hide front-end, validation, or Metal regressions.

Proposed fix
-    // WGSL may be non-fatal missing; if reflection ran, set/binding stay canonical.
-    if (!result.ok()) {
-        GTEST_SKIP() << "WGSL path unavailable: " << result.error;
-    }
+    ASSERT_TRUE(result.ok()) << result.error;

As per coding guidelines, tests must be deterministic and behavior-focused.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/shader_pipeline_builder_test.cpp` around lines 225 - 229, Update the
test around builder->build(desc) so any failed result is asserted as a test
failure rather than skipped. Only accommodate the explicitly non-fatal
WGSL-missing behavior already handled by the build pipeline, while preserving
the test’s canonical set/binding validation and exposing front-end, validation,
and Metal regressions.

Source: Coding guidelines

.github/copilot-instructions.md (1)

103-103: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the agent-facing project layout.

Line 103 still directs reviewers to src/vertexnova/template/ and include/vertexnova/template/, while this PR uses the vertexnova/sc module. Rename the section and replace the stale paths so review agents inspect the active vnesc code. Based on supplied PR context, the active public-header path is include/vertexnova/sc/.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/copilot-instructions.md at line 103, Update the project-layout
guidance in .github/copilot-instructions.md to reference the vertexnova/sc
module instead of vertexnova/template: rename the section and replace the source
and public-header paths with the active vnesc paths, including
include/vertexnova/sc/. Keep the existing tests and examples paths unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-reusable.yml:
- Around line 168-177: The reusable workflow currently accepts lib_type=shared
but the CMake invocation in the build configuration always produces static
archives. Align the interface with the implementation by either removing shared
from the lib_type validation and all callers, or updating the CMake
configuration used by the workflow to enable shared-library builds when lib_type
is shared; ensure cache and build-directory labels cannot claim shared for
static artifacts.

In @.github/workflows/codeql.yml:
- Around line 49-51: Update the actions/checkout@v4 step to set
persist-credentials to false alongside the existing recursive submodules option,
ensuring checkout credentials are removed before repository-controlled CMake
executes.

---

Outside diff comments:
In @.github/copilot-instructions.md:
- Line 103: Update the project-layout guidance in
.github/copilot-instructions.md to reference the vertexnova/sc module instead of
vertexnova/template: rename the section and replace the source and public-header
paths with the active vnesc paths, including include/vertexnova/sc/. Keep the
existing tests and examples paths unchanged.

In `@tests/shader_pipeline_builder_test.cpp`:
- Around line 225-229: Update the test around builder->build(desc) so any failed
result is asserted as a test failure rather than skipped. Only accommodate the
explicitly non-fatal WGSL-missing behavior already handled by the build
pipeline, while preserving the test’s canonical set/binding validation and
exposing front-end, validation, and Metal regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d078d28-e0bb-4a20-be50-79356408965d

📥 Commits

Reviewing files that changed from the base of the PR and between 8f5359e and 8a8127a.

📒 Files selected for processing (19)
  • .github/copilot-instructions.md
  • .github/workflows/build-reusable.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/release-please.yml
  • .pre-commit-config.yaml
  • cmake/Dependencies.cmake
  • cmake/InstallRules.cmake
  • include/vertexnova/sc/metal_binding_allocator.h
  • include/vertexnova/sc/sc_types.h
  • include/vertexnova/sc/shader_artifact_cache.h
  • include/vertexnova/sc/shader_pipeline_builder.h
  • src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
  • src/vertexnova/sc/reflector/spirvcross_reflector.cpp
  • src/vertexnova/sc/shader_artifact_cache.cpp
  • src/vertexnova/sc/shader_pipeline_builder.cpp
  • tests/metal_binding_allocator_test.cpp
  • tests/shader_artifact_cache_test.cpp
  • tests/shader_pipeline_builder_test.cpp
🚧 Files skipped from review as they are similar to previous changes (8)
  • tests/metal_binding_allocator_test.cpp
  • include/vertexnova/sc/sc_types.h
  • include/vertexnova/sc/shader_pipeline_builder.h
  • include/vertexnova/sc/metal_binding_allocator.h
  • src/vertexnova/sc/shader_artifact_cache.cpp
  • cmake/Dependencies.cmake
  • src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
  • src/vertexnova/sc/reflector/spirvcross_reflector.cpp

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/shader_pipeline_builder_test.cpp (1)

225-229: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not skip arbitrary pipeline failures.

At Line 225, a failed result is not evidence that WGSL is unavailable: WGSL cross-compile failures are already non-fatal. This skip can hide front-end, validation, or Metal regressions.

Proposed fix
-    // WGSL may be non-fatal missing; if reflection ran, set/binding stay canonical.
-    if (!result.ok()) {
-        GTEST_SKIP() << "WGSL path unavailable: " << result.error;
-    }
+    ASSERT_TRUE(result.ok()) << result.error;

As per coding guidelines, tests must be deterministic and behavior-focused.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/shader_pipeline_builder_test.cpp` around lines 225 - 229, Update the
test around builder->build(desc) so any failed result is asserted as a test
failure rather than skipped. Only accommodate the explicitly non-fatal
WGSL-missing behavior already handled by the build pipeline, while preserving
the test’s canonical set/binding validation and exposing front-end, validation,
and Metal regressions.

Source: Coding guidelines

.github/copilot-instructions.md (1)

103-103: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the agent-facing project layout.

Line 103 still directs reviewers to src/vertexnova/template/ and include/vertexnova/template/, while this PR uses the vertexnova/sc module. Rename the section and replace the stale paths so review agents inspect the active vnesc code. Based on supplied PR context, the active public-header path is include/vertexnova/sc/.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/copilot-instructions.md at line 103, Update the project-layout
guidance in .github/copilot-instructions.md to reference the vertexnova/sc
module instead of vertexnova/template: rename the section and replace the source
and public-header paths with the active vnesc paths, including
include/vertexnova/sc/. Keep the existing tests and examples paths unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-reusable.yml:
- Around line 168-177: The reusable workflow currently accepts lib_type=shared
but the CMake invocation in the build configuration always produces static
archives. Align the interface with the implementation by either removing shared
from the lib_type validation and all callers, or updating the CMake
configuration used by the workflow to enable shared-library builds when lib_type
is shared; ensure cache and build-directory labels cannot claim shared for
static artifacts.

In @.github/workflows/codeql.yml:
- Around line 49-51: Update the actions/checkout@v4 step to set
persist-credentials to false alongside the existing recursive submodules option,
ensuring checkout credentials are removed before repository-controlled CMake
executes.

---

Outside diff comments:
In @.github/copilot-instructions.md:
- Line 103: Update the project-layout guidance in
.github/copilot-instructions.md to reference the vertexnova/sc module instead of
vertexnova/template: rename the section and replace the source and public-header
paths with the active vnesc paths, including include/vertexnova/sc/. Keep the
existing tests and examples paths unchanged.

In `@tests/shader_pipeline_builder_test.cpp`:
- Around line 225-229: Update the test around builder->build(desc) so any failed
result is asserted as a test failure rather than skipped. Only accommodate the
explicitly non-fatal WGSL-missing behavior already handled by the build
pipeline, while preserving the test’s canonical set/binding validation and
exposing front-end, validation, and Metal regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d078d28-e0bb-4a20-be50-79356408965d

📥 Commits

Reviewing files that changed from the base of the PR and between 8f5359e and 8a8127a.

📒 Files selected for processing (19)
  • .github/copilot-instructions.md
  • .github/workflows/build-reusable.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/release-please.yml
  • .pre-commit-config.yaml
  • cmake/Dependencies.cmake
  • cmake/InstallRules.cmake
  • include/vertexnova/sc/metal_binding_allocator.h
  • include/vertexnova/sc/sc_types.h
  • include/vertexnova/sc/shader_artifact_cache.h
  • include/vertexnova/sc/shader_pipeline_builder.h
  • src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
  • src/vertexnova/sc/reflector/spirvcross_reflector.cpp
  • src/vertexnova/sc/shader_artifact_cache.cpp
  • src/vertexnova/sc/shader_pipeline_builder.cpp
  • tests/metal_binding_allocator_test.cpp
  • tests/shader_artifact_cache_test.cpp
  • tests/shader_pipeline_builder_test.cpp
🚧 Files skipped from review as they are similar to previous changes (8)
  • tests/metal_binding_allocator_test.cpp
  • include/vertexnova/sc/sc_types.h
  • include/vertexnova/sc/shader_pipeline_builder.h
  • include/vertexnova/sc/metal_binding_allocator.h
  • src/vertexnova/sc/shader_artifact_cache.cpp
  • cmake/Dependencies.cmake
  • src/vertexnova/sc/crosscompiler/metal_binding_allocator.cpp
  • src/vertexnova/sc/reflector/spirvcross_reflector.cpp
🛑 Comments failed to post (2)
.github/workflows/build-reusable.yml (1)

168-177: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not accept a shared mode that always builds static artifacts.

Lines 104-116 accept lib_type: shared and label the build/cache directory accordingly, but this configure step no longer passes that choice to CMake and explicitly builds static archives. A caller requesting shared therefore gets a static build mislabeled as shared. Either remove shared from the reusable-workflow interface and its callers, or restore the vnesc shared-library configuration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build-reusable.yml around lines 168 - 177, The reusable
workflow currently accepts lib_type=shared but the CMake invocation in the build
configuration always produces static archives. Align the interface with the
implementation by either removing shared from the lib_type validation and all
callers, or updating the CMake configuration used by the workflow to enable
shared-library builds when lib_type is shared; ensure cache and build-directory
labels cannot claim shared for static artifacts.
.github/workflows/codeql.yml (1)

49-51: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Disable persisted checkout credentials before configuring PR code.

The checkout token remains in Git config by default, while Lines 57-73 execute repository-controlled CMake. A malicious CMake change could read and exfiltrate that token. Set persist-credentials: false.

Proposed fix
       - uses: actions/checkout@v4
         with:
           submodules: recursive
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      - uses: actions/checkout@v4
        with:
          submodules: recursive
          persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 49-55: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/codeql.yml around lines 49 - 51, Update the
actions/checkout@v4 step to set persist-credentials to false alongside the
existing recursive submodules option, ensuring checkout credentials are removed
before repository-controlled CMake executes.

Source: Linters/SAST tools

- Updated the `WgslLeavesVulkanSetBindingIdentity` test to assert successful results from the shader pipeline builder, enhancing test reliability.
- Removed the conditional skip for unavailable WGSL paths, ensuring that errors are reported directly in the test output.
…ation

- Changed repository name from `VneTemplate` to `vnesc` in the documentation.
- Updated project layout section to reflect the new directory structure for the library and public API.
- Adjusted CMake subproject commit reference to indicate a dirty state, ensuring accurate version tracking.
@ajeetsinghyadav
ajeetsinghyadav merged commit 51a41c6 into main Jul 14, 2026
19 checks passed
@ajeetsinghyadav
ajeetsinghyadav deleted the VNE_SHADERC_DESCRIPTOR_SET_FIXES branch July 14, 2026 04:09
@ajeetsinghyadav
ajeetsinghyadav restored the VNE_SHADERC_DESCRIPTOR_SET_FIXES branch August 16, 2026 05:28
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.

1 participant