Polygon offset (depth bias) is not mapped to Metal #18

Closed
opened 2026-11-26 09:20:53 +00:00 by LakshanSivakumar · 1 comment
LakshanSivakumar commented 2026-11-26 09:20:53 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T09:20:53Z.


The depth bias fields of the rasterizer state are not passed to Metal (setDepthBias:slopeScale:clamp:). Decals and shadow maps will z-fight once the 3D world renders. Read the bias from the register image along with cull, depth and stencil.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6623465862 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/18). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T09:20:53Z. --- The depth bias fields of the rasterizer state are not passed to Metal (setDepthBias:slopeScale:clamp:). Decals and shadow maps will z-fight once the 3D world renders. Read the bias from the register image along with cull, depth and stencil.
LakshanSivakumar commented 2026-11-26 10:53:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T10:53:24Z.


Partial progress: #25 merged to main, so victory-metal now calls setDepthBias:slopeScale:clamp: on every draw (zero bias resets prior bias in the same pass).

Remaining work for this issue: decode the depth bias fields from the 0x1c8 register image into Graphics::guess_from for guessed pipelines.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7189973764 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/18#issuecomment-7189973764). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T10:53:24Z. --- Partial progress: #25 merged to `main`, so `victory-metal` now calls `setDepthBias:slopeScale:clamp:` on every draw (zero bias resets prior bias in the same pass). Remaining work for this issue: decode the depth bias fields from the 0x1c8 register image into `Graphics::guess_from` for guessed pipelines.
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#18
No description provided.