diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-28 20:14:04 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-29 00:08:54 +0300 |
commit | d027df3add87a1f0a3356d21344a0a160c8ce43d (patch) | |
tree | 4ac925e60f57e2ecf25e219132eb70a8583f181c /source/blender/gpu | |
parent | a89780abb50101db342a9c49ca271833b5e682f1 (diff) |
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.
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]; |