gtkradiant/tools/quake3/q3map2
Thomas Debesse eb5fe5bce9 q3map2/light_bounce: prevent infinite loop on obscure bias compute
New code produces same result without loop at all, so
it cannot fall in infinite loop, and it is faster in
use cases requiring more than one loop in previous code.

The Unvanquished vega map is known to trigger the bug:
https://github.com/UnvanquishedAssets/map-vega_src.dpkdir
I reproduced it multiple time on various hardware (8 core FX-9590,
12 core/24 thread Ryzen 9 3900X) with commit af40508 and using
final compilation profile edited to use -fastbounce instead
of -fast option.

The symptom is simple, q3map2 stucks there:

--- Radiosity (bounce 1 of 8) ---
--- RadCreateDiffuseLights ---
0...1...2...3..

Or somewhere else in that progression bar given your hardware
and the amount of core your CPU has.

When stuck, all the CPU cores are running 100% but the thread
never returns (a strace can reveals it, a gdb backtrace too).

Thanks to @slipher for the precious advices and improving my first
attempt to fix it.

For more information on the issue, I asked:

> which negative value never can become positive
> when incremented infinitely?

slipher said:

> for a double, any value less than -2^53 would have this property
> don't know for float off the top of my head

But then, it means that's theorically verified this loop was able
to run forever in some case.

I don't know what this code is doing anyway, but at least we can
keep the behaviour without requiring to understand it.
2020-07-03 08:12:48 +02:00
..
brush.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
brush_primit.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
bsp.c netradiant/tools: initial 2018-02-25 23:46:10 +01:00
bsp_analyze.c split bsp analyze/info/scale stuff from q3map2 2016-02-13 04:54:26 +01:00
bsp_info.c split bsp analyze/info/scale stuff from q3map2 2016-02-13 04:54:26 +01:00
bsp_scale.c split bsp analyze/info/scale stuff from q3map2 2016-02-13 04:54:26 +01:00
bspfile_abstract.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
bspfile_ibsp.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
bspfile_rbsp.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
changelog.q3map1 ported over the 1.5 branch version of q3map2 which is newer 2008-07-25 07:31:37 +00:00
changelog.q3map2.txt ported over the 1.5 branch version of q3map2 which is newer 2008-07-25 07:31:37 +00:00
convert_ase.c Using Sys_FPrintf with SYS_WRN and SYS_ERR 2016-05-16 21:20:20 +02:00
convert_bsp.c split bsp analyze/info/scale stuff from q3map2 2016-02-13 04:54:26 +01:00
convert_map.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
decals.c Using Sys_FPrintf with SYS_WRN and SYS_ERR 2016-05-16 21:20:20 +02:00
exportents.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
facebsp.c reduce diff noise 2018-02-06 05:34:43 +01:00
fixaas.c split fixaas stuff from q3map2 2016-02-13 04:54:26 +01:00
fog.c mark two shader checks nullable 2018-02-06 05:34:06 +01:00
game__null.h netradiant/tools: initial 2018-02-25 23:46:10 +01:00
game_ef.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_etut.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_ja.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_jk2.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_nexuiz.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_qfusion.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_quake3.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_quakelive.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_reaction.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_sof2.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_t.h uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
game_tenebrae.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_tremulous.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_unvanquished.h netradiant/tools: initial 2018-02-25 23:46:10 +01:00
game_wolf.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
game_wolfet.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
image.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
leakfile.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
light.c netradiant/tools: initial 2018-02-25 23:46:10 +01:00
light_bounce.c q3map2/light_bounce: prevent infinite loop on obscure bias compute 2020-07-03 08:12:48 +02:00
light_shadows.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
light_trace.c mark two shader checks nullable 2018-02-06 05:34:06 +01:00
light_ydnar.c swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
lightmaps.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
lightmaps_ydnar.c netradiant/tools: initial 2018-02-25 23:46:10 +01:00
listen.pl ... 2007-11-04 04:08:17 +00:00
main.c reduce diff noise 2018-02-06 05:34:43 +01:00
map.c netradiant/tools: ::zerowing-base=422 2018-02-25 23:46:54 +01:00
mesh.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
minimap.c do not delete q3map2_*.shader on minimap generation 2018-02-06 05:34:06 +01:00
model.c netradiant/tools: initial 2018-02-25 23:46:10 +01:00
patch.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
path_init.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
portals.c Using Sys_FPrintf with SYS_WRN and SYS_ERR 2016-05-16 21:20:20 +02:00
prtfile.c reduce diff noise 2018-02-06 05:34:43 +01:00
q3map2.h swap values 0 and 1 for -exposure (now -exposure 0 does nothing, -exposure 1 did what 0 did before) 2018-03-03 22:18:39 +01:00
q3map2.ico transfer from internal tree r5311 branches/1.4-gpl 2007-09-12 18:54:28 +00:00
q3map2.rc transfer from internal tree r5311 branches/1.4-gpl 2007-09-12 18:54:28 +00:00
q3map2.vcxproj add missing minimap support for games 2018-02-06 05:34:06 +01:00
q3map2.vcxproj.filters split fixaas stuff from q3map2 2016-02-13 04:54:26 +01:00
shaders.c reduce diff noise 2018-02-06 05:34:43 +01:00
surface.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
surface_extra.c q3map2/picomodel: remove some warnings 2018-01-27 22:53:18 +01:00
surface_foliage.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
surface_fur.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
surface_meta.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
tjunction.c tools: reduce diff noise 2018-01-27 22:54:14 +01:00
tree.c uncrustify! now the code is only ugly on the *inside* 2012-03-17 15:01:54 -05:00
vis.c add an option -mergeportals to speed up vis, while not making the vis data MUCH worse 2018-02-06 04:36:43 +01:00
visflow.c [q3map2/{vis,visflow}.c] Reinstate offsetof-based size computation. 2018-01-22 16:03:21 +00:00
writebsp.c Proper working with noradiosity 1 lights 2017-08-06 02:31:22 +02:00