mirror of
				https://git.tardis.systems/mirrors/yuzu
				synced 2025-11-04 12:45:03 +01:00 
			
		
		
		
	gl_state_tracker: Implement dirty flags for depth clamp enabling
This commit is contained in:
		
							parent
							
								
									3ce66776ec
								
							
						
					
					
						commit
						2eeea90713
					
				@ -493,6 +493,7 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
 | 
				
			|||||||
    SyncFragmentColorClampState();
 | 
					    SyncFragmentColorClampState();
 | 
				
			||||||
    SyncMultiSampleState();
 | 
					    SyncMultiSampleState();
 | 
				
			||||||
    SyncDepthTestState();
 | 
					    SyncDepthTestState();
 | 
				
			||||||
 | 
					    SyncDepthClamp();
 | 
				
			||||||
    SyncStencilTestState();
 | 
					    SyncStencilTestState();
 | 
				
			||||||
    SyncBlendState();
 | 
					    SyncBlendState();
 | 
				
			||||||
    SyncLogicOpState();
 | 
					    SyncLogicOpState();
 | 
				
			||||||
@ -967,11 +968,16 @@ void RasterizerOpenGL::SyncViewport() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RasterizerOpenGL::SyncDepthClamp() {
 | 
					void RasterizerOpenGL::SyncDepthClamp() {
 | 
				
			||||||
    const auto& regs = system.GPU().Maxwell3D().regs;
 | 
					    auto& gpu = system.GPU().Maxwell3D();
 | 
				
			||||||
    const auto& state = regs.view_volume_clip_control;
 | 
					    auto& flags = gpu.dirty.flags;
 | 
				
			||||||
 | 
					    if (!flags[Dirty::DepthClampEnabled]) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    flags[Dirty::DepthClampEnabled] = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const auto& state = gpu.regs.view_volume_clip_control;
 | 
				
			||||||
    UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near,
 | 
					    UNIMPLEMENTED_IF_MSG(state.depth_clamp_far != state.depth_clamp_near,
 | 
				
			||||||
                         "Unimplemented Depth clamp separation!");
 | 
					                         "Unimplemented depth clamp separation!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near);
 | 
					    oglEnable(GL_DEPTH_CLAMP, state.depth_clamp_far || state.depth_clamp_near);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -217,6 +217,10 @@ void SetupDirtyClipControl(Tables& tables) {
 | 
				
			|||||||
    table[OFF(depth_mode)] = ClipControl;
 | 
					    table[OFF(depth_mode)] = ClipControl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SetupDirtyDepthClampEnabled(Tables& tables) {
 | 
				
			||||||
 | 
					    tables[0][OFF(view_volume_clip_control)] = DepthClampEnabled;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SetupDirtyMisc(Tables& tables) {
 | 
					void SetupDirtyMisc(Tables& tables) {
 | 
				
			||||||
    auto& table = tables[0];
 | 
					    auto& table = tables[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -255,6 +259,7 @@ void StateTracker::Initialize() {
 | 
				
			|||||||
    SetupDirtyFragmentClampColor(tables);
 | 
					    SetupDirtyFragmentClampColor(tables);
 | 
				
			||||||
    SetupDirtyPointSize(tables);
 | 
					    SetupDirtyPointSize(tables);
 | 
				
			||||||
    SetupDirtyClipControl(tables);
 | 
					    SetupDirtyClipControl(tables);
 | 
				
			||||||
 | 
					    SetupDirtyDepthClampEnabled(tables);
 | 
				
			||||||
    SetupDirtyMisc(tables);
 | 
					    SetupDirtyMisc(tables);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto& store = dirty.on_write_stores;
 | 
					    auto& store = dirty.on_write_stores;
 | 
				
			||||||
 | 
				
			|||||||
@ -75,6 +75,7 @@ enum : u8 {
 | 
				
			|||||||
    FragmentClampColor,
 | 
					    FragmentClampColor,
 | 
				
			||||||
    PointSize,
 | 
					    PointSize,
 | 
				
			||||||
    ClipControl,
 | 
					    ClipControl,
 | 
				
			||||||
 | 
					    DepthClampEnabled,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Last
 | 
					    Last
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user