Skip to content

feat(cbuffer): add rdc cbuffer command and cbuffer_raw export (#224)#228

Merged
BANANASJIM merged 4 commits into
masterfrom
feat/224-cbuffer-export
May 16, 2026
Merged

feat(cbuffer): add rdc cbuffer command and cbuffer_raw export (#224)#228
BANANASJIM merged 4 commits into
masterfrom
feat/224-cbuffer-export

Conversation

@BANANASJIM
Copy link
Copy Markdown
Owner

Part 2 of #224.

What

New rdc cbuffer command to export shader constant/uniform buffer contents at a given event + stage + binding, as decoded JSON or raw bytes — replacing fragile custom RenderDoc Python scripts.

rdc cbuffer 1084 --stage vs --binding 1 --json
rdc cbuffer 1084 --stage vs --binding 1 --raw -o cbuffer1.bin

Changes

  • handlers/buffer.py: new cbuffer_raw handler (reflection lookup → GetConstantBlock(...).descriptorGetBufferData → temp file {path,size}), mirroring buf_raw. Non-buffer-backed cbuffers (push/root constants) return a clean -32602 error, not a crash. Existing cbuffer_decode handler is unmodified.
  • vfs/router.py: new leaf_bin route /draws/<eid>/cbuffer/<set>/<binding>/datacbuffer_raw, mirroring /buffers/<id>/data.
  • commands/cbuffer.py (new): decoded path reuses cbuffer_decode; raw path routes through _export_vfs_path (same flow as rdc buffer --raw). --raw requires explicit -o and explicit EID (mirrors rt_cmd).
  • Regenerated command docs/skill references; freshness gates pass.

Tests

  • Handler: raw happy-path (exact bytes + temp filename), bufferBacked=False clean error, no-adapter, bad binding, no-reflection, version-guard, no-temp-dir.
  • CLI: JSON default/explicit, param forwarding, --raw -o, --raw without -o/without EID usage errors, no-session.
  • VFS route resolution test.
  • @pytest.mark.gpu Vulkan integration tests (vkcube).
  • Full suite: 2864 passed, 6 skipped, 92.68% coverage; ruff + mypy strict clean.

Verification

Verified on Linux/Vulkan. D3D12 root-constant / register-space behavior cannot be verified on the dev box (Linux replay is Vulkan-only) — reporter verification on a real D3D12 capture is requested before merge.

OpenSpec: openspec/changes/2026-05-15-issue-224-cbuffer-export/. Completes the unshipped CLI half of the archived 2026-02-19-phase2-buffer-decode change (extended: richer direct command + new cbuffer_raw handler/route, not a thin VFS wrapper).

Complete the unshipped CLI half of phase2-buffer-decode.

- New daemon handler cbuffer_raw: reflection lookup, GetConstantBlock
  descriptor, GetBufferData -> temp file {path,size}. Rejects
  non-buffer-backed cbuffers (push/root constants) with a clean
  JSON-RPC error; preserves GetConstantBlock version guard.
- New VFS leaf_bin route /draws/<eid>/cbuffer/<set>/<binding>/data.
- New CLI command rdc cbuffer: decoded JSON (cbuffer_decode) by
  default, raw export via _export_vfs_path mirroring rdc buffer.
- Unit tests for handler + CLI, GPU integration tests, regenerated
  command/skill references.
Passing --raw without an EID silently targeted draw 0 (capture-start),
which never has a bound cbuffer and produced a confusing error. Now
raises UsageError matching the precedent in export.py rt_cmd.

Rename test_eid_omitted_uses_completion_fallback →
test_eid_omitted_lets_daemon_default to reflect what the test actually
asserts (no eid key in params, daemon uses current event).

Add test_raw_without_eid: asserts exit code 2 and "EID" in output.
@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@BANANASJIM has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 7 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2b9deaf8-113b-4552-8d3f-9d68d50b30fb

📥 Commits

Reviewing files that changed from the base of the PR and between 072cc49 and 5c804be.

📒 Files selected for processing (15)
  • docs-astro/src/data/commands.json
  • openspec/changes/2026-05-15-issue-224-cbuffer-export/proposal.md
  • openspec/changes/2026-05-15-issue-224-cbuffer-export/specs/daemon/spec.md
  • openspec/changes/2026-05-15-issue-224-cbuffer-export/tasks.md
  • openspec/changes/2026-05-15-issue-224-cbuffer-export/test-plan.md
  • scripts/gen-commands.py
  • src/rdc/_skills/references/commands-quick-ref.md
  • src/rdc/cli.py
  • src/rdc/commands/cbuffer.py
  • src/rdc/handlers/buffer.py
  • src/rdc/vfs/router.py
  • tests/integration/test_daemon_handlers_real.py
  • tests/unit/test_buffer_decode.py
  • tests/unit/test_cbuffer_commands.py
  • tests/unit/test_vfs_router.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/224-cbuffer-export

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

…ings (#224)

_handle_cbuffer_raw returned a 0-byte file as success when the cbuffer
resource was null/unbound, and dumped the entire backing upload heap when
the descriptor reported byteSize==0 (D3D12 root CBV). Now:

- null/zero cb_resource -> JSON-RPC -32001 'cbuffer not bound at this draw'
- byteSize==0 falls back to the reflected ConstantBlock byteSize
- both zero -> clean -32001 error; never pass size 0 to GetBufferData

--set/--binding help now states Vulkan (descriptor set / binding) vs
D3D12 (register space / shader register bN). Regenerated commands-quick-ref.
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@BANANASJIM BANANASJIM merged commit f23143a into master May 16, 2026
17 checks passed
@BANANASJIM BANANASJIM deleted the feat/224-cbuffer-export branch May 19, 2026 00:10
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