View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005459 | The Dark Mod | Coding | public | 25.12.2020 16:31 | 15.11.2022 17:08 |
Reporter | stgatilov | Assigned To | stgatilov | ||
Priority | normal | Severity | normal | Reproducibility | N/A |
Status | assigned | Resolution | open | ||
Product Version | TDM 2.09 | ||||
Target Version | TDM 2.12 | ||||
Summary | 0005459: Optimize idRenderWorldLocal::CreateLightDefInteractions for ambient_world light | ||||
Description | The function idRenderWorldLocal::CreateLightDefInteractions searches for interactions of light like this: foreach area having light: foreach entity in area: if light is noshadows and entity not visible: continue ... # complicated code here Ambient world light is noshadows and covers the whole map. So all entities in the map are traversed every frame, just to see that they are not in the view and should be discarded. I tried to profile game on Painter's Wife FM. 6.7% of time is spent on this function, most of which wasted on entity visibility check. If I add this hack: volatile bool skipAmbientWorld = true; void idRenderWorldLocal::CreateLightDefInteractions( idRenderLightLocal *ldef ) { if (skipAmbientWorld && idStr::Icmp(gameLocal.entities[ldef->parms.entityNum]->spawnArgs.GetString("classname"), "atdm:ambient_world") == 0) { skipAmbientWorld = !!skipAmbientWorld; return; } Then only 1.4% is spent in this function. And all of it does into complicated logic of searching/adding interactions in the interaction table. The idea of optimization is to extract light/entity processing into a separate function, then write second traversal. The first traversal goes over all lights, then goes over their areas and entities. The second traversal should go over visible entities, then go over lights in their areas. The second approach should handle only specific class of lights, which are noshadows and large enough --- all the other lights should be handled with the first approach. | ||||
Additional Information | Originally reported here, noticed during 100K entities experiment: https://forums.thedarkmod.com/index.php?/topic/16837-when-youre-getting-close-to-the-entity-limit-inlining/&do=findComment&comment=454663 | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
25.12.2020 16:31 | stgatilov | New Issue | |
27.02.2021 08:57 | stgatilov | Assigned To | => stgatilov |
27.02.2021 08:57 | stgatilov | Status | new => assigned |
27.02.2021 08:57 | stgatilov | Target Version | TDM 2.10 => |
08.02.2022 14:54 | nbohr1more | Target Version | => TDM 2.11 |
15.11.2022 17:08 | nbohr1more | Note Added: 0015432 | |
15.11.2022 17:08 | nbohr1more | Target Version | TDM 2.11 => TDM 2.12 |