mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 23:25:40 +12:00
renderer_gl: Implement logic op
This commit is contained in:
parent
95a8917589
commit
6f7874227c
3 changed files with 28 additions and 1 deletions
|
@ -53,6 +53,7 @@ namespace PICA {
|
||||||
// Framebuffer registers
|
// Framebuffer registers
|
||||||
ColourOperation = 0x100,
|
ColourOperation = 0x100,
|
||||||
BlendFunc = 0x101,
|
BlendFunc = 0x101,
|
||||||
|
LogicOp = 0x102,
|
||||||
BlendColour = 0x103,
|
BlendColour = 0x103,
|
||||||
AlphaTestConfig = 0x104,
|
AlphaTestConfig = 0x104,
|
||||||
StencilTest = 0x105,
|
StencilTest = 0x105,
|
||||||
|
@ -294,4 +295,4 @@ namespace PICA {
|
||||||
GeometryPrimitive = 3,
|
GeometryPrimitive = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace PICA
|
} // namespace PICA
|
||||||
|
|
|
@ -62,6 +62,7 @@ class RendererGL final : public Renderer {
|
||||||
MAKE_LOG_FUNCTION(log, rendererLogger)
|
MAKE_LOG_FUNCTION(log, rendererLogger)
|
||||||
void setupBlending();
|
void setupBlending();
|
||||||
void setupStencilTest(bool stencilEnable);
|
void setupStencilTest(bool stencilEnable);
|
||||||
|
void setupLogicOp();
|
||||||
void bindDepthBuffer();
|
void bindDepthBuffer();
|
||||||
void setupTextureEnvState();
|
void setupTextureEnvState();
|
||||||
void bindTexturesToSlots();
|
void bindTexturesToSlots();
|
||||||
|
|
|
@ -250,6 +250,30 @@ void RendererGL::setupStencilTest(bool stencilEnable) {
|
||||||
glStencilOp(stencilOps[stencilFailOp], stencilOps[depthFailOp], stencilOps[passOp]);
|
glStencilOp(stencilOps[stencilFailOp], stencilOps[depthFailOp], stencilOps[passOp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RendererGL::setupLogicOp() {
|
||||||
|
const u32 logicOp = getBits<0, 4>(regs[PICA::InternalRegs::LogicOp]);
|
||||||
|
static constexpr std::array<GLenum, 16> logicOps = {
|
||||||
|
GL_CLEAR,
|
||||||
|
GL_AND,
|
||||||
|
GL_AND_REVERSE,
|
||||||
|
GL_COPY,
|
||||||
|
GL_SET,
|
||||||
|
GL_COPY_INVERTED,
|
||||||
|
GL_NOOP,
|
||||||
|
GL_INVERT,
|
||||||
|
GL_NAND,
|
||||||
|
GL_OR,
|
||||||
|
GL_NOR,
|
||||||
|
GL_XOR,
|
||||||
|
GL_EQUIV,
|
||||||
|
GL_AND_INVERTED,
|
||||||
|
GL_OR_REVERSE,
|
||||||
|
GL_OR_INVERTED,
|
||||||
|
};
|
||||||
|
|
||||||
|
glLogicOp(logicOps[logicOp]);
|
||||||
|
}
|
||||||
|
|
||||||
void RendererGL::setupTextureEnvState() {
|
void RendererGL::setupTextureEnvState() {
|
||||||
// TODO: Only update uniforms when the TEV config changed. Use an UBO potentially.
|
// TODO: Only update uniforms when the TEV config changed. Use an UBO potentially.
|
||||||
|
|
||||||
|
@ -427,6 +451,7 @@ void RendererGL::drawVertices(PICA::PrimType primType, std::span<const Vertex> v
|
||||||
}
|
}
|
||||||
|
|
||||||
setupStencilTest(stencilEnable);
|
setupStencilTest(stencilEnable);
|
||||||
|
setupLogicOp();
|
||||||
|
|
||||||
vbo.bufferVertsSub(vertices);
|
vbo.bufferVertsSub(vertices);
|
||||||
OpenGL::draw(primitiveTopology, GLsizei(vertices.size()));
|
OpenGL::draw(primitiveTopology, GLsizei(vertices.size()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue