[Bf-blender-cvs] [385fe4f0ce] master: Add special texture sampling function which takes image pool argument

Sergey Sharybin noreply at git.blender.org
Mon Feb 6 12:37:35 CET 2017


Commit: 385fe4f0ce8337e21ca8304c78718b597eea15ab
Author: Sergey Sharybin
Date:   Mon Feb 6 12:23:03 2017 +0100
Branches: master
https://developer.blender.org/rB385fe4f0ce8337e21ca8304c78718b597eea15ab

Add special texture sampling function which takes image pool argument

Using image pool will reduce number of thread locks when acquiring image.
Useful when it's needed to sample texture fewzillion times a second.

===================================================================

M	source/blender/blenkernel/BKE_texture.h
M	source/blender/blenkernel/intern/texture.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 1c5ea946f5..9a60eb2995 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -42,6 +42,7 @@ struct Brush;
 struct ColorBand;
 struct EnvMap;
 struct FreestyleLineStyle;
+struct ImagePool;
 struct Lamp;
 struct Main;
 struct Material;
@@ -133,6 +134,12 @@ struct OceanTex *BKE_texture_ocean_copy(struct OceanTex *ot);
 bool    BKE_texture_dependsOnTime(const struct Tex *texture);
 bool    BKE_texture_is_image_user(const struct Tex *tex);
 
+void BKE_texture_get_value_ex(
+        const struct Scene *scene, struct Tex *texture,
+        float *tex_co, struct TexResult *texres,
+        struct ImagePool *pool,
+        bool use_color_management);
+
 void BKE_texture_get_value(
         const struct Scene *scene, struct Tex *texture,
         float *tex_co, struct TexResult *texres, bool use_color_management);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 2d3ecad19a..60990c03b0 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1485,9 +1485,11 @@ bool BKE_texture_dependsOnTime(const struct Tex *texture)
 
 /* ------------------------------------------------------------------------- */
 
-void BKE_texture_get_value(
+void BKE_texture_get_value_ex(
         const Scene *scene, Tex *texture,
-        float *tex_co, TexResult *texres, bool use_color_management)
+        float *tex_co, TexResult *texres,
+        struct ImagePool *pool,
+        bool use_color_management)
 {
 	int result_type;
 	bool do_color_manage = false;
@@ -1497,7 +1499,7 @@ void BKE_texture_get_value(
 	}
 
 	/* no node textures for now */
-	result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage, false);
+	result_type = multitex_ext_safe(texture, tex_co, texres, pool, do_color_manage, false);
 
 	/* if the texture gave an RGB value, we assume it didn't give a valid
 	 * intensity, since this is in the context of modifiers don't use perceptual color conversion.
@@ -1510,3 +1512,10 @@ void BKE_texture_get_value(
 		copy_v3_fl(&texres->tr, texres->tin);
 	}
 }
+
+void BKE_texture_get_value(
+        const Scene *scene, Tex *texture,
+        float *tex_co, TexResult *texres, bool use_color_management)
+{
+	BKE_texture_get_value_ex(scene, texture, tex_co, texres, NULL, use_color_management);
+}




More information about the Bf-blender-cvs mailing list