# Problems in Direct3D setting

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

## Recommended Posts

Hi there. I thought I knew how to set Direct3D correctly, but I noticed that I'm not understand this process very well... The problem is the following: I ran my application in two configurations: 1) K6-II 400MHz with a TNT2 2) AthlonXP 2400MHz with a GeForce4 MX. The problem is that the application is running at 250 fps in the config 1 and at only 62 fps in the config 2. My Direct3D setting:
bool DX::IniciaD3D( LPDIRECT3DDEVICE9 *pDevice, HWND hWnd,
int Largura, int Altura, bool vSync,
bool ModoFullScreen )
{
// Criando o objeto Direct3D
LPDIRECT3D9	g_pD3D = NULL;

if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
{
MessageBox(NULL, "Não foi possível criar o objeto Direct3D",
"Falha no método Direct3DCreate9", NULL);

SAFE_RELEASE(g_pD3D);
return false;
}

// Parâmetros do Direct3D
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );

D3DDISPLAYMODE DisplayAtual;

// MODO JANELA
if ( ModoFullScreen == false )
{
d3dpp.Windowed = true;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
}
// MODO FULLSCREEN
else
{
d3dpp.Windowed                   = false;
d3dpp.BackBufferFormat           = DisplayAtual.Format;
d3dpp.BackBufferWidth            = Largura;
d3dpp.BackBufferHeight           = Altura;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
}

d3dpp.MultiSampleType        = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality     = 0;
d3dpp.BackBufferCount        = 1;
d3dpp.hDeviceWindow          = hWnd;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.EnableAutoDepthStencil = true;
d3dpp.Flags                  = 0;

if ( vSync == true )
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
else
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

// Criando o dispositivo
D3DCAPS9 caps;

int VP = 0;

if( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
VP = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
VP = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

D3DDEVTYPE_HAL,
hWnd,
VP,
&d3dpp,
pDevice ) ) )

{
// Problemas na criação do dispositivo (pDevice)
MessageBox(NULL, "O dispositivo gráfico não pôde ser criado.",
"Falha no método CreateDevice", NULL );

SAFE_RELEASE(g_pD3D);
return false;

}

SAFE_RELEASE(g_pD3D);
return true;
}


I ran the application in full screen mode with vSync disabled (D3DPRESENT_INTERVAL_IMMEDIATE). Please, would anybody know the what is causing this problem? Could anybody show me the best way to set Direct3D for different graphic cards? Thank you much in advance.

##### Share on other sites
This might be a driver forced issue. The drivers of the second config might be forcing a vsync. You should check the driver settings of both configs to make sure that you don't have problems when with forced driver configs.

I hope this helps.
Take care.

##### Share on other sites
Quote:
 Original post by ArmadonThis might be a driver forced issue. The drivers of the second config might be forcing a vsync. You should check the driver settings of both configs to make sure that you don't have problems when with forced driver configs.

I 2nd this suggestion [smile]

The presentation parameters tend to be taken as hints by the drivers - they can and will override them with different settings. My ATI drivers allow a "application default", "always on" and "always off" setting - it's only when set to the first of the three that it'll honour what my code tells it to do...

hth
Jack

##### Share on other sites

Unfortunately, it doesn't seem to be a driver forced issue. The driver settings of GeForce4 MX allows three options for the vSync: "Application-controlled", "OFF" and "ON". I tried all them and the result was the same (62 fps).

For checking if it was really a forced vSync problem, I ran the application in different resolutions, and for my surprise, the fps didn't change. It should ran around 85 fps in the 640x480... but it ran at 62 fps. I'm sure the refresh is 85Hz in this resolution (my display can show it). So, it doesn't seem to be vSync problem.

Does the order how I set the Direct3D paramenters can influence on the performance?
Do you see something wrong in the code that I posted?

Any help would be very appreciated.

##### Share on other sites
The only ways I can see this effect appearing is when there is an obvious driver override such as forced vsync or if your rendering loop is limiting the frame rate... by actually only rendering 60 frames per second. Other than that I cannot see this really happening. It does not matter how you order the creation of your device with focus on this problem (It does matter in a sense that you cannot use the device unless you create it first).

If you could paste the app somewhere you might be able to test it and debug it for you.

I hope this helps.
Take care.

##### Share on other sites
Friends, could you run my application and reporting the fps? Just click on the download button.

Thank you very much.

##### Share on other sites
Stable 1000fps on P4 3.2/GF6800 Go(79.31 driver ver)

Just a note. GF4MX is a very strange card. I wouldn't be surprised if it would work work fine except with that. Don't ask why.

##### Share on other sites
Thanks darkelf2k5! I am a bit less worried now.

Quote:
 GF4MX is a very strange card. I wouldn't be surprised if it would work fine except with that. Don't ask why.

Could I ask what kind of problem did you get with a GeForce4 MX? [smile]

Armadon, thanks for replying. The frame rate is not limited by code (darkelf2k5 got 1000fps) and the vSync seems not be forced by the driver card (it should run around 85fps in 640x480)... Wouldn't it be a driver problem? I will update it.

If anybody more can run the application and reporting the fps I would be very thankful.

Edit:
A note: I ran the application in a third config with a GeForce4MX, and the result was the same (around 62 fps).

[Edited by - Mari_p on January 22, 2006 9:30:15 AM]

##### Share on other sites
62 fps say the aplication, but fraps tell me 999fps
Athlonxp 2600
1 gb Ram
geforce 6600gt

The problem is the fps counter i think.

##### Share on other sites
I never had a GeForce4 MX, I just heard rumors that this not working, that not supported, etc. Still, it's either this, or the athlonXP.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 14
• ### Forum Statistics

• Total Topics
632155
• Total Posts
3004477

×