Fix T60171: Hair Particles Not Displaying in Viewport

This patch fixes T60171 by adding a dummy read from the `dummy` vertex attribute to `hair_get_pos_tan_binor_time` in `common_hair_lib.glsl`. Confirmed to work on my machine (macOS 10.14.4 Beta, Radeon R​9 M295X).

According to my experiments regarding this issue, the problem is triggered when all of the following conditions are met: (a) the shader has no vertex reads; (b) the index buffer is ≥ 256KiB. I can't really give an explanation of this misbehavior because of the video driver's closed-source nature.

Reviewers: fclem

Reviewed By: fclem

Subscribers: zeddb

Maniphest Tasks: T60171

Differential Revision: https://developer.blender.org/D4490
This commit is contained in:
Clément Foucault 2019-03-10 03:36:27 +01:00
parent d77b7b097d
commit 9ad156374f
Notes: blender-bot 2023-02-14 06:21:59 +01:00
Referenced by issue #60171, Hair Particles Not Displaying in Viewport
4 changed files with 14 additions and 3 deletions

@ -1 +1 @@
Subproject commit 29c2218102135522d6e2cd4bba7ab47d7241ab8a
Subproject commit f81ed052157aff3979763cf25840032d11d261b6

@ -1 +1 @@
Subproject commit c94604993b3e0bfbc733861e890aff18513e02b4
Subproject commit 5f7fba0565a7c9ae93eae31a08fc9bbbd16d333a

@ -1 +1 @@
Subproject commit 3a80a18ea081ff93f4b3672120b446b7adc93e81
Subproject commit fecc0db5600405a0c14c70120ae279222861ef80

View File

@ -136,6 +136,10 @@ float hair_shaperadius(float shape, float root, float tip, float time)
return (radius * (root - tip)) + tip;
}
#ifdef OS_MAC
in float dummy;
#endif
void hair_get_pos_tan_binor_time(
bool is_persp, mat4 invmodel_mat, vec3 camera_pos, vec3 camera_z,
out vec3 wpos, out vec3 wtan, out vec3 wbinor, out float time, out float thickness, out float thick_time)
@ -144,6 +148,13 @@ void hair_get_pos_tan_binor_time(
vec4 data = texelFetch(hairPointBuffer, id);
wpos = data.point_position;
time = data.point_time;
#ifdef OS_MAC
/* Generate a dummy read to avoid the driver bug with shaders having no
* vertex reads on macOS (T60171) */
wpos.y += dummy * 0.0;
#endif
if (time == 0.0) {
/* Hair root */
wtan = texelFetch(hairPointBuffer, id + 1).point_position - wpos;