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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-02-06 14:33:37 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-02-06 14:37:08 +0300
commit89f3837d687c5b685fbea5e7e71242287a735b76 (patch)
tree9bfcd6a4939608e0d90a89aeafc33050cd14cb04 /source/blender/modifiers
parent385fe4f0ce8337e21ca8304c78718b597eea15ab (diff)
Displace modifier: Use special version of texture sampling
This version will give less spin locks and now well-tested by render engines. This should reduce amount of threading overhead when having multiple objects with displace modifier enabled. In the future this will also help us threading the modifier. There are more modifiers which could benefit from this, but let's first investigate the new behavior with one of them.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 08d118a2026..48e5d34288d 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -42,6 +42,7 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
+#include "BKE_image.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_texture.h"
@@ -216,6 +217,7 @@ static void displaceModifier_do(
float (*vert_clnors)[3] = NULL;
float local_mat[4][4];
const bool use_global_direction = dmd->space == MOD_DISP_SPACE_GLOBAL;
+ struct ImagePool *pool = NULL;
if (!dmd->texture && dmd->direction == MOD_DISP_DIR_RGB_XYZ) return;
if (dmd->strength == 0.0f) return;
@@ -259,6 +261,10 @@ static void displaceModifier_do(
copy_m4_m4(local_mat, ob->obmat);
}
+ if (dmd->texture != NULL) {
+ pool = BKE_image_pool_new();
+ }
+
for (i = 0; i < numVerts; i++) {
TexResult texres;
float strength = dmd->strength;
@@ -272,7 +278,7 @@ static void displaceModifier_do(
if (dmd->texture) {
texres.nor = NULL;
- BKE_texture_get_value(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, false);
+ BKE_texture_get_value_ex(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, pool, false);
delta = texres.tin - dmd->midlevel;
}
else {
@@ -336,6 +342,10 @@ static void displaceModifier_do(
}
}
+ if (pool != NULL) {
+ BKE_image_pool_free(pool);
+ }
+
if (tex_co) {
MEM_freeN(tex_co);
}