diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-16 17:43:41 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-17 14:38:42 +0300 |
commit | b526221315e5734306ef3bf5e520529d7f9e24a2 (patch) | |
tree | 112199cadf35036f3b6452ded533ec26d146e4ff /source/blender/gpu | |
parent | b23af112d2439a8d6b993fbf7daa3b527cfb48c8 (diff) |
Eevee: Remove the Subsurface Render checkbox
This is to simplify the usage of SSS.
Now it automatically detect if there is any SSS material in the view and
allocate the needed buffer if any.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 4f90155b88c..fde60fd387d 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -36,6 +36,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BLI_string.h" +#include "BLI_string_utils.h" #include "BKE_main.h" #include "BKE_node.h" @@ -125,7 +126,6 @@ struct GPUMaterial { enum { GPU_DOMAIN_SURFACE = (1 << 0), GPU_DOMAIN_VOLUME = (1 << 1), - GPU_DOMAIN_SSS = (1 << 2), }; /* Functions */ @@ -682,6 +682,10 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene, SET_FLAG_FROM_TEST(mat->domain, has_volume_output, GPU_DOMAIN_VOLUME); if (mat->outlink) { + /* HACK: this is only for eevee. We add the define here after the nodetree evaluation. */ + if (GPU_material_flag_get(mat, GPU_MATFLAG_SSS)) { + defines = BLI_string_joinN(defines, "#define USE_SSS\n"); + } /* Prune the unused nodes and extract attributes before compiling so the * generated VBOs are ready to accept the future shader. */ GPU_nodes_prune(&mat->nodes, mat->outlink); @@ -697,6 +701,10 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene, frag_lib, defines); + if (GPU_material_flag_get(mat, GPU_MATFLAG_SSS)) { + MEM_freeN((char *)defines); + } + if (mat->pass == NULL) { /* We had a cache hit and the shader has already failed to compile. */ mat->status = GPU_MAT_FAILED; |