mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
[GL] Add stencil enable to state tracker
This commit is contained in:
parent
03733569e0
commit
b4cc743608
3 changed files with 25 additions and 3 deletions
|
@ -21,6 +21,7 @@ struct GLStateManager {
|
||||||
bool blendEnabled;
|
bool blendEnabled;
|
||||||
bool depthEnabled;
|
bool depthEnabled;
|
||||||
bool scissorEnabled;
|
bool scissorEnabled;
|
||||||
|
bool stencilEnabled;
|
||||||
|
|
||||||
// Colour/depth masks
|
// Colour/depth masks
|
||||||
bool redMask, greenMask, blueMask, alphaMask;
|
bool redMask, greenMask, blueMask, alphaMask;
|
||||||
|
@ -40,6 +41,7 @@ struct GLStateManager {
|
||||||
void resetVBO();
|
void resetVBO();
|
||||||
void resetProgram();
|
void resetProgram();
|
||||||
void resetScissor();
|
void resetScissor();
|
||||||
|
void resetStencil();
|
||||||
|
|
||||||
void enableDepth() {
|
void enableDepth() {
|
||||||
if (!depthEnabled) {
|
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) {
|
void bindVAO(GLuint handle) {
|
||||||
if (boundVAO != handle) {
|
if (boundVAO != handle) {
|
||||||
boundVAO = handle;
|
boundVAO = handle;
|
||||||
|
|
|
@ -26,6 +26,11 @@ void GLStateManager::resetScissor() {
|
||||||
OpenGL::setScissor(0, 0, 0, 0);
|
OpenGL::setScissor(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLStateManager::resetStencil() {
|
||||||
|
stencilEnabled = false;
|
||||||
|
OpenGL::disableStencil();
|
||||||
|
}
|
||||||
|
|
||||||
void GLStateManager::resetVAO() {
|
void GLStateManager::resetVAO() {
|
||||||
boundVAO = 0;
|
boundVAO = 0;
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
|
@ -50,4 +55,5 @@ void GLStateManager::reset() {
|
||||||
resetVBO();
|
resetVBO();
|
||||||
resetProgram();
|
resetProgram();
|
||||||
resetScissor();
|
resetScissor();
|
||||||
|
resetStencil();
|
||||||
}
|
}
|
|
@ -207,7 +207,7 @@ void RendererGL::setupBlending() {
|
||||||
|
|
||||||
void RendererGL::setupStencilTest(bool stencilEnable) {
|
void RendererGL::setupStencilTest(bool stencilEnable) {
|
||||||
if (!stencilEnable) {
|
if (!stencilEnable) {
|
||||||
OpenGL::disableStencil();
|
gl.disableStencil();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ void RendererGL::setupStencilTest(bool stencilEnable) {
|
||||||
GL_GREATER,
|
GL_GREATER,
|
||||||
GL_GEQUAL
|
GL_GEQUAL
|
||||||
};
|
};
|
||||||
OpenGL::enableStencil();
|
gl.enableStencil();
|
||||||
|
|
||||||
const u32 stencilConfig = regs[PICA::InternalRegs::StencilTest];
|
const u32 stencilConfig = regs[PICA::InternalRegs::StencilTest];
|
||||||
const u32 stencilFunc = getBits<4, 3>(stencilConfig);
|
const u32 stencilFunc = getBits<4, 3>(stencilConfig);
|
||||||
|
@ -583,7 +583,7 @@ void RendererGL::displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u
|
||||||
gl.disableBlend();
|
gl.disableBlend();
|
||||||
gl.disableDepth();
|
gl.disableDepth();
|
||||||
gl.disableScissor();
|
gl.disableScissor();
|
||||||
OpenGL::disableStencil();
|
gl.disableStencil();
|
||||||
gl.setColourMask(true, true, true, true);
|
gl.setColourMask(true, true, true, true);
|
||||||
gl.useProgram(displayProgram);
|
gl.useProgram(displayProgram);
|
||||||
gl.bindVAO(dummyVAO);
|
gl.bindVAO(dummyVAO);
|
||||||
|
|
Loading…
Add table
Reference in a new issue