[r131]Crash at start of game sometimes +EDIT: FULL 64bit FIX

Bugs that have been resolved.

Moderator: Graf Zahl

Locked
User avatar
Agent ME
Posts: 229
Joined: Mon Jan 02, 2006 12:39
Contact:

[r131]Crash at start of game sometimes +EDIT: FULL 64bit FIX

Post by Agent ME »

Sometimes in Doom2, if I start a new game and immediately look down, the game crashes out. Probably around 1 out of 5 times for me.

I'm on Ubuntu 8.04 in 64 bit with the binary compiled to 64 bit. This might be related to this bug, which I'm exhibiting. Seems to only happen in GL mode.

(Ignore everything in crash reports about audio not working - that always happens on my system when I'm listening to music too. Sound works fine otherwise. Apparently my system doesn't support hardware mixing or something.)

Regular crash report. It seems to be cut off at the end, possibly a glitch in g/zdoom. (Taken from file zdoom-crash.log which was generated on crashing.)
Spoiler: Crash Report
Output of GDB when debugged during crash:
Spoiler: Debugging stuff
Last edited by Agent ME on Thu Jul 17, 2008 6:26, edited 2 times in total.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

I hate to say this again: I have no means to debug 64bit apps so I can't look for the problem and fix it.

So now I have the choice of leaving these reports open and do nothing with them or closing them to get them out of the way of real problems.

To sum it up: It is highly unlikely that 64bit GZDoom will work any time soon.
User avatar
Agent ME
Posts: 229
Joined: Mon Jan 02, 2006 12:39
Contact:

Post by Agent ME »

I think I fixed it - I at least managed to make it not crash any more, but I'm not sure it's completely correct this way.

The crash is caused in line 194 of src/gl/gl_skydome.cpp. Here's the code starting from line 189:

Code: Select all

				if (buffer)
				{
					SkyColors[texno.GetIndex()]=averageColor((unsigned long *) buffer, w * MIN(30, h), false);
					if (h>30)
					{
						SkyColors[texno.GetIndex()+MaxSkyTexture] = averageColor(((unsigned long *) buffer)+(h-30)*w, w * 30, false);
					}
					else SkyColors[texno.GetIndex() + MaxSkyTexture] = SkyColors[texno.GetIndex()];
					delete buffer;
					SkyColors[texno.GetIndex()].a=1;	// mark as processed
				}
I changed line 194 to:

Code: Select all

						SkyColors[texno.GetIndex()+MaxSkyTexture] = averageColor(((unsigned long *) buffer)+30*w, w * 30, false);
It seems that you'd want to advance the buffer by 30*w, not (h-30)*w as before. That seems to prevent the crashing, but I don't think it's completely correct this way. Should the second parameter to averageColor() be w*30 like it is now, w*MIN(30,h) like the above line, or just w*h? I tested a few tries with it as w*h but the game crashed sometimes with it as that.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

No, the problem is the 'unsigned long'. On 64 bit GCC that's 8 bytes but everywhere else it's 4 bytes. It should be ZDoom's DWORD instead.
User avatar
Agent ME
Posts: 229
Joined: Mon Jan 02, 2006 12:39
Contact:

Post by Agent ME »

I went on that advice, went back to the old code, and started replacing occurrences of "long" or "unsigned long" with "DWORD" in places dealing with the GL textures code, and not only did it fix this crash, but it completely fixed the 64-bit rendering errors!

Attached is the patch, I think I set up the patch right.
EDIT: New patch with gl_nodes.cpp fixed, looks right.
Attachments
64bitv2-r131.diff.gz
Patch for r131. 64 bit hardware rendering works now! (gl_nodes.cpp updated too now!)
(2.04 KiB) Downloaded 70 times
Last edited by Agent ME on Fri Jul 18, 2008 7:33, edited 1 time in total.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

Thanks for that. Your help is very much appreciated.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

Thanks for that. Your help is very much appreciated.

I also changed gl_nodes.cpp. It would have failed miserably trying to load GL nodes from a GWA file.
selivanow
Posts: 7
Joined: Thu Jun 26, 2008 18:23

Post by selivanow »

@Agent ME:

Wow. That is great. I had an idea that it might be related to 32/64 bit sizes but i just haven't found the time to check it yet. I will apply your patch and check it on my machine.

EDIT: Ok, Agent ME's patch seems to do the trick for me as well.
User avatar
Agent ME
Posts: 229
Joined: Mon Jan 02, 2006 12:39
Contact:

Post by Agent ME »

I updated the patch to fix gl_nodes.cpp, it seems to look right.
Locked

Return to “Closed Bugs”