[OpenGL] More efficient colour mask handling
This commit is contained in:
@@ -22,12 +22,16 @@ struct GLStateManager {
|
||||
bool depthEnabled;
|
||||
bool scissorEnabled;
|
||||
|
||||
// Colour mask
|
||||
bool redMask, greenMask, blueMask, alphaMask;
|
||||
|
||||
GLuint boundVAO;
|
||||
GLuint boundVBO;
|
||||
GLuint currentProgram;
|
||||
|
||||
void reset();
|
||||
void resetBlend();
|
||||
void resetColourMask();
|
||||
void resetDepth();
|
||||
void resetVAO();
|
||||
void resetVBO();
|
||||
@@ -97,6 +101,17 @@ struct GLStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
void setColourMask(bool r, bool g, bool b, bool a) {
|
||||
if (r != redMask || g != greenMask || b != blueMask || a != alphaMask) {
|
||||
r = redMask;
|
||||
g = greenMask;
|
||||
b = blueMask;
|
||||
a = alphaMask;
|
||||
|
||||
glColorMask(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
void bindVAO(const OpenGL::VertexArray& vao) { bindVAO(vao.handle()); }
|
||||
void bindVBO(const OpenGL::VertexBuffer& vbo) { bindVBO(vbo.handle()); }
|
||||
void useProgram(const OpenGL::Program& program) { useProgram(program.handle()); }
|
||||
|
||||
Reference in New Issue
Block a user