Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Veldrid/MTL/MTLPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,13 @@ public MtlPipeline(ref GraphicsPipelineDescription description, MtlGraphicsDevic
{
var depthDescriptor = MTLUtil.AllocInit<MTLDepthStencilDescriptor>(
nameof(MTLDepthStencilDescriptor));
// Metal has no explicit depth-test enable flag on the depth-stencil descriptor.
// When depth testing is disabled we must force "always" to avoid unintentionally
// rejecting all fragments if DepthComparison is left at its default (Never).
depthDescriptor.depthCompareFunction = MtlFormats.VdToMtlCompareFunction(
description.DepthStencilState.DepthComparison);
description.DepthStencilState.DepthTestEnabled
? description.DepthStencilState.DepthComparison
: ComparisonKind.Always);
depthDescriptor.depthWriteEnabled = description.DepthStencilState.DepthWriteEnabled;

bool stencilEnabled = description.DepthStencilState.StencilTestEnabled;
Expand Down
Loading