Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-01-17 18:05:19 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-17 18:29:20 +0300
commit6eaf51ef3e5b7d37170473449bcda60bad025e67 (patch)
tree4dff167f66b8d2befe0303fff168573ad943379c /source/blender/draw/engines/workbench/shaders
parent9410e5dc97c4f21e19865ca8a9e1e185fcf5a1d4 (diff)
DRW: Use USHORT for vertex color and upload them in linear color to the GPU
This way we remove the need for the srgb boolean uniform and a lot of code complexity. However, mesh update is going to be a bit slower. I did not benchmark the performance impact. This also fix a typo in draw_cache_impl_particles.c and fix hair not using vertex color in workbench. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D6610
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders')
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl21
1 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index 04dd9ab85bb..0a3252f0b9b 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -4,13 +4,18 @@ in vec3 pos;
in vec3 nor;
in vec2 au; /* active texture layer */
# ifdef V3D_SHADING_VERTEX_COLOR
-in vec3 ac; /* active color */
+in vec4 ac; /* active color */
# endif
# define uv au
#else /* HAIR_SHADER */
+
# ifdef V3D_SHADING_TEXTURE_COLOR
uniform samplerBuffer au; /* active texture layer */
# endif
+# ifdef V3D_SHADING_VERTEX_COLOR
+uniform samplerBuffer ac; /* active color layer */
+# endif
+
flat out float hair_rand;
#endif /* HAIR_SHADER */
@@ -37,16 +42,6 @@ float integer_noise(int n)
return (float(nn) / 1073741824.0);
}
-#ifdef V3D_SHADING_VERTEX_COLOR
-vec3 srgb_to_linear_attr(vec3 c)
-{
- c = max(c, vec3(0.0));
- vec3 c1 = c * (1.0 / 12.92);
- vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
- return mix(c1, c2, step(vec3(0.04045), c));
-}
-#endif
-
vec3 workbench_hair_hair_normal(vec3 tan, vec3 binor, float rand)
{
/* To "simulate" anisotropic shading, randomize hair normal per strand. */
@@ -90,7 +85,9 @@ void main()
#ifdef V3D_SHADING_VERTEX_COLOR
# ifndef HAIR_SHADER
- vertexColor = srgb_to_linear_attr(ac);
+ vertexColor = ac.rgb;
+# else
+ vertexColor = hair_get_customdata_vec4(ac).rgb;
# endif
#endif