fix(export): unify depth export decode path across local and remote modes#242
Conversation
…odes Local depth export previously called SaveTexture, producing an RGBA PNG with linear depth in the red channel, while remote mode used GetTextureData + _decode_texture_png to produce a grayscale mode-L PNG. The same capture yielded a different file per mode, breaking cross-mode golden comparisons. _handle_rt_depth now always attempts _export_remote(is_depth=True) first, regardless of state.is_remote. For combined depth-stencil and MSAA formats the decoder returns None (-32002); in local mode this falls back to the existing SaveTexture path, while remote mode returns the error unchanged. A tex_map miss stays -32001 with no fallback. Behaviour change (changelog-worthy): local depth PNGs are now grayscale mode-L with min-max stretch, matching remote mode; scripts reading the red channel of a locally-exported depth PNG must be updated.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
📝 WalkthroughWalkthroughThis PR implements a unified depth PNG export behavior where local depth export ( ChangesDepth Export Consistency Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/test_binary_daemon.py (1)
125-126: 💤 Low valueConsider using a more varied depth pattern for better test coverage.
The current
_DEPTH_500_DATApattern is[0, 65535, 65535, 65535](min, max, max, max), which is simple but lacks dynamic range. The depth tests intest_tex_stats_handler.py(lines 491, 548) use[0, 16384, 49152, 65535](0%, 25%, 75%, 100%), which provides better gradient coverage and would make the shared mock more useful for future tests.♻️ Optional refactor for consistency
-# D16 2x2 depth bytes for ResourceId(500): width*height*compCount*compByteWidth = 8. -_DEPTH_500_DATA = (0).to_bytes(2, "little") + (65535).to_bytes(2, "little") * 3 +# D16 2x2 depth bytes for ResourceId(500): [0, 16384, 49152, 65535] gradient. +_DEPTH_500_DATA = b"".join( + x.to_bytes(2, "little") for x in [0, 16384, 49152, 65535] +)🤖 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/unit/test_binary_daemon.py` around lines 125 - 126, The test uses a non-varying depth pattern in the constant _DEPTH_500_DATA (currently [0, 65535, 65535, 65535]); replace it with a more varied gradient (for example [0, 16384, 49152, 65535]) to match the depth coverage used in test_tex_stats_handler and improve test usefulness; update the bytes construction in _DEPTH_500_DATA so each value is converted with (value).to_bytes(2, "little") in the same order and keep the surrounding concatenation unchanged so existing consumers of _DEPTH_500_DATA continue to work.
🤖 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.
Nitpick comments:
In `@tests/unit/test_binary_daemon.py`:
- Around line 125-126: The test uses a non-varying depth pattern in the constant
_DEPTH_500_DATA (currently [0, 65535, 65535, 65535]); replace it with a more
varied gradient (for example [0, 16384, 49152, 65535]) to match the depth
coverage used in test_tex_stats_handler and improve test usefulness; update the
bytes construction in _DEPTH_500_DATA so each value is converted with
(value).to_bytes(2, "little") in the same order and keep the surrounding
concatenation unchanged so existing consumers of _DEPTH_500_DATA continue to
work.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9b10356b-a62d-4196-8898-59418e03275c
📒 Files selected for processing (7)
openspec/changes/2026-06-09-depth-export-consistency/proposal.mdopenspec/changes/2026-06-09-depth-export-consistency/tasks.mdopenspec/changes/2026-06-09-depth-export-consistency/test-plan.mdsrc/rdc/commands/snapshot.pysrc/rdc/handlers/texture.pytests/unit/test_binary_daemon.pytests/unit/test_tex_stats_handler.py
Summary
Depth export previously produced different images per replay mode: local mode wrote an RGBA PNG with linear depth in the red channel (RenderDoc
SaveTexturebehavior), while remote mode (since #237) wrote a min-max-stretched grayscale PNG viaGetTextureData+ local decode. Same capture, visually different files — cross-mode golden comparisons were impossible.Depth export now uses one pipeline in both modes:
_handle_rt_depthalways tries theGetTextureData+ grayscale decode path first. Output is byte-identical between local and remote replay for decodable depth formats.Behavior change
Local depth PNGs change from red-channel RGBA (linear, unstretched) to grayscale mode-L with min-max stretch — now matching remote output exactly. Color/texture export is unchanged (local still uses
SaveTexture).Fallback
When the decoder rejects a format (combined depth-stencil D16S8/D24S8/D32S8/S8, MSAA), local mode falls back to the previous
SaveTexturepath verbatim, preserving existing capability; remote mode returns -32002 as before. A texture-map miss stays -32001 with no fallback.Testing
GetTextureData(SaveTexture stubbed to fail), grayscale mode-L output, local D24S8 SaveTexture fallback, remote D24S8 stays -32002 with SaveTexture never called, local/remote byte-identical D16. Binary-daemon mock state extended with a depth texture entry.rdc snapshot(depth.png + color0.png) unaffected. D24S8 could not be exercised on RADV (format unsupported by the driver); the fallback branch is covered by unit tests.Note for remote testing on dual-stack hosts: use
--proxy 127.0.0.1:<port>rather thanlocalhost—renderdoccmd remoteserverbinds IPv4 only whilelocalhostmay resolve to::1.Summary by CodeRabbit
Bug Fixes
Tests