[GL] Add stencil enable to state tracker

This commit is contained in:
wheremyfoodat 2023-07-27 15:34:21 +03:00
parent 03733569e0
commit b4cc743608
3 changed files with 25 additions and 3 deletions

View file

@ -21,6 +21,7 @@ struct GLStateManager {
bool blendEnabled;
bool depthEnabled;
bool scissorEnabled;
bool stencilEnabled;
// Colour/depth masks
bool redMask, greenMask, blueMask, alphaMask;
@ -40,6 +41,7 @@ struct GLStateManager {
void resetVBO();
void resetProgram();
void resetScissor();
void resetStencil();
void enableDepth() {
if (!depthEnabled) {
@ -83,6 +85,20 @@ struct GLStateManager {
}
}
void enableStencil() {
if (!stencilEnabled) {
stencilEnabled = true;
OpenGL::enableStencil();
}
}
void disableStencil() {
if (stencilEnabled) {
stencilEnabled = false;
OpenGL::disableStencil();
}
}
void bindVAO(GLuint handle) {
if (boundVAO != handle) {
boundVAO = handle;