netradiant-custom/tools/quake3/q3map2
Thomas Debesse 1cf7b72e6b 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-08-19 08:32:36 +03:00
..
q3map2_fsr_newfiles fix lots of CRLFs 2010-04-17 21:02:26 +02:00
.patchsets add the branch-manager for q3map2 too 2008-09-14 15:48:21 +00:00
autopk3.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
autopk3.h move main.c::pk3 business->autopk3.c 2019-12-20 20:05:42 +03:00
brush_primit.c my own uncrustify run 2012-03-27 12:03:21 +02:00
brush.c use standard C bool type: 2020-02-03 01:15:30 +03:00
bsp.c q3map2: -onlyents: support *.ent as map file param 2020-06-30 13:15:10 +03:00
bspfile_abstract.c bsp lump write: pad with zeros, not with random unitialized memory data 2020-02-13 05:39:39 +03:00
bspfile_ibsp.c wrap strcmp use 2020-02-04 03:40:27 +03:00
bspfile_rbsp.c use standard C bool type: 2020-02-03 01:15:30 +03:00
changelog.q3map1 initial 2008-09-13 18:28:57 +00:00
changelog.q3map2.txt initial 2008-09-13 18:28:57 +00:00
convert_ase.c manage entity key value reading routines 2020-02-07 15:49:29 +03:00
convert_bsp.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
convert_map.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
convert_obj.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
convert_obj.h * -lightmapsastexcoord conversion: support 'external lightmaps, referenced by shader' hack 2019-12-05 22:56:42 +03:00
decals.c manage entity key value reading routines 2020-02-07 15:49:29 +03:00
exportents.c fix Usage: help strings 2020-01-27 23:41:46 +03:00
facebsp.c use standard C bool type: 2020-02-03 01:15:30 +03:00
fog.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
game__null.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_darkplaces.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_dq.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_ef.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_etut.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_ja.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_jk2.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_nexuiz.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_prophecy.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_qfusion.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_quake3.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_quakelive.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_reaction.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_sof2.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_t.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_tenebrae.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_tremulous.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_unvanquished.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_wolf.h use standard C bool type: 2020-02-03 01:15:30 +03:00
game_wolfet.h Add "slime" surfaceparam keyword to game_wolfet q3map2 for Quake 3 map shader compatibility. 2020-06-30 12:55:52 +03:00
game_xonotic.h use standard C bool type: 2020-02-03 01:15:30 +03:00
help.c wrap 'string empty' logic 2020-02-05 18:20:13 +03:00
image.c wrap 'string empty' logic 2020-02-05 18:20:13 +03:00
leakfile.c fix simple warnings 2020-02-02 14:53:18 +03:00
light_bounce.c q3map2/light_bounce: prevent infinite loop on obscure bias compute 2020-08-19 08:32:36 +03:00
light_shadows.c use standard C bool type: 2020-02-03 01:15:30 +03:00
light_trace.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
light_ydnar.c q3map2 * fix: do not affect styled lightmaps by floodlight 2020-03-25 21:21:07 +03:00
light.c * support -extlmhacksize N N input for non square lightmaps, for example -extlmhacksize 2048 1024 2020-06-14 15:49:16 +03:00
lightmaps_ydnar.c wrap 'string empty' logic 2020-02-05 18:20:13 +03:00
lightmaps.c use standard C bool type: 2020-02-03 01:15:30 +03:00
listen.pl initial 2008-09-13 18:28:57 +00:00
main.c wrap strcmp use 2020-02-04 03:40:27 +03:00
map.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
mesh.c use standard C bool type: 2020-02-03 01:15:30 +03:00
minimap.c wrap strncmp use 2020-02-04 05:53:30 +03:00
model.c * support misc_model::_remap facility of q3map2 2020-03-25 11:53:14 +03:00
patch.c wrap strcmp use 2020-02-04 03:40:27 +03:00
path_init.c fix some warnings 2020-02-07 23:00:19 +03:00
portals.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
prtfile.c q3map2 * modify message flags system to allow SYS_WRN | SYS_VRB, SYS_ERR | SYS_NOXML etc combinations 2018-03-20 19:37:47 +03:00
q3map2.h * support -extlmhacksize N N input for non square lightmaps, for example -extlmhacksize 2048 1024 2020-06-14 15:49:16 +03:00
q3map2.ico initial 2008-09-13 18:28:57 +00:00
q3map2.rc fix lots of CRLFs 2010-04-17 21:02:26 +02:00
shaders.c * support -extlmhacksize N N input for non square lightmaps, for example -extlmhacksize 2048 1024 2020-06-14 15:49:16 +03:00
surface_extra.c wrap 'string empty' logic 2020-02-05 18:20:13 +03:00
surface_foliage.c add safe_calloc(), safe_calloc_info() functions, use them (optimization, code shortening) 2020-01-12 18:55:03 +03:00
surface_fur.c use standard C bool type: 2020-02-03 01:15:30 +03:00
surface_meta.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
surface.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
tjunction.c use standard C bool type: 2020-02-03 01:15:30 +03:00
tree.c my own uncrustify run 2012-03-27 12:03:21 +02:00
vis.c support variable number of key names in entity key value reading functions 2020-02-12 23:21:15 +03:00
visflow.c wrap 'string empty' logic 2020-02-05 18:20:13 +03:00
writebsp.c nullify unused space of bspShaders.shader to write cleaner bsp 2020-02-13 05:12:57 +03:00