Remove DepthTestEnabled() and fix depth writes for depth function Always

This commit is contained in:
Austin Eng
2017-07-21 18:35:56 -04:00
committed by Austin Eng
parent cc8d2d529d
commit ccf1fa2330
4 changed files with 10 additions and 17 deletions

View File

@@ -74,14 +74,15 @@ namespace opengl {
}
void DepthStencilState::ApplyNow(PersistentPipelineState &persistentPipelineState) const {
if (DepthTestEnabled()) {
glEnable(GL_DEPTH_TEST);
} else {
glDisable(GL_DEPTH_TEST);
}
auto& depthInfo = GetDepth();
// Depth writes only occur if depth is enabled
if (depthInfo.compareFunction == nxt::CompareFunction::Always && !depthInfo.depthWriteEnabled) {
glDisable(GL_DEPTH_TEST);
} else {
glEnable(GL_DEPTH_TEST);
}
if (depthInfo.depthWriteEnabled) {
glDepthMask(GL_TRUE);
} else {