Sign in to follow this  

Why would device-Present() fail?

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have this present function. And it fails but doesn't give a error like the ones it says it does on MSDN. What would cause this present function to fail. The clear function works.
bool DisplayManager::present()
{

	HRESULT hr;

	if(FAILED(hr = m_pD3DDevice->Present(NULL, NULL, NULL, NULL)))
	{
		if(hr == D3DERR_DEVICELOST)
		{
			logentry("Present", "Device Lost");
			return false;
		}
		else if(hr == D3DERR_DRIVERINTERNALERROR)
		{
			logentry("Present", "Driver Internal Error");
			return false;
		}
		else if(hr == D3DERR_INVALIDCALL)
		{
			logentry("Present", "Invalid Call");
			return false;
		}
		else
		{
			logentry("Present", "Failed");
			return false;
		}
	}
	
	return true;
}

Share this post


Link to post
Share on other sites
OK, I'll bite. What IS the HRESULT returned when it fails?

Are you running under the debug version of the D3D runtime? You should be. It will often display much more meaningful information to the debugger's output pane when something fails.

Share this post


Link to post
Share on other sites
Have you checked to see if your settings set in your present parameters comply
with your video cards capabilities?

I've had problems like those in the past only to find out I set something up
wrong in the present parameters, etc..

Share this post


Link to post
Share on other sites
here is my present parameters, I've rendered stuff before, I just can't figure it out



ZeroMemory( &m_d3dpp, sizeof( D3DPRESENT_PARAMETERS ) );

if( Windowed )
{
m_d3dpp.Windowed = true;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dpp.BackBufferFormat = m_d3ddm.Format;
}
else
{
m_d3dpp.Windowed = false;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
m_d3dpp.BackBufferWidth = m_ScreenWidth;
m_d3dpp.BackBufferHeight = m_ScreenHeight;
m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
m_d3dpp.BackBufferFormat = m_d3ddm.Format;
}

m_d3dpp.EnableAutoDepthStencil = true;
m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

if( FAILED( m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&m_d3dpp, &m_pD3DDevice ) ) )
{
logentry( "Setting Display mode", "Failed to create D3D device" );
return false;
}

logentry( "Setting Display mode", "Created D3D device" );



Share this post


Link to post
Share on other sites
well I had my game engine working, but it wasn't organized so I started over and just copied and pasted my existing code into new classes. I dont understand how that could fail though. the clear doesnt fail, the beginscene or endscene doesn't fail. It does change the background color to the color I have, so maybe I'm just an idiot and it fails a couple of times but it really is working, and maybe when I try to render something its not rendering because I don't have something set up right for it to render. So I guess its not the present right. If the background color is working when I clear it, then it has to be presenting it right?

EDIT: yah it was something else but thanks Razor89 for helping me, I will give you the highest rating. It was since I didn't update my vertex buffer to a world position it wasn't show up. I am an idiot.

Share this post


Link to post
Share on other sites

This topic is 4745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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