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 fragment color clamp
This commit is contained in:
		
							parent
							
								
									bf1a1d989f
								
							
						
					
					
						commit
						231601763c
					
				@ -1149,8 +1149,14 @@ void RasterizerOpenGL::SyncMultiSampleState() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RasterizerOpenGL::SyncFragmentColorClampState() {
 | 
					void RasterizerOpenGL::SyncFragmentColorClampState() {
 | 
				
			||||||
    const auto& regs = system.GPU().Maxwell3D().regs;
 | 
					    auto& gpu = system.GPU().Maxwell3D();
 | 
				
			||||||
    glClampColor(GL_CLAMP_FRAGMENT_COLOR, regs.frag_color_clamp ? GL_TRUE : GL_FALSE);
 | 
					    auto& flags = gpu.dirty.flags;
 | 
				
			||||||
 | 
					    if (!flags[Dirty::FragmentClampColor]) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    flags[Dirty::FragmentClampColor] = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    glClampColor(GL_CLAMP_FRAGMENT_COLOR, gpu.regs.frag_color_clamp ? GL_TRUE : GL_FALSE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RasterizerOpenGL::SyncBlendState() {
 | 
					void RasterizerOpenGL::SyncBlendState() {
 | 
				
			||||||
 | 
				
			|||||||
@ -201,6 +201,10 @@ void SetupDirtyLogicOp(Tables& tables) {
 | 
				
			|||||||
    FillBlock(tables[0], OFF(logic_op), NUM(logic_op), LogicOp);
 | 
					    FillBlock(tables[0], OFF(logic_op), NUM(logic_op), LogicOp);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SetupDirtyFragmentClampColor(Tables& tables) {
 | 
				
			||||||
 | 
					    tables[0][OFF(frag_color_clamp)] = FragmentClampColor;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SetupDirtyMisc(Tables& tables) {
 | 
					void SetupDirtyMisc(Tables& tables) {
 | 
				
			||||||
    auto& table = tables[0];
 | 
					    auto& table = tables[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -236,6 +240,7 @@ void StateTracker::Initialize() {
 | 
				
			|||||||
    SetupDirtyRasterizeEnable(tables);
 | 
					    SetupDirtyRasterizeEnable(tables);
 | 
				
			||||||
    SetupDirtyFramebufferSRGB(tables);
 | 
					    SetupDirtyFramebufferSRGB(tables);
 | 
				
			||||||
    SetupDirtyLogicOp(tables);
 | 
					    SetupDirtyLogicOp(tables);
 | 
				
			||||||
 | 
					    SetupDirtyFragmentClampColor(tables);
 | 
				
			||||||
    SetupDirtyMisc(tables);
 | 
					    SetupDirtyMisc(tables);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto& store = dirty.on_write_stores;
 | 
					    auto& store = dirty.on_write_stores;
 | 
				
			||||||
 | 
				
			|||||||
@ -69,6 +69,7 @@ enum : u8 {
 | 
				
			|||||||
    RasterizeEnable,
 | 
					    RasterizeEnable,
 | 
				
			||||||
    FramebufferSRGB,
 | 
					    FramebufferSRGB,
 | 
				
			||||||
    LogicOp,
 | 
					    LogicOp,
 | 
				
			||||||
 | 
					    FragmentClampColor,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Last
 | 
					    Last
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user