PSSM Shadows produce a crash on published version

Posted By: Benni003

PSSM Shadows produce a crash on published version - 01/27/14 17:05

Hey there, I have a big problem with PSSM shadows... Currently my Game is tested on different Systems. Now my problem - With activated pssm shadows the engine crashes!
The crash just happens in the published version and just on systems with radeon grafic cards (always).
It makes me confused, because I'm not a expert in this, but one thing I found out. If I cut the following line from shadows.c no crash is happening, but also shadows are not visible then. I really hope that someone can help me, because I have to fix in withing two days smirk

Here the line:

D3DXMatrixMultiply(&matSplit[i],&matSplit[i],pssm_texscale(pssm_res));

Code:
for(i=0; i<pssm_numsplits; i++) 
			{
				// look from the sun onto the scene			
				viewSplit[i]->pan = 180 + sun_angle.pan;
				viewSplit[i]->tilt = -sun_angle.tilt;
				vec_set(viewSplit[i]->x,sun_pos);

				//				vec_normalize(viewSplit[i]->x,200);

				// calculate the split view clipping borders and transformation matrix			
				view_to_split(camera,pssm_splitdist[i],pssm_splitdist[i+1],viewSplit[i],&matSplit[i]);
				LPD3DXEFFECT fx = viewSplit[i]->material->d3deffect; 
				if(fx) fx->SetMatrix("matSplitViewProj",&matSplit[i]);
				
				// create a texture matrix from the split view proj matrix			
				D3DXMatrixMultiply(&matSplit[i],&matSplit[i],pssm_texscale(pssm_res));
				
				#ifdef DEBUG_PSSM		
					DEBUG_BMAP(viewSplit[i]->bmap,300 + i*220,0.2);
					var pssm_fps = 16/time_frame;
					DEBUG_VAR(pssm_fps,200);
					DEBUG_VAR(pssm_splitdist[i+1],220 + i*20);
				#endif			
			}

Posted By: oliver2s

Re: PSSM Shadows produce a crash on published version - 01/27/14 17:11

Maybe "pssm_res" is "0"? Because this would cause a division by zero in "pssm_texscale()".
Posted By: Benni003

Re: PSSM Shadows produce a crash on published version - 01/27/14 17:15

No, It's not 0 tongue The crash just happens at a published version and just on systems with radeon cards. I wrote it wink
Posted By: oliver2s

Re: PSSM Shadows produce a crash on published version - 01/27/14 17:17

Originally Posted By: Benni003
No, It's not 0 tongue The crash just happens at a published version and just on systems with radeon cards. I wrote it wink


I know, but nevertheless all possibilities should be checked tongue

Do you have the same FX files in your published game as you use while development?
Posted By: Benni003

Re: PSSM Shadows produce a crash on published version - 01/27/14 18:35

Originally Posted By: oliver2s
I know, but nevertheless all possibilities should be checked tongue

OK grin
Originally Posted By: oliver2s
Do you have the same FX files in your published game as you use while development?

Yes I have and one time I removed every code in vp_pssm.fx and vp_depth.fx. I just wrote technique name {pass { }} in every shader so that the engine isn't angry wink But still the crash. The game was tested on a group of systems... with nvidia grafic cards no problem. with radeon -> crash. I think the code crashes because of this line: D3DXMatrixMultiply(&matSplit[i],&matSplit[i],pssm_texscale(pssm_res));

Posted By: WretchedSid

Re: PSSM Shadows produce a crash on published version - 01/27/14 18:43

Okay, then let's get cracking!

With what error message does it crash? Are you sure you are not reading past the array bounds? Might there be any SIMD alignment issues at work (I see that pssm_texscale() returns statically allocated memory and I don't know how good the Lite-C compiler is in regards to alignment rules... I know for a fact that it doesn't care about padding)

In short, more source code please with declaration of all relevant variables!
Posted By: Benni003

Re: PSSM Shadows produce a crash on published version - 01/27/14 20:03

I made a small demo based on the crowed of the 3dgs folder. I used the original code from Crowed.c, shadows.c, vp_pssm.fx and vp_depth.fx.
Here is the File:

PSSM Test Demo

On my system (and other systems) with nvidia graphic card:
source code: WORKING
published exe: WORKING

On my second system (and other systems) with radeon graphic card:
source code: WORKING
published exe: NOT WORKING - the engine crashes without error message.

I hope we will find the Problem and can fix it...
Posted By: oliver2s

Re: PSSM Shadows produce a crash on published version - 01/27/14 20:38

On my ATI system it WORKS.

Have you tried the following:
- copied "d3dx9_30.dll" and "d3dx9_32.dll" in the published exe folder?
- updated or reinstalled DirectX (9)?
- used other drivers?
- does your video card support shader model 3?
Posted By: Benni003

Re: PSSM Shadows produce a crash on published version - 01/27/14 22:16

Hey, it's working!!!! yes laugh I added "d3dx9_30.dll" and "d3dx9_32.dll" I had just d3dx9_42.dll in the folder and I thought that would be enough.
© 2024 lite-C Forums