mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Implement Reverse Interlaced 3D
This commit is contained in:
		
							parent
							
								
									1bb20571b1
								
							
						
					
					
						commit
						a4f57e6910
					
				
					 6 changed files with 47 additions and 6 deletions
				
			
		|  | @ -311,6 +311,25 @@ void main() { | |||
| } | ||||
| )"; | ||||
| 
 | ||||
| static const char fragment_shader_reverse_interlaced[] = R"( | ||||
| 
 | ||||
| in vec2 frag_tex_coord; | ||||
| out vec4 color; | ||||
| 
 | ||||
| uniform vec4 o_resolution; | ||||
| 
 | ||||
| uniform sampler2D color_texture; | ||||
| uniform sampler2D color_texture_r; | ||||
| 
 | ||||
| void main() { | ||||
|     float screen_row = o_resolution.x * frag_tex_coord.x; | ||||
|     if (int(screen_row) % 2 == 1) | ||||
|         color = texture(color_texture, frag_tex_coord); | ||||
|     else | ||||
|         color = texture(color_texture_r, frag_tex_coord); | ||||
| } | ||||
| )"; | ||||
| 
 | ||||
| /**
 | ||||
|  * Vertex structure that the drawn screen rectangles are composed of. | ||||
|  */ | ||||
|  | @ -705,6 +724,19 @@ void RendererOpenGL::ReloadShader() { | |||
|                 shader_data += shader_text; | ||||
|             } | ||||
|         } | ||||
|     } else if (Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced) { | ||||
|         if (Settings::values.pp_shader_name == "horizontal (builtin)") { | ||||
|             shader_data += fragment_shader_reverse_interlaced; | ||||
|         } else { | ||||
|             std::string shader_text = | ||||
|                 OpenGL::GetPostProcessingShaderCode(true, Settings::values.pp_shader_name); | ||||
|             if (shader_text.empty()) { | ||||
|                 // Should probably provide some information that the shader couldn't load
 | ||||
|                 shader_data += fragment_shader_reverse_interlaced; | ||||
|             } else { | ||||
|                 shader_data += shader_text; | ||||
|             } | ||||
|         } | ||||
|     } else { | ||||
|         if (Settings::values.pp_shader_name == "none (builtin)") { | ||||
|             shader_data += fragment_shader; | ||||
|  | @ -725,7 +757,8 @@ void RendererOpenGL::ReloadShader() { | |||
|     uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix"); | ||||
|     uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture"); | ||||
|     if (Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph || | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::Interlaced) { | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::Interlaced || | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced) { | ||||
|         uniform_color_texture_r = glGetUniformLocation(shader.handle, "color_texture_r"); | ||||
|     } | ||||
|     uniform_i_resolution = glGetUniformLocation(shader.handle, "i_resolution"); | ||||
|  | @ -973,7 +1006,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f | |||
| 
 | ||||
|     const bool stereo_single_screen = | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::Anaglyph || | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::Interlaced; | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::Interlaced || | ||||
|         Settings::values.render_3d == Settings::StereoRenderOption::ReverseInterlaced; | ||||
| 
 | ||||
|     // Bind a second texture for the right eye if in Anaglyph mode
 | ||||
|     if (stereo_single_screen) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue