Native Metal 2D stencil SRVs bind the depth aspect #660

Open
opened 2026-11-30 02:20:49 +00:00 by fruvs · 2 comments
fruvs commented 2026-11-30 02:20:49 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by fruvs on 2026-11-30T02:20:49Z.


What went wrong

The native Metal backend binds the depth aspect when a 2D shader resource view requests the stencil aspect of a D32FloatS8 texture. A shader gathering the logical green component therefore cannot read the stored stencil bytes.

Steps to reproduce

Create a combined depth-stencil texture, seed distinct stencil values, and sample its stencil SRV with a green-component gather. Repeat with a second stencil pattern on the same texture. The synthetic regression checks both patterns against the original integer values.

The proposed fix binds an X32_Stencil8 view of the current backing texture and routes Metal's red stencil component to green. The view shares storage with the parent and tracks later stencil writes.

Mac, macOS version and commit

M5 Pro, macOS 27.2.1 (26B8132), upstream base 268172850870.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6687452137 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/660). Originally posted by [fruvs](https://github.com/fruvs) on 2026-11-30T02:20:49Z. --- ### What went wrong The native Metal backend binds the depth aspect when a 2D shader resource view requests the stencil aspect of a D32FloatS8 texture. A shader gathering the logical green component therefore cannot read the stored stencil bytes. ### Steps to reproduce Create a combined depth-stencil texture, seed distinct stencil values, and sample its stencil SRV with a green-component gather. Repeat with a second stencil pattern on the same texture. The synthetic regression checks both patterns against the original integer values. The proposed fix binds an X32_Stencil8 view of the current backing texture and routes Metal's red stencil component to green. The view shares storage with the parent and tracks later stencil writes. ### Mac, macOS version and commit M5 Pro, macOS 27.2.1 (26B8132), upstream base `268172850870`.
fruvs commented 2026-11-30 02:21:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by fruvs on 2026-11-30T02:21:12Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7266930961 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/660#issuecomment-7266930961). Originally posted by [fruvs](https://github.com/fruvs) on 2026-11-30T02:21:12Z. --- /claim
github-actions[bot] commented 2026-11-30 02:21:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-30T02:21:22Z.


Claimed by @fruvs. Open a draft pull request with Refs #660 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7266933415 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/660#issuecomment-7266933415). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T02:21:22Z. --- Claimed by @fruvs. Open a draft pull request with `Refs #660` in its description within 24 hours, or the claim expires.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#660
No description provided.