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>2018-04-06 11:09:23 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-04-06 11:25:53 +0300
commit4a73127a2b11056236c40e85ceb75230f2b4888d (patch)
tree97ff1df3d2c092afecf1c4032765600762681a68 /source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl
parent80d4d713607aafa69a4fde15cc1cdadc0e167abf (diff)
UI: Perf: Improve ui_draw_dropshadow.
Replace the 12 iterations of UI_draw_roundbox_4fv with only one batch. This mean less overdraw and less drawcalls. I had to hack the opacity falloff curve manually to get approximatly the same result as previous technique. I'm sure with a bit more brain power somebody could find the perfect function.
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl
new file mode 100644
index 00000000000..7587b2fc18a
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl
@@ -0,0 +1,13 @@
+
+in float shadowFalloff;
+
+out vec4 fragColor;
+
+uniform float alpha;
+
+void main()
+{
+ fragColor = vec4(0.0);
+ /* Manual curve fit of the falloff curve of previous drawing method. */
+ fragColor.a = alpha * (shadowFalloff * shadowFalloff * 0.722 + shadowFalloff * 0.277);
+} \ No newline at end of file