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.
This commit is contained in:
2017-02-06 12:23:03 +01:00
parent 223aff987a
commit 385fe4f0ce
2 changed files with 19 additions and 3 deletions

View File

@@ -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);

View File

@@ -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);
}