Archived
1
Fork 0

Add support for greater depth function

This commit is contained in:
redstrate 2020-08-18 00:45:56 -04:00
parent b2deff18aa
commit d798d1328e
2 changed files with 13 additions and 2 deletions

View file

@ -598,7 +598,17 @@ GFXPipeline* GFXMetal::create_graphics_pipeline(const GFXGraphicsPipelineCreateI
MTLDepthStencilDescriptor* depthStencil = [MTLDepthStencilDescriptor new];
if(info.depth.depth_mode != GFXDepthMode::None) {
depthStencil.depthCompareFunction = info.depth.depth_mode == GFXDepthMode::LessOrEqual ? MTLCompareFunctionLessEqual : MTLCompareFunctionLess;
switch(info.depth.depth_mode) {
case GFXDepthMode::Less:
depthStencil.depthCompareFunction = MTLCompareFunctionLess;
break;
case GFXDepthMode::LessOrEqual:
depthStencil.depthCompareFunction = MTLCompareFunctionLessEqual;
break;
case GFXDepthMode::Greater:
depthStencil.depthCompareFunction = MTLCompareFunctionGreater;
break;
}
depthStencil.depthWriteEnabled = true;
}

View file

@ -106,7 +106,8 @@ struct GFXVertexAttribute {
enum class GFXDepthMode {
None,
Less,
LessOrEqual
LessOrEqual,
Greater
};
struct GFXPushConstant {