[Bf-blender-cvs] [b05fb30] strand_gpu: Better fix for uninitialized variables.
Lukas Tönne
noreply at git.blender.org
Sun Jul 17 17:29:34 CEST 2016
Commit: b05fb3061403560cced06efe12002a9d72b5235f
Author: Lukas Tönne
Date: Sun Jul 17 17:28:39 2016 +0200
Branches: strand_gpu
https://developer.blender.org/rBb05fb3061403560cced06efe12002a9d72b5235f
Better fix for uninitialized variables.
The previous one probably only works because there are currently no more
than 3 valid control curves for each fiber, so the 4th one resets the
cumulative values to 0.0.
===================================================================
M source/blender/gpu/shaders/gpu_shader_strand_util.glsl
===================================================================
diff --git a/source/blender/gpu/shaders/gpu_shader_strand_util.glsl b/source/blender/gpu/shaders/gpu_shader_strand_util.glsl
index 1e740ec..79687b7 100644
--- a/source/blender/gpu/shaders/gpu_shader_strand_util.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_strand_util.glsl
@@ -47,13 +47,12 @@ void interpolate_vertex(int fiber_index, float curve_param,
loc = vec3(0.0, 0.0, 0.0);
nor = vec3(0.0, 0.0, 0.0);
- vec3 cloc[4], cnor[4], ctang[4];
- int cnum_verts[4];
+ vec3 cloc[4] = vec3[4]( vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0) );
+ vec3 cnor[4] = vec3[4]( vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0) );
+ vec3 ctang[4] = vec3[4]( vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0) );
+ int cnum_verts[4] = int[4]( 0, 0, 0, 0 );
for (int k = 0; k < 4; ++k) {
if (!control_valid[k]) {
- cloc[k] = vec3(0.0, 0.0, 0.0);
- cnor[k] = vec3(0.0, 0.0, 0.0);
- ctang[k] = vec3(0.0, 0.0, 0.0);
continue;
}
More information about the Bf-blender-cvs
mailing list