[Bf-blender-cvs] [a4f35de] viewport_experiments: Use the correct shaders and varyings

Antony Riakiotakis noreply at git.blender.org
Wed Oct 29 18:31:28 CET 2014


Commit: a4f35de02636edad38d6b1dc38709aa66b82ae81
Author: Antony Riakiotakis
Date:   Wed Oct 29 18:08:22 2014 +0100
Branches: viewport_experiments
https://developer.blender.org/rBa4f35de02636edad38d6b1dc38709aa66b82ae81

Use the correct shaders and varyings

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

M	source/blender/gpu/intern/gpu_extensions.c
M	source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl

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

diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 73132d4..489b80f 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -83,6 +83,7 @@ extern char datatoc_gpu_shader_sep_gaussian_blur_frag_glsl[];
 extern char datatoc_gpu_shader_fx_vert_glsl[];
 extern char datatoc_gpu_shader_fx_ssao_frag_glsl[];
 extern char datatoc_gpu_shader_fx_dof_frag_glsl[];
+extern char datatoc_gpu_shader_fx_dof_vert_glsl[];
 extern char datatoc_gpu_shader_fx_lib_glsl[];
 
 typedef struct GPUShaders {
@@ -1586,11 +1587,11 @@ GPUShader *GPU_shader_get_builtin_fx_shader(int effects, bool persp)
 			GG.shaders.fx_shaders[offset] = GPU_shader_create(datatoc_gpu_shader_fx_vert_glsl, datatoc_gpu_shader_fx_ssao_frag_glsl, datatoc_gpu_shader_fx_lib_glsl, defines);
 		else if (effects == GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_ONE) {
 			strcat(defines, "#define FIRST_PASS\n");
-			GG.shaders.fx_shaders[offset] = GPU_shader_create(datatoc_gpu_shader_fx_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, datatoc_gpu_shader_fx_lib_glsl, defines);
+			GG.shaders.fx_shaders[offset] = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, datatoc_gpu_shader_fx_lib_glsl, defines);
 		}
 		else if (effects == GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_TWO) {
 			strcat(defines, "#define SECOND_PASS\n");
-			GG.shaders.fx_shaders[offset] = GPU_shader_create(datatoc_gpu_shader_fx_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, datatoc_gpu_shader_fx_lib_glsl, defines);
+			GG.shaders.fx_shaders[offset] = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, datatoc_gpu_shader_fx_lib_glsl, defines);
 		}
 	}
 	
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
index a3a47d7..c30312d 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
@@ -46,10 +46,10 @@ void first_pass()
 	vec2 offset_row = vec2(0.0, 2.0 * invrendertargetdim.y);
 
 	/* heavily blur the image */
-	vec4 color = texture2D(colorbuffer, color_uv1.xy);
-	color += texture2D(colorbuffer, color_uv1.xy + offset_row);
-	color += texture2D(colorbuffer, color_uv2.xy);
-	color += texture2D(colorbuffer, color_uv2.xy + offset_row);
+	vec4 color = texture2D(colorbuffer, color_uv1);
+	color += texture2D(colorbuffer, color_uv1 + offset_row);
+	color += texture2D(colorbuffer, color_uv2);
+	color += texture2D(colorbuffer, color_uv2 + offset_row);
 	color /= 4.0;
 
 	float zdepth = get_view_space_z_from_depth(viewvecs[0].z, viewvecs[1].z, depth);
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
index ad82d3f..d4e9f04 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
@@ -21,7 +21,7 @@ void vert_dof_first_pass()
 
 	/* we offset the texture coordinates by 1.5 pixel, then we reuse that to sample the surrounding pixels */
 	color_uv1 = gl_MultiTexCoord0.xy + vec2(-1.5, -1.5) * invrendertargetdim;
-	color_uv1 = gl_MultiTexCoord0.xy + vec2(0.5, -1.5) * invrendertargetdim;
+	color_uv2 = gl_MultiTexCoord0.xy + vec2(0.5, -1.5) * invrendertargetdim;
 
 	gl_Position = gl_Vertex;
 }




More information about the Bf-blender-cvs mailing list