Jump to content

  • Log In with Google      Sign In   
  • Create Account


(Solved) 1st "presents" fail in fullscreen only


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 25 December 2012 - 01:03 PM

Hi,

I'm struggling with the following:

- when I run windowed, no (d3d) errors at all

- when I run fullscreen, I get the following d3d error:

ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted

 

Through debugging I found that the following code triggers the error:

1 - drawtext LPD3DXFONT before d3d seems to be 'OK'/ running in fullscreen

2 - when I load my meshed into managed pool instead of systemmem

I don't think it has something to do with memory/ pointers, because adding a Sleep(20) in my render function, makes the errors disappear (caused by cause 2 above).

 

I use the following present parameters for 'presenting':

mD3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;

mD3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;

 

Ways I tried to check if the device is ready in fullscreen are: (if(m3ddev != NULL) if(m3ddev->TestCooperativeLevel == D3D_OK)

They both are being passed and drawtext is done, with begin/endscene around it and present (clear before beginscene).

 

When I run everything windowed without sleep or other code changes, I get no errors at all. By the way also in fullscreen I don't notice any strange/ functional things that are not ok, except 'drawtext' prints are not always visible (because D3D seems to be still initizaling the fullscreen mode, when I'm already trying to 'drawtext' and present it).

 

Do you have any idea what to look for?



Sponsor:

#2 eppo   Crossbones+   -  Reputation: 2299

Like
0Likes
Like

Posted 26 December 2012 - 04:25 AM

Perhaps the full screen switch at start-up causes your D3D device to become lost somehow? Do you reset the D3DXFont object during a lost-device routine?



#3 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 26 December 2012 - 07:18 AM

Thanks, this might help me in the right direction.

Up till now I ignored the only other error in my debugging (lost due to display uniqueness change), this might be the issue in combination with what your saying.

This error is:

"Direct3D9: (ERROR) :Lost due to display uniqueness change"

 

I debugged to see when exactly it occurs, it is directly after d3d->CreateDevice(....)

I tested cooperative level right after the createdevice call, but strangely it gives back D3D_OK (d3ddev->TestCooperativelevel())

 

I can try to play around with a d3ddev->Reset direcly after the create, but not sure if that'll help, since testing cooperativelevel gives back an ok.

Odds are that this is related to the isse, since I don't get the lost due to display uniquness error when using windowed mode.

 

Any suggestions/ pointers?



#4 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 26 December 2012 - 07:27 AM

UPDATE:

Just did a test, the original code:

	if(D3D_OK != mD3d->CreateDevice(D3DADAPTER_DEFAULT, mDevType, mHwnd, mVertexProcessing, &mD3dpp, &mD3ddev)) return false;

	if(D3D_OK != mD3ddev->CreateVertexDeclaration(dec, &mVertexDeclaration)) return false;
	mD3ddev->SetVertexDeclaration(mVertexDeclaration);

	if(!mD3dFont.Create(mD3ddev, "Arial", 16, 10, 95, 200, 95)) return false;

The new code:

 

	if(D3D_OK != mD3d->CreateDevice(D3DADAPTER_DEFAULT, mDevType, mHwnd, mVertexProcessing, &mD3dpp, &mD3ddev)) return false;

	if(D3D_OK != mD3ddev->CreateVertexDeclaration(dec, &mVertexDeclaration)) return false;
	mD3ddev->SetVertexDeclaration(mVertexDeclaration);

	if(!mD3dFont.Create(mD3ddev, "Arial", 16, 10, 95, 200, 95)) return false;

	// assume device = lost here
	
	mVertexDeclaration->Release();
	mVertexDeclaration = NULL;
	mD3dFont.OnLostDevice();

	mD3ddev->Reset(&mD3dpp);

	mD3dFont.OnResetDevice();

	if(D3D_OK != mD3ddev->CreateVertexDeclaration(dec, &mVertexDeclaration)) return false;
	mD3ddev->SetVertexDeclaration(mVertexDeclaration);

 

What I achieve with this is that I get the same 'Lost' debug error on the device.

The debug info, originally:

 

Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver Style b

Direct3D9: (ERROR) :Lost due to display uniqueness change

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

D3DX: Unicode support: 1

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Symbols loaded (source information stripped).

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 7558: FALSE == pDevice->bPresentSubmitted

Direct3D9: (ERROR) :************************************************************

 

