Skip to content

feat(remote): decode R11G11B10F and R9G9B9E5 packed HDR formats in remote export#240

Merged
BANANASJIM merged 3 commits into
masterfrom
feat/packed-hdr-decode
Jun 10, 2026
Merged

feat(remote): decode R11G11B10F and R9G9B9E5 packed HDR formats in remote export#240
BANANASJIM merged 3 commits into
masterfrom
feat/packed-hdr-decode

Conversation

@BANANASJIM

Copy link
Copy Markdown
Owner

Summary

Remote-mode texture/RT export now decodes the two packed HDR formats named in #236:

  • R11G11B10_FLOAT (VK_FORMAT_B10G11R11_UFLOAT_PACK32)
  • R9G9B9E5_SHAREDEXP (VK_FORMAT_E5B9G9R9_UFLOAT_PACK32)

#237 scoped these out (all non-Regular ResourceFormatTypes were rejected with -32002). Both are closed-form bit-unpackable, so they now decode locally like the Regular formats.

Implementation

  • New vectorized numpy unpack helpers in handlers/_helpers.py: a shared unsigned mini-float decoder (5-bit exponent, 6/5-bit mantissa, bias 15, subnormal/Inf/NaN semantics) for R11G11B10, and shared-exponent decode (m * 2^(E-24)) for R9G9B9E5.
  • The packed branch sits before the Regular gate with its own MSAA rejection and a 4-bytes-per-pixel length check (compCount/compByteWidth are unreliable for packed formats).
  • Unpacked float32 RGB feeds the existing Float display pipeline: NaN→0 / +Inf→1 sanitize, clip to [0,1], sRGB on RGB, opaque alpha; 3D textures tile depth slices vertically as before.
  • All other non-Regular formats still get the clean -32002 rejection (the rejection test now uses R5G6B5).

Testing

  • 13 new unit tests with hand-computed bit vectors (happy path, Inf, NaN, subnormal, max-finite, max shared exponent, all-zero, wrong-length, MSAA, 3D tiling for both formats). All vectors were independently re-derived during review; an exhaustive sweep of the full 11-bit/10-bit component spaces plus 147k shared-exp combinations against a float16-based reference implementation found zero mismatches.
  • Real-GPU verification on AMD RX 7600 (RADV): purpose-built Vulkan apps rendered (1.0, 0.5, 0.25) into each format; remote --proxy export decoded both to the exact expected sRGB (255, 188, 137), matching tex-stats ground truth. Normal-format remote export verified unaffected by the new branch ordering.
  • Full suite: 2964 passed; lint + mypy strict clean.

…mote export

Both formats are common HDR render-target and IBL storage formats that PR #237
scoped out. They are closed-form bit-unpackable in numpy with no GPU round-trip,
so they follow the existing local-decode path for Regular Float formats.

Add _unpack_r11g11b10 and _unpack_r9g9b9e5 vectorised helpers and branch on them
in _decode_texture_png before the Regular gate, carrying their own MSAA reject and
local width/height/depth/length checks. Decoded RGB feeds the existing Float
display pipeline (nan_to_num, clip, sRGB encode, opaque alpha, depth tiling).

Repurpose the former R11G11B10 rejection test to R5G6B5, which remains an
unsupported packed format after this change.
@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 free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@BANANASJIM, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes and 50 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 95df497f-3b3e-4bd1-904b-d273b24e4da2

📥 Commits

Reviewing files that changed from the base of the PR and between 45eb0f8 and a02913f.

📒 Files selected for processing (5)
  • openspec/changes/2026-06-09-packed-hdr-decode/proposal.md
  • openspec/changes/2026-06-09-packed-hdr-decode/tasks.md
  • openspec/changes/2026-06-09-packed-hdr-decode/test-plan.md
  • src/rdc/handlers/_helpers.py
  • tests/unit/test_tex_stats_handler.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/packed-hdr-decode

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.

@BANANASJIM

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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 free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@BANANASJIM BANANASJIM merged commit f36b41e into master Jun 10, 2026
17 checks passed
@BANANASJIM BANANASJIM deleted the feat/packed-hdr-decode branch June 10, 2026 05:40
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