mirror of
				https://git.suyu.dev/suyu/suyu.git
				synced 2025-11-04 12:34:39 +08:00 
			
		
		
		
	gl_state_tracker: Implement dirty flags for logic op
This commit is contained in:
		
							parent
							
								
									13afd0e5b0
								
							
						
					
					
						commit
						bf1a1d989f
					
				@ -1213,11 +1213,19 @@ void RasterizerOpenGL::SyncBlendState() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RasterizerOpenGL::SyncLogicOpState() {
 | 
			
		||||
    const auto& regs = system.GPU().Maxwell3D().regs;
 | 
			
		||||
    auto& gpu = system.GPU().Maxwell3D();
 | 
			
		||||
    auto& flags = gpu.dirty.flags;
 | 
			
		||||
    if (!flags[Dirty::LogicOp]) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    flags[Dirty::LogicOp] = false;
 | 
			
		||||
 | 
			
		||||
    oglEnable(GL_COLOR_LOGIC_OP, regs.logic_op.enable);
 | 
			
		||||
    const auto& regs = gpu.regs;
 | 
			
		||||
    if (regs.logic_op.enable) {
 | 
			
		||||
        glEnable(GL_COLOR_LOGIC_OP);
 | 
			
		||||
        glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.operation));
 | 
			
		||||
    } else {
 | 
			
		||||
        glDisable(GL_COLOR_LOGIC_OP);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -197,6 +197,10 @@ void SetupDirtyFramebufferSRGB(Tables& tables) {
 | 
			
		||||
    tables[0][OFF(framebuffer_srgb)] = FramebufferSRGB;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SetupDirtyLogicOp(Tables& tables) {
 | 
			
		||||
    FillBlock(tables[0], OFF(logic_op), NUM(logic_op), LogicOp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SetupDirtyMisc(Tables& tables) {
 | 
			
		||||
    auto& table = tables[0];
 | 
			
		||||
 | 
			
		||||
@ -231,6 +235,7 @@ void StateTracker::Initialize() {
 | 
			
		||||
    SetupDirtyMultisampleControl(tables);
 | 
			
		||||
    SetupDirtyRasterizeEnable(tables);
 | 
			
		||||
    SetupDirtyFramebufferSRGB(tables);
 | 
			
		||||
    SetupDirtyLogicOp(tables);
 | 
			
		||||
    SetupDirtyMisc(tables);
 | 
			
		||||
 | 
			
		||||
    auto& store = dirty.on_write_stores;
 | 
			
		||||
 | 
			
		||||
@ -68,6 +68,7 @@ enum : u8 {
 | 
			
		||||
    MultisampleControl,
 | 
			
		||||
    RasterizeEnable,
 | 
			
		||||
    FramebufferSRGB,
 | 
			
		||||
    LogicOp,
 | 
			
		||||
 | 
			
		||||
    Last
 | 
			
		||||
};
 | 
			
		||||
@ -159,6 +160,11 @@ public:
 | 
			
		||||
        flags[OpenGL::Dirty::FramebufferSRGB] = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void NotifyLogicOp() {
 | 
			
		||||
        auto& flags = system.GPU().Maxwell3D().dirty.flags;
 | 
			
		||||
        flags[OpenGL::Dirty::LogicOp] = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Core::System& system;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -589,6 +589,7 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
 | 
			
		||||
    state_tracker.NotifyPolygonOffset();
 | 
			
		||||
    state_tracker.NotifyRasterizeEnable();
 | 
			
		||||
    state_tracker.NotifyFramebufferSRGB();
 | 
			
		||||
    state_tracker.NotifyLogicOp();
 | 
			
		||||
 | 
			
		||||
    program_manager.UseVertexShader(vertex_program.handle);
 | 
			
		||||
    program_manager.UseGeometryShader(0);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user