[Bf-blender-cvs] [0d8b701] viewport_experiments: Forward compatibility: Use triangle strips instead of quads

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


Commit: 0d8b701e2570d4f47c65514df09590d415622f0b
Author: Antony Riakiotakis
Date:   Tue Feb 10 16:20:11 2015 +0100
Branches: viewport_experiments
https://developer.blender.org/rB0d8b701e2570d4f47c65514df09590d415622f0b

Forward compatibility: Use triangle strips instead of quads

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

M	source/blender/editors/render/render_opengl.c
M	source/blender/gpu/intern/gpu_compositing.c
M	source/blender/makesdna/DNA_gpu_types.h

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

diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index aec8c88..c63478b 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -462,7 +462,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
 		 * running notifiers again will overwrite */
 		oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal;
 
-		if (oglrender->v3d->shader_fx & (GPU_FX_DEPTH_OF_FIELD | GPU_FX_DEPTH_OF_FIELD)) {
+		if (oglrender->v3d->shader_fx & (GPU_FX_DEPTH_OF_FIELD | GPU_FX_SSAO)) {
 			oglrender->fx = GPU_create_fx_compositor();
 		}
 	}
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index a44dab7..73c4a31 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -54,8 +54,8 @@
 
 #include "MEM_guardedalloc.h"
 
-static const float fullscreencos[4][2] = {{-1.0f, -1.0f}, {1.0f, -1.0f}, {1.0f, 1.0f}, {-1.0f, 1.0f}};
-static const float fullscreenuvs[4][2] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}};
+static const float fullscreencos[4][2] = {{-1.0f, -1.0f}, {1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}};
+static const float fullscreenuvs[4][2] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}};
 
 struct GPUFX {
 	/* we borrow the term gbuffer from deferred rendering however this is just a regular 
@@ -545,7 +545,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 				GPU_framebuffer_texture_attach(fx->gbuffer, target, 0, NULL);
 			}
 			glDisable(GL_DEPTH_TEST);
-			glDrawArrays(GL_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
 			/* disable bindings */
 			GPU_texture_unbind(src);
@@ -633,7 +633,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 			GPU_texture_bind_as_framebuffer(fx->dof_near_coc_buffer);
 
 			glDisable(GL_DEPTH_TEST);
-			glDrawArrays(GL_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(src);
 			GPU_depth_texture_mode(fx->depth_buffer, true, false);
@@ -678,7 +678,7 @@ 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);
 
 			/* Drawing quad */
-			glDrawArrays(GL_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
 			/* *unbind/detach */
 			GPU_texture_unbind(fx->dof_near_coc_buffer);
@@ -693,7 +693,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 			GPU_shader_uniform_texture(dof_shader_pass2, color_uniform, fx->dof_near_coc_final_buffer);
 
 			GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_blurred_buffer, 0, NULL);
-			glDrawArrays(GL_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 
 			/* *unbind/detach */
 			GPU_depth_texture_mode(fx->depth_buffer, true, false);
@@ -725,7 +725,7 @@ 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_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(fx->dof_near_coc_buffer);
 			GPU_texture_unbind(fx->dof_near_coc_blurred_buffer);
@@ -755,7 +755,7 @@ 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_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(fx->dof_near_coc_final_buffer);
 
@@ -813,7 +813,7 @@ bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, str
 				GPU_framebuffer_texture_attach(fx->gbuffer, target, 0, NULL);
 			}
 			glDisable(GL_DEPTH_TEST);
-			glDrawArrays(GL_QUADS, 0, 4);
+			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 			/* disable bindings */
 			GPU_texture_unbind(fx->dof_near_coc_buffer);
 			GPU_texture_unbind(fx->dof_near_coc_blurred_buffer);
diff --git a/source/blender/makesdna/DNA_gpu_types.h b/source/blender/makesdna/DNA_gpu_types.h
index 21545b1..2874a3c 100644
--- a/source/blender/makesdna/DNA_gpu_types.h
+++ b/source/blender/makesdna/DNA_gpu_types.h
@@ -59,6 +59,5 @@ typedef struct GPUFXOptions {
 /* shaderfx enables */
 #define GPU_FX_DEPTH_OF_FIELD  1
 #define GPU_FX_SSAO           (1 << 1)
-#define GPU_FX_HDR            (1 << 2)
 
 #endif




More information about the Bf-blender-cvs mailing list