Tiberius Station crash - polymer, explosive barrels, dynamic lights, code fix (workaround)
The room with the boss in Tiberius Station crashes every time when I blow up the barrels, when using Polymer and with all dynamic lights. Same issue it seems as in https://forums.duke4.net/topic/12084-tiberius-station-explosive-barrel-crash/ where the first commit known bad was e67e5391 (it's a big one, so hard to pinpoint what exactly did it)
I was able to get this to not crash while continuing to use Polymer with full dynamic lights with a small patch. It's not a real fix, as in it doesn't fix what the root cause is (which I can't determine) but maybe points in the right direction.
--- C:\Users\JCDenton\Documents\GitHub\eduke32\polymer.cpp 2024-05-23 20:07:20.358652800 -0600
+++ C:\Users\JCDenton\Documents\GitHub\eduke32\source\build\src\polymer.cpp 2024-05-21 10:22:44.243690000 -0600
@@ -2415,7 +2415,7 @@
glVertexAttrib3fv(prprogram.attrib_N, &plane->tbn[2][0]);
}
- if (plane->indices)
+ if (plane->indices && plane->indicescount < 10000000)
{
if (planevbo)
glDrawElements(GL_TRIANGLES, plane->indicescount, GL_UNSIGNED_SHORT, NULL);
@@ -3728,6 +3728,9 @@
do
{
int const imax = (p->indices) ? (p->indicescount) : (p->vertcount);
+ if (p->indicescount > 10000000) {
+ break;
+ }
int const index0 = INDICE(0);
if (index0 > imax) return;
int const index1 = INDICE(1);
don't know why it's so high but just bailing for that frame when there are more than 10 million indices keeps things running and I rather doubt there should ever be that many