• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
cozzie

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

8 posts in this topic

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?

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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...

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0