(where the assertion failed is on the line where I do d3ddev->Present() with a DrawText (LPD3DXFONT), after Clear and between Begin/Endscene.

The new code gives the following debug info:

 

Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver Style b

Direct3D9: (ERROR) :Lost due to display uniqueness change

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

D3DX: Unicode support: 1

Direct3D9: (ERROR) :Lost due to display uniqueness change

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Symbols loaded (source information stripped).

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 7558: FALSE == pDevice->bPresentSubmitted

Direct3D9: (ERROR) :************************************************************

 

Any ideas?



#5 eppo   Crossbones+   -  Reputation: 2299

Like
0Likes
Like

Posted 26 December 2012 - 12:19 PM

You never test the return value of Reset(). I remember under certain circumstances it can still return D3DERR_DEVICELOST, in which case you need to wait a cycle and try again until it returns D3DERR_DEVICENOTRESET.



#6 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 26 December 2012 - 03:59 PM

Thanks, just did some testing/ debugging also on the reset function.

I found out that:

- reset gives back D3D_OK/S_OK, although the 'Lost due to display uniqueness change' is still there

- after I give a 2nd reset (also with D3D_OK as result), the "Lost due to display uniqueness change' is gone.

 

Although the 'assertion error' is still there:

"Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted"

 

Triggered by my 1st "Present calls".

 

Here's the code regarding the lost device:

	HRESULT hr = mD3d->CreateDevice(D3DADAPTER_DEFAULT, mDevType, mHwnd, mVertexProcessing, &mD3dpp, &mD3ddev); //) return false;

	OutputDebugString(L"Create device:\n");
	OutputDebugString(DXGetErrorString(hr));
	OutputDebugString(L"\n");
	OutputDebugString(DXGetErrorDescription(hr));
	OutputDebugString(L"\n");

	hr = mD3ddev->Reset(&mD3dpp);
	OutputDebugString(L"Reset device 1:\n");
	OutputDebugString(DXGetErrorString(hr));
	OutputDebugString(L"\n");
	OutputDebugString(DXGetErrorDescription(hr));
	OutputDebugString(L"\n");

	hr = mD3ddev->Reset(&mD3dpp);
	OutputDebugString(L"Reset device 2:\n");
	OutputDebugString(DXGetErrorString(hr));
	OutputDebugString(L"\n");
	OutputDebugString(DXGetErrorDescription(hr));
	OutputDebugString(L"\n");

 

And the debug output:

 

Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver Style b

Direct3D9: (ERROR) :Lost due to display uniqueness change

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

Create device:

S_OK

The function completed successfully

Direct3D9: (ERROR) :Lost due to display uniqueness change

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

Reset device 1:

S_OK

The function completed successfully

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

Reset device 2:

S_OK

The function completed successfully

D3DX: Unicode support: 1

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Symbols loaded (source information stripped).

'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Symbols loaded (source information stripped).

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :************************************************************

Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 7558: FALSE == pDevice->bPresentSubmitted

Direct3D9: (ERROR) :************************************************************

 

 

So resetting the device twice makes sure the 'Lost due to uniquness change' is gone and my text is always visible (LPD3DXFONT, drawtext) at startup.

Only thing that's bothering now, is the assertion failed on the bPresentSubmitted...



#7 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 26 December 2012 - 04:00 PM

Btw; it is strange that reset gives back a S_OK/D3D_OK, although still giving the error



#8 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 26 December 2012 - 06:07 PM

Update;

I've added extra debug logging on the clear, beginframe, endframe and present functions.

Without doing the actual 'drawtext' I know get:

 

- one time no more assertion errors

- the other time 1 assertion error, after the present (which is called directly after endscene)

 

starting up a few times now gives sometimes the assertion error and sometimes not.

changed my meshes from systemmem to managed, give the assertion error for sure after present is called (first few frames).

 

Stranger... maybe something with memory or so



#9 cozzie   Members   -  Reputation: 1421

Like
0Likes
Like

Posted 27 December 2012 - 12:59 PM

UPDATE;

 

Hi Eppo and maybe others,

 

Made some good progress:

- brought back the number of D3D errors 'assertion failed pDevice->bPresentSubmitted' to a total of 2.

In these cases I call 2 sets of Clear/Beginscene/drawtext/EndScene/present right after each other.

Strangely doing the same later on in the app, doesn't give an issue

Adding a few short sleep()s solves it, but still doesn't give a 'good feeling'

- using d3d(x) managed pool for both textures and meshes

- changes the presentation parameter in d3dpp to D3DPRESENT_INTERVAL_TWO

This solved the assertion failed/ bPresent submitted during renderscene, in all cases

 

The changes parameter although terribly slows rendering down, will dig into finding the best way for this.

 

Any suggestions left?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS