• Advertisement
Sign in to follow this  

Problems in Direct3D setting

This topic is 4416 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

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;
	g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &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.SwapEffect             = D3DSWAPEFFECT_DISCARD;
	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;
	g_pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);

	int VP = 0;
	
	if( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
		VP = D3DCREATE_HARDWARE_VERTEXPROCESSING;
	else
		VP = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
    
	
	if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT,
									  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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Quote:
Original post by Armadon
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 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 this post


Link to post
Share on other sites
Thanks for replying, Armadon and jollyjeffers.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Hmm... It's also reporting either 62 or 66 FPS for me. I don't have fraps or anything to verify.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sr_Guapo
Hmm... It's also reporting either 62 or 66 FPS for me. I don't have fraps or anything to verify.

Hi Sr_Guapo, thanks for replying. What is your config, please?

oh oh... I have just made some tests in config 2 (AthlonXp + GF4MX) and I noticed something strange: old applications that ran around 100fps are now running at 62~66fps. :( ... and some times the frame rate quickly jumps to 31~33fps, what evidences a forced vSync, like Armadon had said. I already disabled the vSync in the driver settings and nothing... The only thing that was updated (from that time to now) was Windows XP. Is there some possibility of Windows XP having "locked" the vSync?

Share this post


Link to post
Share on other sites
Quote:
Original post by Mari_p
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]

There was a lot of general anger from graphics developers about Nvidias naming of the GeForce 4 MX. The predecessor GeForce 3 line introduced a basic programmable pipeline which the main GeForce 4 TI Line improved upon - whereas the MX variants actually removed the programmable components. Thus you ended up with a card that was more a turbo-charged GeForce 2 than a successor to the GeForce 3...

Given that they were very cheap they appeared in almost every generic PC on the planet for a while. Meaning that us games developers had to support them even though they were crap [smile]

Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement