gpu(native): honor render-target view mip and slice #171

Manually merged
github merged 1 commit from gh-pr/171/head into gh-pr/171/base 2026-11-27 00:52:50 +00:00
Owner

@⁠evan-kolberg on GitHub · 2026-11-26 22:56 UTC · original
evan-kolberg:fix/native-rtv-subresources → main · +341 −40 · 9 files · 1 commits · merged 2026-11-26 23:10 UTC

Summary

Native OMSetRenderTargets and ClearRenderTargetView now resolve the explicitly selected mip and array slice through the same cached Metal attachment. This builds on ItsMariusBC’s format handling in #145 at c155f089, preserving its sRGB/UNORM handling. Null descriptors and base-anchored 3D views retain their existing attachment behavior.

Explicit views support one single-sampled 1D or 2D subresource. Invalid ranges, unsupported planes, layered 1D/2D selections, and multisampled views are refused. An invalid clear records no command. A bind with an invalid attachment is refused without shifting the other slots.

Generated verification

  • Five targeted tests passed on Apple M4 Pro, macOS 27.2.1, with Metal API Validation for GPU tests. Native clear readback compared all 720 texels in five cases, including adjacent subresources, a plain view of an sRGB array mip, and a nonarray view of slice zero.
  • A standalone draw using generated Metal shader source changed only mip 1, slice 1. The separate Native fixture checked that binding and clearing select the same cached attachment.
  • The asset policy passed. A Windows-target cargo check of victory-gpu passed with BLAKE3's portable feature. These checks cover generated data.

I used Codex to implement the change and run the generated checks.

**@⁠evan-kolberg** on GitHub · 2026-11-26 22:56 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/171) `evan-kolberg:fix/native-rtv-subresources` → `main` · +341 −40 · 9 files · 1 commits · merged 2026-11-26 23:10 UTC ## Summary Native `OMSetRenderTargets` and `ClearRenderTargetView` now resolve the explicitly selected mip and array slice through the same cached Metal attachment. This builds on [ItsMariusBC’s format handling in #145](https://git.gtahub.st/github/LakshanSivakumar--Native-Victory-macOS/pulls/145) at [`c155f089`](https://github.com/LakshanSivakumar/Native-Victory-macOS/commit/c155f08976f02c22fe5db4621d7ac808feb33dfb), preserving its sRGB/UNORM handling. Null descriptors and base-anchored 3D views retain their existing attachment behavior. Explicit views support one single-sampled 1D or 2D subresource. Invalid ranges, unsupported planes, layered 1D/2D selections, and multisampled views are refused. An invalid clear records no command. A bind with an invalid attachment is refused without shifting the other slots. ## Generated verification - Five targeted tests passed on Apple M4 Pro, macOS 27.2.1, with Metal API Validation for GPU tests. Native clear readback compared all 720 texels in five cases, including adjacent subresources, a plain view of an sRGB array mip, and a nonarray view of slice zero. - A standalone draw using generated Metal shader source changed only mip 1, slice 1. The separate Native fixture checked that binding and clearing select the same cached attachment. - The asset policy passed. A Windows-target `cargo check` of `victory-gpu` passed with BLAKE3's portable feature. These checks cover generated data. I used Codex to implement the change and run the generated checks.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:52:48 +00:00
github manually merged commit 49c17a31b6 into gh-pr/171/base 2026-11-27 00:52:50 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 23:10 UTC · original · approved these changes

Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 23:10 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/171#pullrequestreview-6081365357) · **approved these changes** Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.