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>2020-02-25 15:12:52 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-02-25 15:18:22 +0300
commit7e7c9276022f44495d9c7f9b3e09a2bd592aeab5 (patch)
tree67ce80f27a53a7d3a88b7b06b54d70568f99ed61 /source/blender
parent8885fb5929f23d59141986cda6f71f9503018a40 (diff)
Cleanup: EEVEE: Use log2_floor_u
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c6
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index e8e5614e4d4..2b11a608bd0 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -264,7 +264,7 @@ static bool EEVEE_lightcache_validate(const LightCache *light_cache,
if ((irr_size[0] == light_cache->grid_tx.tex_size[0]) &&
(irr_size[1] == light_cache->grid_tx.tex_size[1]) &&
(irr_size[2] == light_cache->grid_tx.tex_size[2]) && (grid_len == light_cache->grid_len)) {
- int mip_len = (int)(floorf(log2f(cube_res)) - MIN_CUBE_LOD_LEVEL);
+ int mip_len = log2_floor_u(cube_res) - MIN_CUBE_LOD_LEVEL;
if ((cube_res == light_cache->cube_tx.tex_size[0]) &&
(cube_len == light_cache->cube_tx.tex_size[2]) && (cube_len == light_cache->cube_len) &&
(mip_len == light_cache->mips_len)) {
@@ -298,7 +298,7 @@ LightCache *EEVEE_lightcache_create(const int grid_len,
light_cache->cube_tx.tex_size[1] = cube_size;
light_cache->cube_tx.tex_size[2] = cube_len;
- light_cache->mips_len = (int)(floorf(log2f(cube_size)) - MIN_CUBE_LOD_LEVEL);
+ light_cache->mips_len = log2_floor_u(cube_size) - MIN_CUBE_LOD_LEVEL;
light_cache->vis_res = vis_size;
light_cache->ref_res = cube_size;
@@ -491,7 +491,7 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake)
irradiance_pool_size_get(lbake->vis_res, lbake->total_irr_samples, lbake->irr_size);
- lbake->ref_cube_res = OCTAHEDRAL_SIZE_FROM_CUBESIZE(lbake->rt_res);
+ lbake->ref_cube_res = octahedral_size_from_cubesize(lbake->rt_res);
lbake->cube_prb = MEM_callocN(sizeof(LightProbe *) * lbake->cube_len, "EEVEE Cube visgroup ptr");
lbake->grid_prb = MEM_callocN(sizeof(LightProbe *) * lbake->grid_len, "EEVEE Grid visgroup ptr");
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 3201ffb10f4..52902d84b7e 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -1060,7 +1060,7 @@ void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata,
float target_size = (float)GPU_texture_width(rt_color);
/* Max lod used from the render target probe */
- pinfo->lod_rt_max = floorf(log2f(target_size)) - 2.0f;
+ pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
pinfo->intensity_fac = intensity;
/* Start fresh */
@@ -1169,7 +1169,7 @@ void EEVEE_lightbake_filter_diffuse(EEVEE_ViewLayerData *sldata,
pinfo->lodfactor = bias + 0.5f *
log((float)(target_size * target_size) * pinfo->samples_len_inv) /
log(2);
- pinfo->lod_rt_max = floorf(log2f(target_size)) - 2.0f;
+ pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
#else
pinfo->shres = 32; /* Less texture fetches & reduce branches */
pinfo->lod_rt_max = 2.0f; /* Improve cache reuse */