diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-10 05:36:27 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-10 05:57:27 +0300 |
commit | 9ad156374f599aa585b3cc49b54a8d48f10c60d6 (patch) | |
tree | aa3fb52f09d5ef1f4f5cfe96b647809858aee41c /source/blender/draw/modes/shaders/common_hair_lib.glsl | |
parent | d77b7b097d3411a0d28e579bb2d67c8dfa8d04c7 (diff) |
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 R9 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
Diffstat (limited to 'source/blender/draw/modes/shaders/common_hair_lib.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/common_hair_lib.glsl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/common_hair_lib.glsl b/source/blender/draw/modes/shaders/common_hair_lib.glsl index 359e4d87b7a..4c540d2b478 100644 --- a/source/blender/draw/modes/shaders/common_hair_lib.glsl +++ b/source/blender/draw/modes/shaders/common_hair_lib.glsl @@ -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; |