[Bf-blender-cvs] [dc506fb] viewport_experiments: Cleanup redundant state changes

Antony Riakiotakis noreply at git.blender.org
Thu Feb 12 16:40:21 CET 2015


Commit: dc506fba9c61702e44032d249cc2a97713be7f4e
Author: Antony Riakiotakis
Date:   Tue Feb 10 16:45:02 2015 +0100
Branches: viewport_experiments
https://developer.blender.org/rBdc506fba9c61702e44032d249cc2a97713be7f4e

Cleanup redundant state changes

===================================================================

M	source/blender/gpu/intern/gpu_compositing.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 9dabbb3..32e1ac8 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -482,6 +482,10 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 		viewvecs[1][2] = vec_far[2] - viewvecs[0][2];
 	}
 
+	/* set invalid color in case shader fails */
+	glColor3f(1.0, 0.0, 1.0);
+	glDisable(GL_DEPTH_TEST);
+
 	/* ssao pass */
 	if (fx->effects & GPU_FX_SSAO) {
 		GPUShader *ssao_shader;
@@ -528,9 +532,6 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 			GPU_texture_bind(fx->ssao_concentric_samples_tex, numslots++);
 			GPU_shader_uniform_texture(ssao_shader, ssao_concentric_tex, fx->ssao_concentric_samples_tex);
 			
-			/* set invalid color in case shader fails */
-			glColor3f(1.0, 0.0, 1.0);
-
 			/* draw */
 			if (passes_left-- == 1) {
 				GPU_framebuffer_texture_unbind(fx->gbuffer, NULL);
@@ -544,7 +545,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 				/* bind the ping buffer to the color buffer */
 				GPU_framebuffer_texture_attach(fx->gbuffer, target, 0, NULL);
 			}
-			glDisable(GL_DEPTH_TEST);
+
 			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
 			/* disable bindings */
@@ -632,7 +633,6 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 			/* binding takes care of setting the viewport to the downsampled size */
 			GPU_texture_bind_as_framebuffer(fx->dof_near_coc_buffer);
 
-			glDisable(GL_DEPTH_TEST);
 			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(src);
@@ -724,7 +724,6 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 
 			GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_final_buffer, 0, NULL);
 
-			glDisable(GL_DEPTH_TEST);
 			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(fx->dof_near_coc_buffer);
@@ -754,7 +753,6 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 
 			GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_buffer, 0, NULL);
 
-			glDisable(GL_DEPTH_TEST);
 			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(fx->dof_near_coc_final_buffer);
@@ -812,7 +810,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 				/* bind the ping buffer to the color buffer */
 				GPU_framebuffer_texture_attach(fx->gbuffer, target, 0, NULL);
 			}
-			glDisable(GL_DEPTH_TEST);
+
 			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(fx->dof_near_coc_buffer);




More information about the Bf-blender-cvs mailing list