[Bf-blender-cvs] [d027df3add8] master: Fix T58387 Voronoi(Cells) does not work on eevee (amd + windows)

Clément Foucault noreply at git.blender.org
Thu Mar 28 22:09:20 CET 2019


Commit: d027df3add87a1f0a3356d21344a0a160c8ce43d
Author: Clément Foucault
Date:   Thu Mar 28 18:14:04 2019 +0100
Branches: master
https://developer.blender.org/rBd027df3add87a1f0a3356d21344a0a160c8ce43d

Fix T58387 Voronoi(Cells) does not work on eevee (amd + windows)

Thanks to Gabor Fekete for helping finding the issue.

Was caused by uninitialized variable. Also took the oportunity to use comp
swizzling instead of multiple assignment.

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

M	source/blender/gpu/shaders/gpu_shader_material.glsl

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

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];



More information about the Bf-blender-cvs mailing list