Jump to content

  • Log In with Google      Sign In   
  • Create Account

What am I forgetting to optimize?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 invutil   Crossbones+   -  Reputation: 1908

Like
0Likes
Like

Posted 26 May 2014 - 05:38 AM

My game slows down to 24 fps in 1920x1080 fullscreen mode. Other games like Company of Heroes or Dawn of War or Simcity 5 probably have more things on screen yet they're able to run at 30 fps. Why?

 

2014-05-26%2004-29-35.jpg

 

It only happens when I zoom up to here or closer:

 

2014-05-26%2004-34-04.jpg



Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7991

Like
0Likes
Like

Posted 26 May 2014 - 06:06 AM

As sole indie dev you should always be happy with the 80% part of the pareto principle (80-20 rule), and 80% of 30fps is 24 fps, therefor all is fine wink.png


Edited by Ashaman73, 26 May 2014 - 06:08 AM.


#3 Waterlimon   Crossbones+   -  Reputation: 2635

Like
1Likes
Like

Posted 26 May 2014 - 06:12 AM

Profile all of dat code and youll find out.

 

Could it have something to do with the camera angle relative to the ground? Do you have LoD for everything?


o3o


#4 Hodgman   Moderators   -  Reputation: 31799

Like
5Likes
Like

Posted 26 May 2014 - 06:21 AM

What are you forgetting to measure? ;-)

Assuming it's a GPU side problem (first time the swap buffers call to see if the CPU is waiting there for the GPU), Put some GPU queries around some draw calls, and see what gets expensive when you zoom in like that.

#5 invutil   Crossbones+   -  Reputation: 1908

Like
0Likes
Like

Posted 26 May 2014 - 06:23 AM

profile.png

 

All of the top slow downs are part of the Intel OpenGL driver.

 

DrvSetCallbackProcs appears to just set the pointers to the standard OpenGL functions. But why is it being measured? I only started profiling after the map loaded.

 

http://dri.freedesktop.org/doxygen/gallium/stw__icd_8c.html#51f95005fe32929028a8d35cb8d3019b



#6 invutil   Crossbones+   -  Reputation: 1908

Like
0Likes
Like

Posted 26 May 2014 - 06:42 AM

I made a mistake. DrSetCallbackProcs outputs debug information or something.

 

 

 

void APIENTRY DrvSetCallbackProcs ( INT  nProcs,     PROC *  pProcs     )      

 

Definition at line 199 of file stw_icd.c.

References debug_printf().

00202 {
00203 debug_printf( "%s( %d, 0x%p )\n", __FUNCTION__, nProcs, pProcs );
00204
00205 return;
00206 }

 

This is the mesa OpenGL driver source though I think. 



#7 Waterlimon   Crossbones+   -  Reputation: 2635

Like
0Likes
Like

Posted 26 May 2014 - 06:44 AM

Find a GPU profiler or do it manually by disabling features until you find one that takes too long?


o3o


#8 Armus   Members   -  Reputation: 568

Like
0Likes
Like

Posted 26 May 2014 - 07:01 AM

If you zoom in and get FPS drop that's probably becouse you're fillrate bound by your Particle System.

 

There's small chance that you're ALU bound(heavy pixel shaders) but i woudln't count on that.



#9 invutil   Crossbones+   -  Reputation: 1908

Like
0Likes
Like

Posted 26 May 2014 - 07:17 AM

1. Reducing the shadow map from 2048x2048 to 1024x1024 was the first thing that caused FPS to increase to 30

2. Having the camera amidst the exhaust particles caused lag, possibly because of sorting, but I don't see why sorting would need to do more work

3. Removing bump and specular on 200 units

 

But now the shadows are missing on the trees. A minor detail, messed something up.



#10 Erik Rufelt   Crossbones+   -  Reputation: 3627

Like
1Likes
Like

Posted 26 May 2014 - 09:08 AM

Your screenshot indicates you're running on Intel graphics, if you're on a laptop with dual graphics, make sure your app uses the right GPU.



#11 radioteeth   Prime Members   -  Reputation: 1137

Like
1Likes
Like

Posted 26 May 2014 - 09:10 AM

1. Reducing the shadow map from 2048x2048 to 1024x1024 was the first thing that caused FPS to increase to 30

2. Having the camera amidst the exhaust particles caused lag, possibly because of sorting, but I don't see why sorting would need to do more work

3. Removing bump and specular on 200 units

 

But now the shadows are missing on the trees. A minor detail, messed something up.

 

 

 Whenever there is blending occurring multiple times over the entire screen, like when the camera is inside a bunch of particles, that typically causes a slowdown. Blending is expensive, which usually isn't a problem when it's only over a small portion of the screen. Especially since particles are drawn back-to-front, meaning there is lots of overdraw, which is unfortunately necessary for it to look right, but expensive!



#12 Hodgman   Moderators   -  Reputation: 31799

Like
5Likes
Like

Posted 26 May 2014 - 07:17 PM

Here's the GL extension for timer queries: EXT_timer_query

 

You can use glGenQueries to create a large number of query objects ahead of time and put them into a big list/pool. On the frame you want to profile, grab one query object ID from this list for each object that you draw in your scene, and wrap that object's draw calls in a glBeginQuery/glEndQuery. Record the query ID that you used in another list along with the object's name.

Next frame, use glGetQueryObject* to retrieve the results from those timer queries. Then print the information to a file, including the object names and the time taken by each.

 

I output my data in chrome tracing format, so I can view it in the chrome tracing tool

nNPDfaJ.png

p.s. this is great for CPU profiling too: http://i.imgur.com/Aym7sd0.png

 

 

p.p.s. the screenshots of your game are looking great :D


Edited by Hodgman, 26 May 2014 - 07:22 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS