mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 09:13:39 +01:00
Do dirty-tracking for stencil state
This commit is contained in:
1 parent
cb38c43d7e
commit
3b81b3ca80
1 file changed
+23
-3
@@ -836,6 +836,13 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
|
||||
bool clipDistanceEnabled[8]{};
|
||||
GLuint blendEqColor = (GLuint)-1;
|
||||
GLuint blendEqAlpha = (GLuint)-1;
|
||||
GLuint stencilWriteMask = (GLuint)-1;
|
||||
GLenum stencilFunc = (GLenum)-1;
|
||||
GLuint stencilRef = (GLuint)-1;
|
||||
GLuint stencilCompareMask = (GLuint)-1;
|
||||
GLenum stencilSFail = (GLenum)-1;
|
||||
GLenum stencilZFail = (GLenum)-1;
|
||||
GLenum stencilPass = (GLenum)-1;
|
||||
|
||||
GLRTexture *curTex[MAX_GL_TEXTURE_SLOTS]{};
|
||||
|
||||
@@ -868,9 +875,22 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
stencilEnabled = true;
|
||||
}
|
||||
glStencilFunc(c.stencil.func, c.stencil.ref, c.stencil.compareMask);
|
||||
glStencilOp(c.stencil.sFail, c.stencil.zFail, c.stencil.pass);
|
||||
glStencilMask(c.stencil.writeMask);
|
||||
if (c.stencil.func != stencilFunc || c.stencil.ref != stencilRef || c.stencil.compareMask != stencilCompareMask) {
|
||||
glStencilFunc(c.stencil.func, c.stencil.ref, c.stencil.compareMask);
|
||||
stencilFunc = c.stencil.func;
|
||||
stencilRef = c.stencil.ref;
|
||||
stencilCompareMask = c.stencil.compareMask;
|
||||
}
|
||||
if (c.stencil.sFail != stencilSFail || c.stencil.zFail != stencilZFail || c.stencil.pass != stencilPass) {
|
||||
glStencilOp(c.stencil.sFail, c.stencil.zFail, c.stencil.pass);
|
||||
stencilSFail = c.stencil.sFail;
|
||||
stencilZFail = c.stencil.zFail;
|
||||
stencilPass = c.stencil.pass;
|
||||
}
|
||||
if (c.stencil.writeMask != stencilWriteMask) {
|
||||
glStencilMask(c.stencil.writeMask);
|
||||
stencilWriteMask = c.stencil.writeMask;
|
||||
}
|
||||
} else if (/* !c.stencilFunc.enabled && */stencilEnabled) {
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
stencilEnabled = false;
|
||||
|
||||
Reference in new issue
Block a user