diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index c58758dd2e1..e0d381e6f8b 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -2789,18 +2789,13 @@ void node_tex_voronoi(vec3 co, float scale, float exponent, float coloring, floa { vec3 p = co * scale; int xx, yy, zz, xi, yi, zi; - float da[4]; - vec3 pa[4]; + vec4 da = vec4(1e10); + vec3 pa[4] = vec3[4](vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0)); xi = floor_to_int(p[0]); yi = floor_to_int(p[1]); zi = floor_to_int(p[2]); - da[0] = 1e+10; - da[1] = 1e+10; - da[2] = 1e+10; - da[3] = 1e+10; - for (xx = xi - 1; xx <= xi + 1; xx++) { for (yy = yi - 1; yy <= yi + 1; yy++) { for (zz = zi - 1; zz <= zi + 1; zz++) { @@ -2824,18 +2819,16 @@ void node_tex_voronoi(vec3 co, float scale, float exponent, float coloring, floa vp += vec3(xx, yy, zz); if (d < da[0]) { - da[3] = da[2]; - da[2] = da[1]; - da[1] = da[0]; + da.yzw = da.xyz; da[0] = d; + pa[3] = pa[2]; pa[2] = pa[1]; pa[1] = pa[0]; pa[0] = vp; } else if (d < da[1]) { - da[3] = da[2]; - da[2] = da[1]; + da.zw = da.yz; da[1] = d; pa[3] = pa[2]; |