mirror of https://github.com/bjornbytes/lovr.git
Fix depth test;
- Use incoming depth settings to determine whether depth test should be enabled or disabled (wtf) - Always track state.depthTest, even if depth test is disabled
This commit is contained in:
parent
cc367c6a3a
commit
053c318995
|
@ -1014,17 +1014,18 @@ static void lovrGpuBindPipeline(Pipeline* pipeline) {
|
|||
bool updateDepthTest = pipeline->depthTest != state.depthTest;
|
||||
bool updateDepthWrite = state.depthWrite != (pipeline->depthWrite && !state.stencilWriting);
|
||||
if (updateDepthTest || updateDepthWrite) {
|
||||
bool enable = state.depthTest != COMPARE_NONE || state.depthWrite;
|
||||
bool enable = pipeline->depthTest != COMPARE_NONE || pipeline->depthWrite;
|
||||
|
||||
if (enable && !state.depthEnabled) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
} else if (!enable && state.depthEnabled) {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
state.depthEnabled = enable;
|
||||
state.depthTest = pipeline->depthTest;
|
||||
|
||||
if (enable && updateDepthTest) {
|
||||
state.depthTest = pipeline->depthTest;
|
||||
glDepthFunc(convertCompareMode(state.depthTest));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue