Sign in to follow this  
Trillian

A problem with card caps

Recommended Posts

Hello! I have started a game project and it is going well. However, when I try to send it to the game's artist, he cannot run it. The direct3D device cannot be created on his computer. For a reason I don't remember, I tought the problem was the PresentationInterval, so I wrote the following code :
D3DCAPS9 cardcaps;
D3DManager.GetCaps(cardcaps);
	
std::string supportedPresentationIntervals = "This card supports :\n";
if(cardcaps.PresentationIntervals & D3DPRESENT_INTERVAL_DEFAULT)
{
	supportedPresentationIntervals += "D3DPRESENT_INTERVAL_DEFAULT\n";
}
if(cardcaps.PresentationIntervals & D3DPRESENT_INTERVAL_ONE)
{
	supportedPresentationIntervals += "D3DPRESENT_INTERVAL_ONE\n";
}
if(cardcaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO)
{
	supportedPresentationIntervals += "D3DPRESENT_INTERVAL_TWO\n";
}
if(cardcaps.PresentationIntervals & D3DPRESENT_INTERVAL_THREE)
{
	supportedPresentationIntervals += "D3DPRESENT_INTERVAL_THREE\n";
}
if(cardcaps.PresentationIntervals & D3DPRESENT_INTERVAL_FOUR)
{
	supportedPresentationIntervals += "D3DPRESENT_INTERVAL_FOUR\n";
}
if(cardcaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE)
{
	supportedPresentationIntervals += "D3DPRESENT_INTERVAL_IMMEDIATE\n";
}

BGL_LOG_USELESSINFO(supportedPresentationIntervals.c_str());


Now, when he runs it, the created log file contains:
This card supports :
D3DPRESENT_INTERVAL_FOUR
And if I set the presentation interval to this value it still does not work at his house (it might be another present_parameter that causes the problem...) The weird thing is that if I run this at home, where i use D3DPRESENT_INTERVAL_IMMEDIATE, my log file contains:
This card supports :
that's all! But the app works... strange isn't it? Is my cardcap-checking code right?

Share this post


Link to post
Share on other sites
You can't check for default or immediate as those values are 0. Depending on your logging method you might benefit from \r\n. It's possible the values are logged, but you're just not seeing it.

\n is a CR (carriage return) which just moves back to column 0.
\r is a LF (line feed) which advances to the next line.

In ascii mode, a \n may be converted or \r\n. When using, for example, "type" in a command prompt, it obeys the correct meanings of \r and \n in the file. A file with just \n may print ONE, then print TWO over top of that, then THREE over top of that. I'd expect with FOUR, you'd see FOURE, unless THREE isn't actually supported.

You can always try the D3DCAPS viewer to see what's being reported in the caps to ensure your app isn't faulty.

I've never use std::string, but I'd expect += to work... but you never know. Try stepping through the code.

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