1
0
Fork 0
forked from suyu/suyu

gl_state: Remove logic op tracker

This commit is contained in:
ReinUsesLisp 2019-12-25 20:21:53 -03:00
parent 915d73f3b8
commit 42708c762e
4 changed files with 5 additions and 24 deletions

View file

@ -1156,15 +1156,10 @@ void RasterizerOpenGL::SyncBlendState() {
void RasterizerOpenGL::SyncLogicOpState() { void RasterizerOpenGL::SyncLogicOpState() {
const auto& regs = system.GPU().Maxwell3D().regs; const auto& regs = system.GPU().Maxwell3D().regs;
state.logic_op.enabled = regs.logic_op.enable != 0; oglEnable(GL_COLOR_LOGIC_OP, regs.logic_op.enable);
if (regs.logic_op.enable) {
if (!state.logic_op.enabled) glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.operation));
return; }
ASSERT_MSG(regs.blend.enable[0] == 0,
"Blending and logic op can't be enabled at the same time.");
state.logic_op.operation = MaxwellToGL::LogicOp(regs.logic_op.operation);
} }
void RasterizerOpenGL::SyncScissorTest(OpenGLState& current_state) { void RasterizerOpenGL::SyncScissorTest(OpenGLState& current_state) {

View file

@ -332,14 +332,6 @@ void OpenGLState::ApplyBlending() {
cur_state.independant_blend.enabled = independant_blend.enabled; cur_state.independant_blend.enabled = independant_blend.enabled;
} }
void OpenGLState::ApplyLogicOp() {
Enable(GL_COLOR_LOGIC_OP, cur_state.logic_op.enabled, logic_op.enabled);
if (UpdateValue(cur_state.logic_op.operation, logic_op.operation)) {
glLogicOp(logic_op.operation);
}
}
void OpenGLState::ApplyClipControl() { void OpenGLState::ApplyClipControl() {
if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode), if (UpdateTie(std::tie(cur_state.clip_control.origin, cur_state.clip_control.depth_mode),
std::tie(clip_control.origin, clip_control.depth_mode))) { std::tie(clip_control.origin, clip_control.depth_mode))) {
@ -400,7 +392,6 @@ void OpenGLState::Apply() {
ApplyDepth(); ApplyDepth();
ApplyPrimitiveRestart(); ApplyPrimitiveRestart();
ApplyBlending(); ApplyBlending();
ApplyLogicOp();
ApplyTextures(); ApplyTextures();
ApplySamplers(); ApplySamplers();
ApplyImages(); ApplyImages();

View file

@ -81,11 +81,6 @@ public:
bool enabled = false; bool enabled = false;
} independant_blend; } independant_blend;
struct {
bool enabled = false; // GL_LOGIC_OP_MODE
GLenum operation = GL_COPY;
} logic_op;
static constexpr std::size_t NumSamplers = 32 * 5; static constexpr std::size_t NumSamplers = 32 * 5;
static constexpr std::size_t NumImages = 8 * 5; static constexpr std::size_t NumImages = 8 * 5;
std::array<GLuint, NumSamplers> textures = {}; std::array<GLuint, NumSamplers> textures = {};
@ -154,7 +149,6 @@ public:
void ApplyTargetBlending(std::size_t target, bool force); void ApplyTargetBlending(std::size_t target, bool force);
void ApplyGlobalBlending(); void ApplyGlobalBlending();
void ApplyBlending(); void ApplyBlending();
void ApplyLogicOp();
void ApplyTextures(); void ApplyTextures();
void ApplySamplers(); void ApplySamplers();
void ApplyImages(); void ApplyImages();

View file

@ -574,6 +574,7 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
// TODO: Signal state tracker about these changes // TODO: Signal state tracker about these changes
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glDisable(GL_COLOR_LOGIC_OP);
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_POLYGON_OFFSET_FILL);
glCullFace(GL_BACK); glCullFace(GL_BACK);