Use explicit front and back stencil state.

Previously stencil states were stored in array. This commit changes the
DepthStencilState to explicitly store a front and back stencil.
This commit is contained in:
Austin Eng
2017-05-31 09:29:05 -04:00
committed by Corentin Wallez
parent 376f1c6a8e
commit f51be34864
4 changed files with 37 additions and 43 deletions

View File

@@ -478,7 +478,7 @@ namespace metal {
ASSERT(encoders.render);
[encoders.render
[encoders.render
setStencilFrontReferenceValue:cmd->frontReference
backReferenceValue:cmd->backReference];
}
@@ -706,7 +706,7 @@ namespace metal {
return MTLStencilOperationIncrementWrap;
case nxt::StencilOperation::DecrementWrap:
return MTLStencilOperationDecrementWrap;
default:
default:
ASSERT(false);
}
}
@@ -735,9 +735,9 @@ namespace metal {
MTLStencilDescriptor* backFaceStencil = [MTLStencilDescriptor new];
MTLStencilDescriptor* frontFaceStencil = [MTLStencilDescriptor new];
auto& back = GetStencil(nxt::Face::Back);
auto& front = GetStencil(nxt::Face::Front);
auto& back = GetBackStencil();
auto& front = GetFrontStencil();
backFaceStencil.stencilCompareFunction = DepthStencilCompareFunction(back.compareFunction);
backFaceStencil.stencilFailureOperation = StencilOperation(back.stencilFail);
backFaceStencil.depthFailureOperation = StencilOperation(back.depthFail);
@@ -913,7 +913,7 @@ namespace metal {
builder->HandleError("Error creating pipeline state");
return;
}
DepthStencilState* depthStencilState = ToBackend(GetDepthStencilState());
MTLDepthStencilDescriptor* dsDesc = depthStencilState->GetMTLDepthStencilDescriptor();
mtlDepthStencilState = [device->GetMTLDevice()