Jump to content
  • Advertisement
Sign in to follow this  
Quaid Tseng

How to make it run faster?

This topic is 4157 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 built an implicit cloth sim(Baraff's Large Steps in Cloth Simulation) in dx9. 8x8 = 64 particles results in 65 FPS 16x16 = 256 particles results in 25 FPS Many papers mentioned they can do thousands of particles in a decent rate. I don't know if my dx9 loop has some problem, thus slow down the performance.
    // Register the window class
    WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, 
                      GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
                      "D3DEngine", NULL };
    RegisterClassEx( &wc );
    // Create the application's window
    HWND hWnd = CreateWindow( "D3DEngine", "D3D GameEngine", 
                              WS_OVERLAPPEDWINDOW, 0, 0, 1000, 1000,
                              GetDesktopWindow(), NULL, wc.hInstance, NULL );
    // Initialize Direct3D
    if( SUCCEEDED( GAMEENGINE->InitD3D( hWnd ) ) )
		if( SUCCEEDED( GAMEENGINE->InitGraphics() ) )
			ShowWindow( hWnd, SW_SHOWDEFAULT );
			UpdateWindow( hWnd );
			// Enter the message loop
			MSG msg; 
			ZeroMemory( &msg, sizeof(msg) );
			while( msg.message!=WM_QUIT )
				if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
					TranslateMessage( &msg );
					DispatchMessage( &msg );

    UnregisterClass( "D3DEngine", wc.hInstance );
    return 0;

Even if I put nothing in the Render(), that is, an empty loop, I can only get a max rate, about 70 FPS. Maybe there's another way, let it run faster? Any reply could be appreciated!

Share this post

Link to post
Share on other sites
You're seeing the effects of VSYNC ("Vertical SYNCronization") which is an artificial limit imposed by the API and/or drivers.

Change D3DPRESENT_PARAMETERS::PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE and ensure that the driver isn't set to override the application setting.


Share this post

Link to post
Share on other sites
Amazing! Thanks to Jack!

always occupies 50% CPU usage.

Now I get 970 FPS in 4x4 = 16 particles
166 FPS in 8x8 = 64
65 FPS in 12x12 = 144
28 FPS in 16x16 = 256

The rate is still slow compared to those papers,
however that's the problem of programming.

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!