Random crash in softpoly

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Random crash in softpoly

Re: Random crash in softpoly

by drfrag » Tue Jun 30, 2020 5:35 am

Seems it's gone after the texture refactor.

Re: Random crash in softpoly

by drfrag » Sat Apr 25, 2020 7:42 am

Just asking. It's not my problem but our problem.
No crash here with KDIZD 1.2 and g4.4pre-381-g70d30feb4. RelWithDebInfo v141 64 bit. But actually there's another crash if i exit the selection box without launching the game.

Re: Random crash in softpoly

by Rachael » Sat Apr 25, 2020 6:58 am

drfrag wrote:What about reverting the old "fix"?
Short of prettying the code, the fix does not affect anything whatsoever and reverting it will not fix your problem.

Re: Random crash in softpoly

by Graf Zahl » Sat Apr 25, 2020 6:54 am

I had no crashes with the IWADs, I had crashes with KDiZD. The IWADs do not seem to trigger the condition that causes the problem.

Re: Random crash in softpoly

by drfrag » Sat Apr 25, 2020 6:34 am

I've just tried with the iwads for now, 10 launches in a row and now another 10.
What about reverting the old "fix"?

Re: Random crash in softpoly

by Graf Zahl » Sat Apr 25, 2020 6:10 am

I just had a crash with this code on my rework branch. But it wasn't mMaterial.mMaterial.tex that was bogus, but mMaterial.mMaterial itself.
On KDiZD Z1M1 I can reproduce it with almost 100% certainty after the initial wipe.
From the looks of it it tries to access the invalid material from the wipe texture. The problem looks to be PolyRenderState::Clear, being called from Set3DViewport which for unknown reason calls 'Apply'. But right after the wipe that's plain and simply an undefined operation because the currently set texture is no longer valid.

Re: Random crash in softpoly

by drfrag » Sat Apr 25, 2020 2:57 am

Okay.

Re: Random crash in softpoly

by Graf Zahl » Sat Apr 25, 2020 2:54 am

I need that to get the code into Raze and have it 100% identical with GZDoom. For the transition I must ensure that I can compile both engines off the exact same backend code base. Once the transition is complete the #define can be removed again

Re: Random crash in softpoly

by drfrag » Sat Apr 25, 2020 2:48 am

Done, seems it's gone now.
BTW what is the HAVE_SOFTPOLY option on linux for? AFAIK it's the minimal compile unit and it runs on software so it's always available, precisely i have a HAVE_OPENGL option to compile only with softpoly.

Re: Random crash in softpoly

by Graf Zahl » Fri Apr 24, 2020 7:07 am

Can you test this on the texture rework branch?

Re: Random crash in softpoly

by drfrag » Fri Apr 24, 2020 6:07 am

Yep seems that's the best course of action.

Re: Random crash in softpoly

by dpJudas » Fri Apr 24, 2020 5:49 am

No matter how you slice it, an access violation for mMaterial.mMaterial->tex->shaderspeed can only be explained by two things: 1) access a pointer after deletion, 2) massive memory buffer overruns that messed up the pointer.

In any case, I'm in favor of waiting doing anything about it until graf's new branch gets merged in. There's no point in trying to do a workaround if the changes Graf did may have solved by the problem already, which it very well might. And even if it didn't, you'd have to do the fix twice then.

Re: Random crash in softpoly

by drfrag » Fri Apr 24, 2020 5:07 am

No idea of what's going on but i notice that when it crashes the screen is shrunk horizontally (a 16:9 window gets converted to a 4:3 window).
The same code is in the Vulkan backend in VkRenderState::ApplyStreamData() and it doesn't crash there:

Code: Select all

	if (mMaterial.mMaterial && mMaterial.mMaterial->tex)
		mStreamData.timer = static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mMaterial.mMaterial->tex->shaderspeed / 1000.);
	else
		mStreamData.timer = 0.0f;

Re: Random crash in softpoly

by Graf Zahl » Fri Apr 24, 2020 4:45 am

Which pointer is left behind? Be aware that I changed the logic a lot here in my current work branch, so it might make sense to check the problem with that.

Re: Random crash in softpoly

by dpJudas » Fri Apr 24, 2020 4:27 am

The problem isn't the texture class, but that FMaterialState::tex somehow leaves a deleted pointer behind. The OpenGL version doesn't crash from it because it only examines the field if mChanged is set to true, and then OpenGL itself doesn't care if you reference a deleted texture object.

Top