Blender Git Loki

Git Commits -> Revision 5d215d5

Revision 5d215d5 by Michael Möller (master)
January 29, 2021, 16:08 (GMT)
EEVEE: Fix GPUNodeLink memory leak for displacement nodes using SHD_SPACE_WORLD

When the displacement space is set to SHD_SPACE_WORLD, the GLSL method
"node_displacement_world" is used instead of the "node_displacement_object" method. The two GLSL methods:
```
void node_displacement_object(
float height, float midlevel, float scale, vec3 N, mat4 obmat, out vec3 result)
{
N = (vec4(N, 0.0) * obmat).xyz;
result = (height - midlevel) * scale * normalize(N);
result = (obmat * vec4(result, 0.0)).xyz;
}

void node_displacement_world(float height, float midlevel, float scale, vec3 N, out vec3 result)
{
result = (height - midlevel) * scale * normalize(N);
}
```
In contrast to the "node_displacement_object" method, the "node_displacement_world"
does not require an "obmat" parameter. Attempting to still pass "GPU_builtin(GPU_OBJECT_MATRIX)"
as additional parameter will result in a memory leak. The "GPUNodeLink" allocated in
the "GPU_builtin" method will never get released.

Fixes T83941 Memory leak when using the Displacement shader node in Eevee with the displacement
space set to "World Space"

Commit Details:

Full Hash: 5d215d522541e32b9e33e92f836d2cf8eb6080c2
Parent Commit: b3fc885
Committed By: Clément Foucault
Lines Changed: +1, -2

1 Modified Path:

/source/blender/nodes/shader/nodes/node_shader_displacement.c (+1, -2) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021