diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2017-12-17 01:47:09 +0100 |
---|---|---|
committer | Hein-Pieter van Braam <hp@tmm.cx> | 2017-12-17 13:10:30 +0100 |
commit | 9ba134b46381e0d2e65eb548384626da20bf09a3 (patch) | |
tree | 1b167cdc95000dce04afe3b2657b5333bc76aedf /scene/3d | |
parent | 83291eab3ae8940cc9da159774a1da6575196c89 (diff) |
Add several unlikely() macros
Based off of perf-based prediction misses these seem to be the
lowest-hanging fruit for quick (albeit small) improvements. These are
based on:
* baking a complex lightmap
* running platformer 3d
* running goltorus
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/voxel_light_baker.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp index 98dc1590d8..1acae736c4 100644 --- a/scene/3d/voxel_light_baker.cpp +++ b/scene/3d/voxel_light_baker.cpp @@ -1692,7 +1692,7 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V } cell = bc->childs[child]; - if (cell == CHILD_EMPTY) + if (unlikely(cell == CHILD_EMPTY)) break; half >>= 1; @@ -1701,12 +1701,12 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V pos += advance; } - if (cell != CHILD_EMPTY) { + if (unlikely(cell != CHILD_EMPTY)) { for (int i = 0; i < 6; i++) { //anisotropic read light float amount = direction.dot(aniso_normal[i]); - if (amount < 0) - amount = 0; + if (amount <= 0) + continue; accum.x += light[cell].accum[i][0] * amount; accum.y += light[cell].accum[i][1] * amount; accum.z += light[cell].accum[i][2] * amount; |