Skip to content

fix(texture): use SaveTexture for remote exports - #272

Merged
BANANASJIM merged 1 commit into
BANANASJIM:masterfrom
Misaka-Mikoto-Tech:fix/remote-save-texture-export
Jul 22, 2026
Merged

fix(texture): use SaveTexture for remote exports#272
BANANASJIM merged 1 commit into
BANANASJIM:masterfrom
Misaka-Mikoto-Tech:fix/remote-save-texture-export

Conversation

@Misaka-Mikoto-Tech

@Misaka-Mikoto-Tech Misaka-Mikoto-Tech commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What

Use RenderDoc's SaveTexture path for remote texture and render-target exports.

Why

Remote export previously fetched raw data with GetTextureData and decoded it in rdc-cli. That diverged from qrenderdoc/RenderDoc export behavior and could fail for compressed or HDR resources and Texture3D subresources. Follow-up to #268..

How

  • Route remote texture, colour RT, and depth RT exports through the local replay controller's SaveTexture, matching qrenderdoc.
  • Keep PNG as the current CLI default while retaining an internal destination-type parameter for future format selection.
  • Report SaveTexture failures and missing output files explicitly; retain raw decoding only for local depth export.

Test plan

  • PYTHONUTF8=1 pixi run check passes (2,995 passed, 83 skipped)
  • Added/updated unit tests for requested 3D mip/slice export and SaveTexture error cases
  • Manual Android remote-replay regression with a real .rdc capture: exported ASTC Texture3D mip 0/slice 0 and mip 1/slice 1; both matched direct SaveTexture output byte-for-byte (SHA-256)

Summary by CodeRabbit

  • New Features

    • Added support for selecting the destination format when exporting textures.
    • Improved remote texture and render-target exports using RenderDoc’s native save functionality.
    • Added support for exporting depth images and selected 3D texture slices.
  • Bug Fixes

    • Improved error reporting when exports fail or output files are not created.
    • Fixed handling of remote render-target and depth exports.
    • Clarified errors for unsupported local texture formats.

@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 →

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Texture export now separates local decoding from remote RenderDoc SaveTexture export, supports destination-type overrides, routes render-target and depth exports directly through the appropriate resource, and validates encoder results and generated files.

Changes

Texture export paths

Layer / File(s) Summary
Remote SaveTexture contract
src/rdc/handlers/_helpers.py, src/rdc/handlers/texture.py
The texture-save helper accepts an optional destination type; remote exports normalize RenderDoc results and verify output-file creation.
Local decoding and export routing
src/rdc/handlers/texture.py
Local exports fetch, slice, decode, and write texture data; texture, render-target, and depth handlers route local and remote requests through the updated paths.
Export behavior coverage
tests/unit/test_tex_stats_handler.py
Tests verify SaveTexture usage, failure messages, missing-output errors, render-target parameters, and remote overlay rejection.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant tex_export
  participant export_remote
  participant SaveTexture
  participant output_file
  tex_export->>export_remote: pass resource, destination type, mip, and slice
  export_remote->>SaveTexture: save texture
  SaveTexture-->>export_remote: return result
  export_remote->>output_file: verify generated PNG
  output_file-->>tex_export: return path and size
Loading

Possibly related PRs

Suggested reviewers: bananasjim

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR changes remote export paths, but it does not address the linked issue's 3D slice validation or metadata output requirements. Update tex-stats validation for Texture3D slices using mip depth and add depth/dimension to resource and descriptor output, with regression tests for valid and invalid slices.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changes stay within texture export handling and related tests, which matches the PR's stated SaveTexture export focus.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: routing remote texture exports through SaveTexture.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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: 1

🤖 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 `@src/rdc/handlers/texture.py`:
- Around line 125-128: Update _handle_tex_export, _handle_rt_export, and the
depth fallback in _handle_rt_depth to stop treating the return value of
controller.SaveTexture(...) as a success flag. Rely on exceptions and
temp_path.exists() to detect write failure, while preserving the existing
failure handling and the _save_result_ok helper for paths where its result is
meaningful.
🪄 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: 91f63806-81f5-48fd-8268-0d807b63a843

📥 Commits

Reviewing files that changed from the base of the PR and between 420c568 and 51fe8c6.

📒 Files selected for processing (3)
  • src/rdc/handlers/_helpers.py
  • src/rdc/handlers/texture.py
  • tests/unit/test_tex_stats_handler.py

Comment on lines +125 to +128
def _save_result_ok(result: Any) -> bool:
"""Accept current ResultDetails and older bool SaveTexture bindings."""
ok = getattr(result, "OK", None)
return bool(ok()) if callable(ok) else bool(result)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

RenderDoc python ReplayController SaveTexture return type ResultDetails

💡 Result:

The SaveTexture method of the RenderDoc ReplayController class does not return a ResultDetails object; its return type is None [1]. The method is defined as: controller.SaveTexture(saveData, path) Where: - saveData is a renderdoc.TextureSave object that specifies the configuration for saving the texture (e.g., resource ID, file type, mapping options) [2][3]. - path is a string representing the destination file path on disk [1]. While other methods in the RenderDoc API, such as CaptureFile.OpenCapture, return a tuple containing a ResultDetails object (which is used to handle success or error reporting) [4][5], SaveTexture performs the operation and does not provide an explicit result object as a return value [1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the file structure first
ast-grep outline src/rdc/handlers/texture.py --view expanded

# Read the relevant section with line numbers
sed -n '180,340p' src/rdc/handlers/texture.py | cat -n

Repository: BANANASJIM/rdc-cli

Length of output: 8902


🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline src/rdc/handlers/texture.py --view expanded
printf '\n---\n'
sed -n '180,340p' src/rdc/handlers/texture.py | cat -n

Repository: BANANASJIM/rdc-cli

Length of output: 8907


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the specific handler functions and any save result helpers
rg -n "_save_result_ok|_save_result_message|SaveTexture|temp_path.exists|if not success" src/rdc/handlers/texture.py

printf '\n--- context ---\n'
sed -n '180,340p' src/rdc/handlers/texture.py

Repository: BANANASJIM/rdc-cli

Length of output: 8999


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '120,170p' src/rdc/handlers/texture.py | cat -n

Repository: BANANASJIM/rdc-cli

Length of output: 2466


Local SaveTexture paths always trip the failure check. In _handle_tex_export, _handle_rt_export, and the depth fallback in _handle_rt_depth, controller.SaveTexture(...) returns None in these bindings, so if not success or not temp_path.exists() reports SaveTexture failed even when the file was written. Drop the success truthiness check and rely on the file write/exception path.

🤖 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/rdc/handlers/texture.py` around lines 125 - 128, Update
_handle_tex_export, _handle_rt_export, and the depth fallback in
_handle_rt_depth to stop treating the return value of
controller.SaveTexture(...) as a success flag. Rely on exceptions and
temp_path.exists() to detect write failure, while preserving the existing
failure handling and the _save_result_ok helper for paths where its result is
meaningful.

@BANANASJIM
BANANASJIM merged commit ae559ee into BANANASJIM:master Jul 22, 2026
17 checks passed
@Misaka-Mikoto-Tech
Misaka-Mikoto-Tech deleted the fix/remote-save-texture-export branch July 23, 2026 02:27
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